From 846c26c0d00234ff51a7fcaa180410da24c52d38 Mon Sep 17 00:00:00 2001 From: Steffen Nurpmeso Date: Thu, 27 Jun 2024 21:54:38 +0200 Subject: [PATCH] Bump S-nail v14.9.25.ar ("Lubimy Gorod"), 2024-06-27 --- .gitignore | 4 - .mailmap | 4 - TODO | 569 ----------- include/su/a-t-t.h | 71 -- include/su/avopt.h | 332 ++----- include/su/bits.h | 189 ---- include/su/code-in.h | 52 - include/su/code-ou.h | 54 -- include/su/code.h | 1351 +++----------------------- include/su/config.h | 13 - include/su/cs-dict.h | 1017 ++++++-------------- include/su/cs.h | 611 +++--------- include/su/icodec.h | 664 +++---------- include/su/mem-bag.h | 276 +----- include/su/mem.h | 449 +-------- include/su/prime.h | 76 -- include/su/sort.h | 50 - include/su/utf.h | 93 -- include/su/view.h | 290 +----- mk/make-news-anchors.sh | 135 --- mk/make-release.inc | 529 ---------- mk/make-release.sh | 185 ---- mk/make-release.txt | 41 - mk/mdocmx.sh | 771 --------------- mk/su-doc-strip.pl | 62 -- mk/su-doxygen.rc | 80 -- mk/su-make-cs-ctype.sh | 141 --- nail.1 | 2094 +++++++++++++--------------------------- nail.rc | 2 - src/mx/gen-cmd-tab.h | 63 +- src/mx/gen-okeys.h | 2443 ++++++++++++++++++++--------------------------- src/mx/gen-tcaps.h | 300 +++--- src/su/.main.cc | 636 ------------ src/su/.makefile | 55 -- src/su/cxx-core.cc | 63 -- src/su/gen-cs-ctype.h | 335 ++++--- src/su/gen-errors.h | 746 ++++++--------- 37 files changed, 3132 insertions(+), 11714 deletions(-) delete mode 100644 .gitignore delete mode 100644 .mailmap delete mode 100644 TODO rewrite include/su/avopt.h (81%) rewrite include/su/cs-dict.h (63%) rewrite include/su/cs.h (71%) rewrite include/su/icodec.h (64%) delete mode 100644 mk/make-news-anchors.sh delete mode 100644 mk/make-release.inc delete mode 100644 mk/make-release.sh delete mode 100644 mk/make-release.txt delete mode 100644 mk/mdocmx.sh delete mode 100644 mk/su-doc-strip.pl delete mode 100644 mk/su-doxygen.rc delete mode 100644 mk/su-make-cs-ctype.sh rewrite src/mx/gen-cmd-tab.h (73%) rewrite src/mx/gen-okeys.h (94%) rewrite src/mx/gen-tcaps.h (95%) delete mode 100644 src/su/.main.cc delete mode 100644 src/su/.makefile delete mode 100644 src/su/cxx-core.cc rewrite src/su/gen-cs-ctype.h (96%) rewrite src/su/gen-errors.h (96%) diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 29f14354..00000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.doc/ -.obj/ -gen-*.* -include/mx/config.h diff --git a/.mailmap b/.mailmap deleted file mode 100644 index f6733463..00000000 --- a/.mailmap +++ /dev/null @@ -1,4 +0,0 @@ -Gunnar Ritter -Steffen Nurpmeso -Steffen Nurpmeso -Steffen Nurpmeso diff --git a/TODO b/TODO deleted file mode 100644 index e3da0392..00000000 --- a/TODO +++ /dev/null @@ -1,569 +0,0 @@ -TODO reminder. - -Rename S-nail to S-mailx in v15.0, change things i have messed with -a single, massively backward incompatible change. - -In general the code is in a pretty bad shape due to the signal handling. -I should have sat back in 2012/13 and consider what i am doing. -My fault. If i would, we would have a blocked signal mask anywhere in -this software except in a few cases where it is necessary and/or -possible to deal with signals, and possibly we would not even have to -consider to switch the entire codebase to (the much superior, and the -only sane approach) SysV signal handling, without SA_RESTART. - -But a few things are already pretty good, except for normal iterations -and a review once we have a better signal handling, and can be taken -with us. - -- We should have generic ENOMEM conditions, now that we have $!. - I.e., test overflow (e.g., nam-a-grp.c, whether an alias _can_ be - created / extended), like n_ENOMEM_CHECK(INTTYPE, SIZE1, SIZE2, NIL - or message), which returns m_bool (now bool_t). - Callers need to be aware of NIL returns and pass through errors, - then. - -- We need a "void" box that can be jumped to, i.e., a state in which no box - at all is active. - --- When a MBOX mailbox is removed while it is opened then changing the - folder is not possible. This is an inherent problem of the Berkeley - Mail codebase, and we need to have a fully functional intermediate - VOID box mechanism plus an object-based mailbox implementation to - overcome it. - --- Also, when the folder was modified concurrently we should bail, or, - in an interactive session, prompt the user what to do. - -- IDNA decoding. Needs a complete design change. - (Unless wants to brute force decode anything before display, of course.) - -- Line editing should gain possibility of context sensitive tab completion. --- Offer a(n optional, and on/off switchable) Damerau-Levenshtein - mode for command completion; - -- Maybe there should be an additional ZOMBIE directive that is served in - equal spirit to DEAD, but that could be a valid MBOX... ? - What i want is a *real* resend, best if possible from command line. - Meaning, also the possibility to postpone a message. In general. - -- Having a newsreader would be a really cool thing. (RFC 977 and 2980) - -- printhead()/hprf(): support %n newline format (%t tab?). - Make it possible to use the *datefield* algorithm for plain From_ derived - dates (needs a From_ parser, i.e., strptime()-alike). - Once we have that, rename *datefield-markout-older* to - *date-markout-older* ?? - Note that NetBSD's mail(1) has some other nice things. - Note also that our code is quite unflexible. - -- headerpick: add resend-retain/ignore! (Ralph Corderoy, Norman Shapiro) - (Delivered-To thread on nmh. Will be hard to do because of - codepaths!) - -- -r should be the Sender:, which should automatically propagate to - From: if possible and/or necessary. It should be possible to suppress - -r stuff from From: and Sender:, but fallback to special -r arg as - appropriate. - -Low-Level ---------- - -- Improve name extraction rules. And field parsing. There - are structured and unstructured fields. There are quoted pairs and - comments etc. Rewrite the entire parsing mechanism to comply to RFC - 5322, and try to merge all those many subparsers around in the codebase, - and accordingly. So much duplicated work ... - Name parsing improved a bit for v13 and v14.9, but it's still broken. - yankword(), *extract(), etc.: RFC 5322 says that comments in address - fields SHOULD NOT be used (mutt(1) maps them to full name-addr forms if - approbiate, even if that actually changes content!!?), and that full - name-addr SHOULD be used. - -- After I/O layer rework we should optionally be able to read RSS - (Atom?) feeds -- Expat should be available almost everywhere and - should be able to parse that? - Atom is harder because it may support html+. - I mean, yeah, it's stupid, but we could fill in header fields with - dummies and still use S-nail to look into the separated feeds as if - they were mail messages; anyway i would like to save me from using too - many tools -- three seems reasonable. - -- `sync'hronize commando -- robin@stjerndorff.org (Robin Stjerndorff): - Wondering how to update back to my Maildir, moving new read mails - in ~/Maildir from new to cur, without exiting the application. - Automation available? [And simply re-`[Ff]i' involves a lot of - unnecessary work] - --- Provide sync'ing options -- Jacob Gelbman : - If I open two instances of mailx, I then delete a message and then - quit in one. Then in the other one I read a message and quit, mailx - saves the status of the read message and the fact that a message was - deleted, even though it was opened before the other instance deleted - it. How is it doing that? [Of course he was using Maildir] - -- Add TODO notes for those RFCs: - RFC 977 -> 3977 - Network News Transfer Protocol - RFC 1036 - Standard for USENET Messages - RFC 1939 - Post Office Protocol v3 - RFC 2017 - URL External-Body Access-Type - RFC 2183 - The Content-Disposition Header - RFC 2369 - The Use of URLs as Meta-Syntax for Core Mail List Commands - and their Transport through Message Header Fields - (RFC 6068 - The 'mailto' URL scheme) - RFC 2384,1738 - I.e., Much better URL support - RFC 2387 - multipart/related -- yet handled like /alternative - RFC 2392 - Content-ID and Message-ID Uniform Resource Locators - RFC 2405 - The format of MIME message bodies. - RFC 2406 - Common multimedia types. - RFC 2407 - Encoding of non-ASCII text in message headers. - RFC 2449 - POP3 Extensions (including SASL) - RFC 2595 - TLS for POP3 (among others) - RFC 2980 - Common NNTP Extensions - RFC 3156 - MIME Security with OpenPGP - RFC 3207 - SMTP over TLS - RFC 3461, 3464 - - Simple Mail Transfer Protocol (SMTP) Service Extension for Delivery - Status Notifications (DSNs), - An Extensible Message Format for Delivery Status Notifications - RFC 3676 - Updates to the text/plain MIME type and extensions for flowed - text (format=flowed). (Martin Neitzel) - rfc4315.txt Internet Message Access Protocol (IMAP) - UIDPLUS extension - RFC 4422, 4505 - Simple Authentication and Security layer (SASL) - (Tarqi Kazan) - RFC 4551 IMAP Extension for Conditional STORE - RFC 4880 - OpenPGP Message Format - RFC 4954 - SMTP Authentication - rfc4959.txt IMAP Extension for Simple Authentication and Security - Layer (SASL) Initial Client Response - rfc4978.txt The IMAP COMPRESS Extension - rfc5161.txt The IMAP ENABLE Extension - rfc5198.txt Unicode Format for Network Interchange - RFC 5246 - Transport Layer Security (TLS) - RFC 5321 - Simple Mail Transfer Protocol. - RFC 5322 - The basic format of email messages. - RFC 5598 - Internet Mail Architecture - RFC 5751 - Secure/Multipurpose Internet Mail Extensions (S/MIME) - TODO NOTE that our S/MIME support is extremely weak regarding - TODO understanding, we should not rely on OpenSSL but instead - TODO handle it ourselfs; the RFC says: - S/MIME is used to secure MIME entities. A MIME entity can be a sub- - part, sub-parts of a message, or the whole message with all its sub- - parts. A MIME entity that is the whole message includes only the - MIME message headers and MIME body, and does not include the RFC-822 - header. Note that S/MIME can also be used to secure MIME entities - used in applications other than Internet mail. If protection of the - RFC-822 header is required, the use of the message/rfc822 media type - is explained later in this section. - RFC 6125 - Representation and Verification of Domain-Based Application - Service Identity within Internet Public Key Infrastructure Using - X.509 (PKIX) Certificates in the Context of Transport Layer Security - (TLS) - RFC 6152 - SMTP Service Extension for 8-bit MIME Transport - RFC 6409 - Message Submission for Mail - rfc6530.txt Overview and Framework for Internationalized Email - rfc6531.txt SMTP Extension for Internationalized Email - rfc6532.txt Internationalized Email Headers - rfc6854.txt Update to Internet Message Format to Allow Group Syntax in - the "From:" and "Sender:" Header Fields - rfc6855.txt IMAP Support for UTF-8 - rfc6856.txt Post Office Protocol Version 3 (POP3) Support for UTF-8 - rfc6857.txt Post-Delivery Message Downgrading for Internationalized - Email Messages - rfc6858.txt Simplified POP and IMAP Downgrading for Internationalized Email - RFC 7162 IMAP CONDSTORE & QRESYNC - RFC 8058 Signaling One-Click Functionality for List Email Headers - RFC 8460 on SMTP TLS Reporting - RFC 8461 on SMTP MTA Strict Transport Security (MTA-STS) - RFC 8474 IMAP Extension for Object Identifiers - RFC 8484 on DNS Queries over HTTPS (DoH) - RFC 8550 Secure/Multipurpose Internet Mail Extensions (S/MIME) - Version 4.0 Certificate Handling - RFC 8551 Secure/Multipurpose Internet Mail Extensions (S/MIME) Version - 4.0 Message Specification - RFC 8601 Message Header Field for Indicating Message Authentication Status - RFC 8616 Email Authentication for Internationalized Mail - RFC 8621 The JSON Meta Application Protocol (JMAP) for Mail - RFC 8689 SMTP Require TLS Option - - draft-ietf-uta-email-tls-certs-01.txt - SMTP security via opportunistic DANE TLS draft-ietf-dane-smtp-with-dane-15 - draft-melnikov-smime-header-signing - Considerations for protecting Email header with S/MIME - - Read https://tools.ietf.org/html/draft-ietf-uta-tls-bcp-07. - Can we implement OCSP (see RFC 6066; -> RFC 6960)???? - -- This is how the codebase has to be reworked in respect to signals and - jumping: - - 1. We introduce some environment/carrier structs: struct eval_ctx, - struct cmd_ctx, (struct send_ctx). All of these form lists. - eval_ctx gets a new instance every time evaluate() is entered; for - the interactive mode, commands() instantiates an outermost eval_ctx - that "cannot be left". - - cmd_ctx knows about the eval_ctx in which it is was created; it is - created for each command that has an entry in cmd_tab and is passed - as the new argument of these kind of functions. - (send_ctx is the carrier for the MIME and send layer rewrite.) - They can decide whether an entry shall enter the history list - etc. by themselves, context-based, for example. - - 2. If i say `p 3 2 1' then i mean `3 2 1' not `1 2 3'. - However, sometimes it is ok to have the order created by iterating - the way we do now. This should thus be a cmd-specific flag. - - 3. [cmd_tab handling] The argument parser becomes more intelligent: it - should be able to perform argument checks of subcommands, e.g., - should learn about subcommands, and their very own argument types - / number / etc. - - X. Offer a central "`[un]onevent' EVENT MACRO [conditions]" register. - Change all hooks to use that one, optimize the case where a single - macro is registered for a single event but with different - preconditions. - - E.g., "on_interactive_mode_enter" could then be hooked to call - `bind' and set `colour's, for example. In conjunction with 2. - above those commands could simply be (silent, successful) no-ops - before we reach that state (and again after - on_interactive_mode_leave is processed). - - 8. The line buffer used in evaluate() that is passed through to - commands (thus: in cmd_ctx, then) needs to become `const'. - (I tried to do so in the past, but some commands write into it, - thus i stopped and iirc even added some changes on my own which - take favour of reusing that buffer.) - + Macro execution then no longer needs to clone the macro content - lines before executing then. - - 10. We MUST switch the entire codebase to use SysV signal handling, don't - do the BSDish SA_RESTART, which is why we still suffer the way we - do and need jumps. I can't dig BSD signal handling, and never ever - did so myself until i got here. - - 20. The attachment charset selection loop can then be rewritten to - check whether an ^C occurred and treat that as end-of-loop - condition. In v14.6.3 this was introduced, but it should act - differently depending on whether the interrupt occurred during - character set selection or attachment filename input. - Also in respect whether the interrupt is "propagated" or not. - It's ugly, and documented accordingly. - - 31. Flag updates of individual messages must find their way through to - the protocol. - 32. Use deque (on partial views). - 34. We need a new abstraction: `vie[ws]'. I.e, viewset, viewclear, - view(show|look)? We will have (possibly readonly) boxes, a summary - cache file, which is created when a mailbox is read in, and all - that crap that we currently have (setptr(), setmsize(), etc.!) must - vanish. Instead there is another, in-memory abstraction, the view. - Some views are built-in and are somehow selectable (the "all" view, - for example, and the "new" view). - It is possible to make a view persistent by giving it a name, e.g., - 'viewset NAME MSG-SPEC' -- 'viewset allnew :n' (and 'viewset XY `' - or something must be capable to tag the last a.k.a current). - Switching to a named view would thus look over the entire current - view (!) for all messages that comply to the message-spec of the - view, then create a sorted/threaded display of that subset and - create a new anonymous "result" view. It must be possible to - specify that a view is to be applied to the entire mailbox instead - of the current view, via a simple easy understandable syntax. - - Or name it "msgset". - We won't extend macros that much because it would require much too - much logic for no purpose, instead we'll (hopefully) add some - scriptable abstraction, with an optional built-in Lua binding. - - 50. Support SASL. (I do not like it.) - - 80. The MIME rewrite: mime_parser <-> mime "DOM" analyzer <-> - selectively create filter chains per part and do XY. - - This also affects sending, and it will allow us to dig MIME - (multipart) mail for -t/-m _correctly_. Also in sofar as we can - hook a content-decoder before diving into the MIME structure, and - with a DOM, we can re-encode such things properly as we (re)send - such mails. All this is wrong at the time of this writing! - We still need to special treat things like, e.g., RFC 2046, 5.2.1. - But on top of we-can, as opposed to the opposite. - - (Brezn Stangl, brezn DOT stangl AT yandex DOT com; Martin T) - - 99. Now i'm dreaming some more: with the new object-based approach - multiple mailboxes could be in an open state. And it should be - possible to do so for the user (`file' and `folder' are required to - quit the current mailbox [first -- this not yet]), which is why we - either need new trigger characters or new commands. - The absolute sensation would be joinable operations over multiple - open mailboxes, e.g., views over multiple such! - -200. Split program: when entering interactive mode, the main machine - should fork and the UI should run in the forked one, taking the - terminal (have done setsid, TIOCSTTY, tcsetpgrp, dance). - - Communication via sendmsg()/recvmsg(), it was in BSD as soon as - 1982 says CSRG (date and time created 82/12/04 16:22:24 by - mckusick); ok, a bit different by then, but on 1990-04-04 at - latest in today's form (Mike Karels: [.]define cmsghdr structure - for ancillary data, with new format; move access rights into - ancillary data; add MSG_WAITALL). - - Maybe furtherly diversify: network (with loop), main machine - (with loop), credential helper, i do not know. - Provide security sandboxing if possible, i.e., capsicum, - pledge/unveil, prctl/seccomp. - -- The thread sort doesn't get - - [A is deleted] - B answers A - C answers B - D answers B - E is unrelated - F answers A - - The current sort fails to recognize that F and the thread starting at - B are related, which results in a mess. - Tests: 41.bad-thread, 58.bad-thread .. - --- Being able to sort the outermost level of threads was a suggestion - of Rudolf Sykora, especially being able to sort the outermost level - according to the date of the newest message in a thread. - -- NOTE: we do not really support IPv6 sofar in that we are not prepared to - deal with IPv6 addresses (as in '[ADDR]:PORT'). Pimp url_parse(). - And socket I/O. - -- I had a connection collapse during a POP3 download, and neither was - there a chance to get access to the 22 yet downloaded mails (after - five minutes of waiting followed by CNTRL-C), nor did the layer - recognize this very well (got myriads of `POP3 connection already - closed.' messages, btw., the thirty-something messages which were not - yet downloaded caused (after CNTRL-C) this: ETC. ETC. - -- I got an email in base64 that obviously used CRNL line endings, and once - i've replied the CR where quoted as *control* characters. - Get rid of those (kwcrtest.mbox; may be hard to do everywhere for some - time, due to how we deal with I/O and Send layer etc). - -- edit.c doesn't do NEED_BODY (but IMAP won't work anyway). - -- Stuff - . s-nail FILE' is not interactive, even though it accepts terminal input.) - - .. We should be much smarter regarding when we allow a PAGER etc. to be - used, which is supposed to be a possibly useful thing in - $ s-nail -Scrt=0 >LOG 2>&1 - - . Just like the RFC 3676 link above, it would be nice if it would be - somehow possible to recognize links in a document; i don't know yet - how this could be achieved without losing formatting information (i - mean, we could enable this and inject terminal colour sequences, but - one should be able to say 'follow link x', starting an action - handler, and the 'x' must come from somwhere - simply injecting - '[NUMBER]' references distorts visual). Anyway, it's just a filter - that recognized the usual stuff, and of course we can - simply have a buffer which records all such occurrences, so that - user can say '? xy NUMBER', but without the context it soon gets - hard. - - . Remove all occurrences of mbtowc() with mbrtowc(); temporarily add (some) - global mbstate_t objects until the send / MIME layer rewrite is done and - has the carrier. Use flip states and add aux funs with only update the - state+toggle on success -- CURRENTLY MBTOWC FAILURES ARE PRACTICALLY NOT - HANDLED!! - P.S.: the standards do not allow that well at all. - Since we work so much with *ttycharset* we would need - a setlocale_from_charset(), but which does not exist (except - implicitly for UTF-8 locales). But we need char classification! - This task up to S-CText. - - . which_protocol(), *newmail* mechanism, displayname, mailname: all of - this SHIT must vanish and be replaced by a URL, and - a nice "VFS" mailbox object that carries all necessary state so that - one can work with it. - - If not mentioned somewhere else: struct message should be splitted - into a tree of objects, with a base class that has as few fields as - possible; the global *message should be a deque, only accessible via - iterator; it should store pointers to (the actually used subtype of) - message structures instead; i.e., for maildir boxes the path is yet - allocated separately, then it could be part of the message object, - etc. - It should track the number of contained parts, so that the - "fits-onto-the-screen" tests are more useful than today. - - . Given how many temporary files we use, it would make sense to - support a reusable single temporary file, as in singletmp_take() and - singletmp_release(), where singletmp_release() would close and thus - drop the file if it excesses a specific (configurable) size, and the - mainloop tick would close it (after X (configurable) unused ticks)) - otherwise. I guess this would improve performance for searching - etc. etc. - - . Searching body/text yet includes headers from attachments and - attachment data. This is shit. :) - - . The "nifty" unregister_file()->_compress() mechanism that even - shovels '-Sfolder=imaps://user1@localhost -Srecord="+Sent Items"' - *records* calls clearerr() on the descriptor before performing it's - action anyway. when we really make it even to the I/O rewrite, it - should be possible to dis-/allow such -- it doesn't make sense to - add something faulty to whatever was not faulty before! - - . `dp' prints EOF at the end of a thread even if unread messages - follow - - . `resend' doesn't smime-sign. - - . RFC 5751 describes a message multipart layout that also includes the - headers in the signature; it would be nice (for completeness sake) - to be able to support that. Note shutup@ietf.org. - - . The capability to save a message under the name of a recipient is in - the standard etc., but i've never used it. - What would be cool, otoh, would be if there would be the possibility - to register a regular expression, and if just *any* recipient of - a message matches, store the message in the given folder instead. - I.e., if i send a message to s-nail-users@ then i most likely want - to get a copy to the corresponding box, regardless of whoever the - message was sent To: Cc: or Bcc: else.. - - . mutt list handling (`~') is very powerful - - . We have some use of *at() functions, especially anything which - temporarily switches cwd. - - . *newmail* is terrible. At some later time we need to do somethings - with timeouts etc. (for MBOX and Maildir it's not that bad, but for - anything over the network, yet the mentioned may come in over NFS). - Remove it until we have something better? - - . The RFC 8098 *disposition-notification-send* mechanism is yet not - truly conforming (and works with *from*). Also, this is only the - sender side, there should be support for creating the MDN response. - (Maybe ternary option: off (default), - create-when-unread-flag-goes-away, ditto-but-also-strip-header) - - .. Also, there is DSN as a SMTP extension, see the RFCs 3461, 346 (as - above) and 6522 (Wikipedia). - - . The var_* series should return "const char*" not "char*". - This should already work today because otherwise we would get SEGV - all through the way. - .. While here: rename enum okeys to enum internal_variables, and the - ok_*() series to iv_(). And see below for env_*() series. - - . fexpand() the 2nd: it should return structure because we need to - check for FEDIT_SYSBOX, which currently only checks whether the first - character of a file name is '%', not whether it is '%', '%:FILEPATH' - or '%VALIDUSER', because that is impossible to do! - - . On the long run in-memory password storage should be zeroed after - use, possibly even encoded *during* use. After v15. - - . We need a `spamcheck' command that is like `spamrate' but updates - the mail in-place, i.e., with the headers that the spam engine adds. - - . __narrow_suffix() is wrong (for stateful encodings that we - don't support yet) and should inject a reset sequence if it shortens - the string. - - . When a user edits a specific header, it should no longer be - modified. (Do not loose knowledge that collect() edited it.) - - . The new internal ~/$ expansion mechanism should get support - for POSIX parameter expansions ${[:]-} and ${[:]+} (and ${[:]?}). - There is no real way to get the functionality otherwise... - - . Make S/MIME an option separate of SSL/TLS, i.e., optional. - - . With very long input Heirloom mailx(1) / S-nail(1) can produce - encoded-words (RFC 2047) with incomplete multibyte sequences (i.e., - non self-contained encoded-words). - - . Group addresses, especially the undisclosed recipients but also - "Bla": addresses; are missing. - - . Per-folder (S/MIME) en- and decryption key (Tarqi Kazan): if a xy - variable is set (that points to a key) add a transparent en- and - decryption layer on top of any per-message operation (for boxes for - which the variable is set). - - . For v15.0: remember private thread with Tarqi Kazan (2015-05) and - try to improve situation with *record*, so that only messages enter - it which have really been sent. If we support postponing and have - a multi-process layout and add an intermediate *record-queue* we - may be able to improve the situation. - - . [Dd]ecrypt should transport decryption errors, not silently be like - copy and copy undecrypted content, because this is what it's for? - ..We need atomic operations with rollback support in order to make - this happen, but i think maybe file truncation (decryption always - appends?) is enough provided that files are locked? - WE NEED ATOMIC OPERATION SUPPORT for quite some operations. - Man, are we far from that. - - . `pipe' is total shit regarding MIME. We need some defined and - documented method to configure which parts are displayed and/or how - they are visually separated. - - . Exit status handling is sick. - - . *mime-allow-text-controls* is a no-brainer: instead we should - introduce something that allows us to switch and detect UTF-16 once - we run into the problematic situation, then start all over in an - Unicode mode? I.e.: continue to force the user to set such - a switch, but do it in a sensible fashion, because the UTF-16 data - stream may nonetheless contain control characters?? --- - -. smime_verify(): only dump the multipart that is signed into the file for - verification purposes. DOCUMENT that only the FIRST such part is verified. - Ditto, we don't decrypt but on toplevel. Sic. - -. convert iconv so that it always "places the reset sequence" i.e. - finalizes the string properly. we don't do this at all right now! - -. -:, *mimetypes-load-control*, ?, should honour the given load order; as - appropriate, add a "b" for built-in! - It happened to me that i searched for at least 30 minutes for a bug - that resulted in text/plain not text/x-diff only to find out that this - was because of ArchLinux's /etc/mime.types! - -. getapproval() should support a TRUM1 return, meaning "cancel", - to be understood as appropriate. - -. `mbox' _can_ be made usable anywhere with yet another PS_MBOX global - bypass! ditto touch,save,Save - -. when doing Lreply we may ask for Reply-To:, but strip out the address - actively even if user said yes to the question. That should not - happen? It somehow matches the documentation however. unsure. - -. if -t is used and the file includes Mail-Followup-To:, then we should - NOT add to it, OR we need to offer a way to get there! - -. `mimetype': more type markers: i want to be able to send - application/mbox as text if it is 7bit clean; ditto application/x-sh. - Ditto xml etc. And: if highbits, try conversion, but fall back to - base64 instead of failing to send the message. - ?ui=t,wire=7bit,8bit-or-base64 - Something like that. - -- negation - In fact the message selection should be an object with lifetime. - Like this we can not only provide "type SPEC" in match order, but also - support for example colour or the header summary with message spec - preconditions, a la - - colour 256 sum-header ft=reverse @BLABLA :n - - (Keep "older" and "dot" forever, even though that is "." and a colon - modifier that we yet do not have.) - -- redirections - -# s-ts-mode diff --git a/include/su/a-t-t.h b/include/su/a-t-t.h index 8380927e..f3104e1c 100644 --- a/include/su/a-t-t.h +++ b/include/su/a-t-t.h @@ -21,82 +21,21 @@ #ifndef su_A_T_T_DECL_ONLY # define su_A_T_T_H #endif - -#ifdef CXX_DOXYGEN -/*! - * \file - * \ingroup COLL - * \brief Automatic \r{type_toolbox} toolboxes - * - * This file has the special property that if the preprocessor variable - * \c{su_A_T_T_DECL_ONLY} is defined before it is included, then only minimal - * declarations are provided, just enough to prototype an actual usage - * \c{typedef}. - * A later inclusion (without that variable) will then provide the definitions. - */ -#endif - -#include -su_USECASE_MX_DISABLED -#if !su_C_LANG || defined CXX_DOXYGEN - #ifndef su_A_T_T_DECL_ONLY # include #endif - #define su_CXX_HEADER #include NSPC_BEGIN(su) - template class auto_type_toolbox; - #ifndef su_A_T_T_DECL_OK # define su_A_T_T_DECL_OK - -/*! - * \ingroup COLL - * \brief Automatic \r{type_toolbox} toolboxes (\r{su/a-t-t.h}) - * - * Supposed that a (newly created) C++ type provides a basic set of - * functionality, easy creation of a toolbox instance becomes possible: - * - * \cb{ - * auto_type_toolbox const att; - * - * type_toolbox const *ttp = att.get_instance(); - * } - * - * For this to work, we need: - * - * \list{\li{ - * A default constructor and an assignment method, the latter of which with the - * \r{su_state_err_type} plus \r{su_state_err_flags} status argument documented - * for \r{su_clone_fun}. - * }\li{ - * An unequality operator \fn{!=}. - * }\li{ - * A function \fn{uz hash(void) const}. - * }} - * - * \remarks{If \a{T} is a pointer type, the a-t-t will still create heap - * clones, so \c{T*} and \c{T} are in fact treated alike!} - * - * \remarks{Many \SU object types and functionality groups offer - * specializations, for example \r{CS}.} - */ template class auto_type_toolbox{ public: - /*! \_ */ typedef NSPC(su)type_traits type_traits; - - /*! Accessing this field should be avoided because there may be - * specializations which do not offer it -- \r{get_instance()} is inline. */ static type_toolbox const instance; - - /*! \_ */ static type_toolbox const *get_instance(void) {return &instance;} - private: static typename type_traits::tp s_clone(typename type_traits::tp_const t, u32 estate); @@ -108,7 +47,6 @@ private: static uz s_hash(typename type_traits::tp_const self); }; #endif /* su_A_T_T_DECL_OK */ - #ifdef su_A_T_T_DECL_ONLY # undef su_A_T_T_DECL_ONLY #else @@ -123,14 +61,12 @@ auto_type_toolbox::s_clone(typename type_traits::tp_const t, u32 estate){ } return self; } - template PRI STA void auto_type_toolbox::s_delete(typename type_traits::tp self){ ASSERT_RET_VOID(self != NIL); su_DEL(self); } - template PRI STA typename type_traits::tp auto_type_toolbox::s_assign(typename type_traits::tp self, @@ -143,7 +79,6 @@ auto_type_toolbox::s_assign(typename type_traits::tp self, } return self; } - template PRI STA sz auto_type_toolbox::s_compare(typename type_traits::tp_const self, @@ -152,21 +87,15 @@ auto_type_toolbox::s_compare(typename type_traits::tp_const self, ASSERT_RET(t != NIL, 1); return self->compare(*t); } - template PRI STA uz auto_type_toolbox::s_hash(typename type_traits::tp_const self){ ASSERT_RET(self != NIL, 0); return self->hash(); } - template STA type_toolbox const auto_type_toolbox::instance = su_TYPE_TOOLBOX_I9R(&s_clone, &s_delete, &s_assign, &s_compare, &s_hash); #endif // !su_A_T_T_DECL_ONLY - NSPC_END(su) #include -#endif /* !su_C_LANG || defined CXX_DOXYGEN */ -#endif /* su_A_T_T_H */ -/* s-it-mode */ diff --git a/include/su/avopt.h b/include/su/avopt.h dissimilarity index 81% index 7ea3622a..0cceff05 100644 --- a/include/su/avopt.h +++ b/include/su/avopt.h @@ -1,275 +1,57 @@ -/*@ Command line option parser. - * - * Copyright (c) 2001 - 2020 Steffen (Daode) Nurpmeso . - * SPDX-License-Identifier: ISC - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, 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. - */ -#ifndef su_AVOPT_H -#define su_AVOPT_H - -/*! - * \file - * \ingroup AVOPT - * \brief \r{AVOPT} - */ - -#include - -#define su_HEADER -#include -C_DECL_BEGIN - -struct su_avopt; - -/*! - * \defgroup AVOPT Command line argument parser - * \ingroup MISC - * \brief Command line argument option parser (\r{su/avopt.h}) - * - * Differences to the POSIX \c{getopt()} standard: - * - * \list{\li{ - * Long options are supported. - * They can be mapped to a short option by adding a \c{;CHAR} suffix to - * the long option (after the possible \c{:} which indicates an argument). - * If so, calling \r{su_avopt_parse()} will return the short option equivalence - * instead of only setting \r{su_avopt::avo_current_long_idx} and returning - * \r{su_AVOPT_STATE_LONG}. - * }\li{ - * If long options are used, documentation strings can be included, and dumped - * via \r{su_avopt_dump_doc()}. - * They can be appended after a \c{;} suffix that follows the possibly empty - * short option mapping. - * See below for examples. - * }\li{ - * This implementation always differentiates in between - * \r{su_AVOPT_STATE_ERR_OPT} and \r{su_AVOPT_STATE_ERR_ARG} errors. - * A leading colon \c{:} in the short option string is thus treated as a normal - * argument. - * }\li{ - * Any printable ASCII character except hyphen-minus \c{-} may be used as an - * option. - * - * Long options can neither contain colon \c{:} (indicating the option has an - * argument), semicolon \c{;} (indicating a short option letter equivalent - * follows), nor the equal-sign \c{=} (used to separate an option and argument - * within the same argument vector slot), however. - * - * It is best to place the short option colon \c{:} as the first entry in the - * short option string, otherwise the colon will be mistreated as an argument - * requirement for the preceeding option. - * }\li{ - * Error messages are not logged. - * Instead, the format strings \r{su_avopt_fmt_err_arg} and - * \r{su_avopt_fmt_err_opt} can be used with an argument of - * \r{su_avopt::avo_current_err_opt}. - * }} - * - * \cb{ - * #define N_(X) X - * static char const a_sopts[] = "::A:h#"; - * static char const * const a_lopts[] = { - * "resource-files:;:;" N_("control loading of resource files"), - * "account:;A;" N_("execute an `account' command"), - * "batch-mode;#;" N_("more confined non-interactive setup"), - * "long-help;\201;" N_("this listing"), - * NIL - * }; - * - * struct su_avopt avo; - * char const *emsg; - * s8 i; - * - * su_avopt_setup(&avo, --argc, su_C(char const*const*,++argv), - * a_sopts, a_lopts); - * while((i = su_avopt_parse(&avo)) != su_AVOPT_STATE_DONE){ - * switch(i){ - * case 'A': - * "account_name" = avo.avo_current_arg; - * break; - * case 'h': - * case su_S(char,su_S(su_u8,'\201')): - * a_main_usage(n_stdout); - * if(i != 'h'){ - * fprintf(n_stdout, "\nLong options:\n"); - * su_avopt_dump_doc(&avo, &a_main_dump_doc, su_S(su_up,n_stdout)); - * } - * exit(0); - * case '#': - * n_var_setup_batch_mode(); - * break; - * case su_AVOPT_STATE_ERR_ARG: - * emsg = su_avopt_fmt_err_arg; - * if(0){ - * // FALLTHRU - * case su_AVOPT_STATE_ERR_OPT: - * emsg = su_avopt_fmt_err_opt; - * } - * fprintf(stderr, emsg, avo.avo_current_err_opt); - * exit(1); - * } - * } - * - * argc = avo.avo_argc; - * argv = su_C(char**,avo.avo_argv); - * } - * - * \remarks{Since the return value of \r{su_avopt_parse()} and - * \r{su_avopt::avo_current_opt} are both \r{su_s8}, the entire range of bytes - * with the high bit set is available to provide short option equivalences for - * long options.} - * @{ - */ - -/*! \remarks{The values of these constants are ASCII control characters.} */ -enum su_avopt_state{ - su_AVOPT_STATE_DONE = '\0', /*!< \_ */ - su_AVOPT_STATE_STOP = '\001', /*!< \_ */ - su_AVOPT_STATE_LONG = '\002', /*!< \_ */ - su_AVOPT_STATE_ERR_ARG = '\003', /*!< \_ */ - su_AVOPT_STATE_ERR_OPT = '\004' /*!< \_ */ -}; - -/*! \remarks{Most fields make sense only after \r{su_avopt_parse()} has been - * called (at least once).} */ -struct su_avopt{ - char const *avo_current_arg; /*!< Current argument or \NIL. */ - s8 avo_current_opt; /*!< Or a \r{su_avopt_state} constant. */ - u8 avo_flags; - /*! Only useful if \r{su_AVOPT_STATE_LONG} has been returned (and can be - * found in \r{su_avopt::avo_current_opt}). */ - u16 avo_current_long_idx; - u32 avo_argc; /*!< Remaining count. */ - char const * const *avo_argv; /*!< Remaining entries. */ - char const *avo_curr; - char const *avo_opts_short; /*!< Short options as given. */ - char const * const *avo_opts_long; /*!< Long options as given. */ - /*! The current option that lead to an error as a NUL terminated string. - * In case of long options only this may include the argument, too, i.e., - * the entire argument vector entry which caused failure. - * Only useful if any of \r{su_AVOPT_STATE_ERR_ARG} and - * \r{su_AVOPT_STATE_ERR_OPT} has occurred. */ - char const *avo_current_err_opt; - char avo__buf[Z_ALIGN_PZ(2)]; -}; - -/*! \_ */ -EXPORT_DATA char const su_avopt_fmt_err_arg[]; - -/*! \_ */ -EXPORT_DATA char const su_avopt_fmt_err_opt[]; - -/*! One of \a{opts_short_or_nil} and \a{opts_long_or_nil} must be given. - * The latter must be a \NIL terminated array. */ -EXPORT struct su_avopt *su_avopt_setup(struct su_avopt *self, - u32 argc, char const * const *argv, - char const *opts_short_or_nil, char const * const *opts_long_or_nil); - -/*! Returns either a member of \r{su_avopt_state} to indicate errors and - * other states, or a short option character. - * In case of \r{su_AVOPT_STATE_LONG}, \r{su_avopt::avo_current_long_idx} - * points to the entry in \r{su_avopt::avo_opts_long} that has been - * detected. */ -EXPORT s8 su_avopt_parse(struct su_avopt *self); - -/*! If there are long options, query them all in order and dump them via the - * given pointer to function \a{ptf}. - * If there is a short option equivalence, \a{sopt} is not the empty string. - * Options will be preceeded with \c{-} and \c{--}, respectively. - * Stops when \a{ptf} returns \FAL0, otherwise returns \TRU1. - * - * \remarks{The long option string is copied over to a stack buffer of 128 - * bytes (\a{lopt}), any excess is cut off.} - * - * \remarks{The documentation string \a{doc} always points to a byte in the - * corresponding long option string passed in by the user.} */ -EXPORT boole su_avopt_dump_doc(struct su_avopt const *self, - boole (*ptf)(up cookie, boole has_arg, char const *sopt, - char const *lopt, char const *doc), up cookie); - -/*! @} */ -C_DECL_END -#include -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class avopt; - -/*! - * \ingroup AVOPT - * C++ variant of \r{AVOPT} (\r{su/avopt.h}) - */ -class EXPORT avopt : private su_avopt{ -public: - /*! \copydoc{su_avopt_state} */ - enum state{ - /*! \copydoc{su_AVOPT_STATE_DONE} */ - state_done = su_AVOPT_STATE_DONE, - /*! \copydoc{su_AVOPT_STATE_LONG} */ - state_long = su_AVOPT_STATE_LONG, - /*! \copydoc{su_AVOPT_STATE_ERR_ARG} */ - state_err_arg = su_AVOPT_STATE_ERR_ARG, - /*! \copydoc{su_AVOPT_STATE_ERR_OPT} */ - state_err_opt = su_AVOPT_STATE_ERR_OPT - }; - - /*! \copydoc{su_avopt_setup()} */ - avopt(u32 argc, char const * const *argv, char const *opts_short, - char const * const *opts_long=NIL){ - su_avopt_setup(this, argc, argv, opts_short, opts_long); - } - /*! \_ */ - ~avopt(void){} - - /*! \copydoc{su_avopt_parse()} */ - s8 parse(void) {return su_avopt_parse(this);} - - /*! \copydoc{su_avopt::avo_current_arg} */ - char const *current_arg(void) const {return avo_current_arg;} - - /*! \copydoc{su_avopt::avo_current_opt} */ - s8 current_opt(void) const {return avo_current_opt;} - - /*! \copydoc{su_avopt::avo_current_long_idx} */ - u16 current_long_idx(void) const {return avo_current_long_idx;} - - /*! \copydoc{su_avopt::avo_current_err_opt} */ - char const *current_err_opt(void) const {return avo_current_err_opt;} - - /*! \copydoc{su_avopt::avo_argc} */ - s32 argc(void) const {return avo_argc;} - - /*! \copydoc{su_avopt::avo_argv} */ - char const * const *argv(void) const {return avo_argv;} - - /*! \copydoc{su_avopt::avo_opts_short} */ - char const *opts_short(void) const {return avo_opts_short;} - - /*! \copydoc{su_avopt::avo_opts_long} */ - char const * const *opts_long(void) const {return avo_opts_long;} - - /*! \copydoc{su_avopt_dump_doc()} */ - boole dump_doc(boole (*ptf)(up cookie, boole has_arg, char const *sopt, - char const *lopt, char const *doc), up cookie=NIL) const{ - return su_avopt_dump_doc(this, ptf, cookie); - } -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ -#endif /* su_AVOPT_H */ -/* s-it-mode */ +/*@ Command line option parser. + * + * Copyright (c) 2001 - 2020 Steffen (Daode) Nurpmeso . + * SPDX-License-Identifier: ISC + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, 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. + */ +#ifndef su_AVOPT_H +#define su_AVOPT_H +#include +#define su_HEADER +#include +C_DECL_BEGIN +struct su_avopt; +enum su_avopt_state{ + su_AVOPT_STATE_DONE = '\0', + su_AVOPT_STATE_STOP = '\001', + su_AVOPT_STATE_LONG = '\002', + su_AVOPT_STATE_ERR_ARG = '\003', + su_AVOPT_STATE_ERR_OPT = '\004' +}; +struct su_avopt{ + char const *avo_current_arg; + s8 avo_current_opt; + u8 avo_flags; + u16 avo_current_long_idx; + u32 avo_argc; + char const * const *avo_argv; + char const *avo_curr; + char const *avo_opts_short; + char const * const *avo_opts_long; + char const *avo_current_err_opt; + char avo__buf[Z_ALIGN_PZ(2)]; +}; +EXPORT_DATA char const su_avopt_fmt_err_arg[]; +EXPORT_DATA char const su_avopt_fmt_err_opt[]; +EXPORT struct su_avopt *su_avopt_setup(struct su_avopt *self, + u32 argc, char const * const *argv, + char const *opts_short_or_nil, char const * const *opts_long_or_nil); +EXPORT s8 su_avopt_parse(struct su_avopt *self); +EXPORT boole su_avopt_dump_doc(struct su_avopt const *self, + boole (*ptf)(up cookie, boole has_arg, char const *sopt, + char const *lopt, char const *doc), up cookie); +C_DECL_END +#include +#endif /* su_AVOPT_H */ +/* s-it-mode */ diff --git a/include/su/bits.h b/include/su/bits.h index 1d741301..6273f2cf 100644 --- a/include/su/bits.h +++ b/include/su/bits.h @@ -17,84 +17,34 @@ */ #ifndef su_BITS_H #define su_BITS_H - -/*! - * \file - * \ingroup BITS - * \brief \r{BITS} - */ - #include - #define su_HEADER #include C_DECL_BEGIN - -/*! - * \defgroup BITS Bit operations - * \ingroup MISC - * \brief Bit operations (\r{su/bits.h}) - * @{ - */ - -/*! Round up \a{BITS} to the next \r{su_UZ_BITS} multiple. - * \remarks{\a{BITS} may not be 0.} */ #define su_BITS_ROUNDUP(BITS) (((BITS) + (su_UZ_BITS - 1)) & ~(su_UZ_BITS - 1)) - -/*! Calculate needed number of \r{su_uz} (array entries) to store \a{BITS}. - * \remarks{\a{BITS} may not be 0.} */ #define su_BITS_TO_UZ(BITS) (su_BITS_ROUNDUP(BITS) / su_UZ_BITS) - -/*! Array offset for \a{BIT}. */ #define su_BITS_WHICH_OFF(BIT) ((BIT) / su_UZ_BITS) - -/*! Bit to test in slot indexed via \r{su_BITS_WHICH_OFF()}. */ #define su_BITS_WHICH_BIT(BIT) ((BIT) & (su_UZ_BITS - 1)) - -/*! Maximum useful offset in a \r{su_uz} array for \a{BITS}. - * \remarks{\a{BITS} may not be 0.} */ #define su_BITS_TOP_OFF(BITS) (su_BITS_TO_UZ(BITS) - 1) - -/*! Number of useful bits in the topmost offset of a \r{su_uz} array used to - * store \a{BITS}. - * \remarks{\a{BITS} may not be 0.} */ #define su_BITS_TOP_BITNO(BITS) (su_UZ_BITS - (su_BITS_ROUNDUP(BITS) - (BITS))) - -/*! The mask for the topmost offset of a \r{su_uz} array used to store - * store \a{BITS}. - * \remarks{\a{BITS} may not be 0.} */ #define su_BITS_TOP_MASK(BITS) (su_UZ_MAX >> (su_BITS_ROUNDUP(BITS) - (BITS))) - -/*! Create a bit mask for the inclusive bit range \a{LO} to \a{HI}. - * \remarks{\a{HI} cannot use highest bit!} - * \remarks{Identical to \r{su_BITENUM_MASK().} */ #define su_BITS_RANGE_MASK(LO,HI) su_BITENUM_MASK(LO, HI) - -/*! \_ */ INLINE boole su_bits_test(uz x, uz bit){ ASSERT_RET(bit < UZ_BITS, FAL0); return ((x & (1lu << bit)) != 0); } - -/*! \_ */ INLINE uz su_bits_set(uz x, uz bit){ ASSERT_RET(bit < UZ_BITS, x); return (x | (1lu << bit)); } - -/*! \_ */ INLINE uz su_bits_flip(uz x, uz bit){ ASSERT_RET(bit < UZ_BITS, x); return (x ^ (1lu << bit)); } - -/*! \_ */ INLINE uz su_bits_clear(uz x, uz bit){ ASSERT_RET(bit < UZ_BITS, x); return (x & ~(1lu << bit)); } - -/*! \_ */ INLINE boole su_bits_test_and_set(uz *xp, uz bit){ boole rv; ASSERT_RET(xp != NIL, FAL0); @@ -104,8 +54,6 @@ INLINE boole su_bits_test_and_set(uz *xp, uz bit){ *xp |= bit; return rv; } - -/*! \_ */ INLINE boole su_bits_test_and_flip(uz *xp, uz bit){ boole rv; ASSERT_RET(xp != NIL, FAL0); @@ -115,8 +63,6 @@ INLINE boole su_bits_test_and_flip(uz *xp, uz bit){ *xp ^= bit; return rv; } - -/*! \_ */ INLINE boole su_bits_test_and_clear(uz *xp, uz bit){ boole rv; ASSERT_RET(xp != NIL, FAL0); @@ -126,8 +72,6 @@ INLINE boole su_bits_test_and_clear(uz *xp, uz bit){ *xp &= ~bit; return rv; } - -/*! \r{su_UZ_MAX} if none found. */ INLINE uz su_bits_find_first_set(uz x){ uz i = 0; if(x != 0) @@ -136,197 +80,64 @@ INLINE uz su_bits_find_first_set(uz x){ while((++i, x >>= 1)); return UZ_MAX; } - -/*! \r{su_UZ_MAX} if none found. */ INLINE uz su_bits_find_last_set(uz x){ if(x != 0){ uz i = UZ_BITS - 1; - do if(x & (1lu << i)) return i; while(i--); } return UZ_MAX; } - -/*! \_ */ INLINE uz su_bits_rotate_left(uz x, uz bits){ ASSERT_RET(bits < UZ_BITS, x); return ((x << bits) | (x >> (UZ_BITS - bits))); } - -/*! \_ */ INLINE uz su_bits_rotate_right(uz x, uz bits){ ASSERT_RET(bits < UZ_BITS, x); return ((x >> bits) | (x << (UZ_BITS - bits))); } - -/*! \_ */ INLINE boole su_bits_array_test(uz const *xap, uz bit){ ASSERT_RET(xap != NIL, FAL0); return su_bits_test(xap[su_BITS_WHICH_OFF(bit)], su_BITS_WHICH_BIT(bit)); } - -/*! \_ */ INLINE void su_bits_array_set(uz *xap, uz bit){ ASSERT_RET_VOID(xap != NIL); xap += su_BITS_WHICH_OFF(bit); *xap = su_bits_set(*xap, su_BITS_WHICH_BIT(bit)); } - -/*! \_ */ INLINE void su_bits_array_flip(uz *xap, uz bit){ ASSERT_RET_VOID(xap != NIL); xap += su_BITS_WHICH_OFF(bit); *xap = su_bits_flip(*xap, su_BITS_WHICH_BIT(bit)); } - -/*! \_ */ INLINE void su_bits_array_clear(uz *xap, uz bit){ ASSERT_RET_VOID(xap != NIL); xap += su_BITS_WHICH_OFF(bit); *xap = su_bits_clear(*xap, su_BITS_WHICH_BIT(bit)); } - -/*! \_ */ INLINE boole su_bits_array_test_and_set(uz *xap, uz bit){ ASSERT_RET(xap != NIL, FAL0); xap += su_BITS_WHICH_OFF(bit); return su_bits_test_and_set(xap, su_BITS_WHICH_BIT(bit)); } - -/*! \_ */ INLINE boole su_bits_array_test_and_flip(uz *xap, uz bit){ ASSERT_RET(xap != NIL, FAL0); xap += su_BITS_WHICH_OFF(bit); return su_bits_test_and_flip(xap, su_BITS_WHICH_BIT(bit)); } - -/*! \_ */ INLINE boole su_bits_array_test_and_clear(uz *xap, uz bit){ ASSERT_RET(xap != NIL, FAL0); xap += su_BITS_WHICH_OFF(bit); return su_bits_test_and_clear(xap, su_BITS_WHICH_BIT(bit)); } - #if 0 /* TODO port array_find_first() */ -/*! \_ */ EXTERN uz su_bits_array_find_first_set(uz const *xap, uz xaplen); - -/*! \_ */ EXTERN uz su_bits_array_find_last_set(uz const *xap, uz xaplen); - -/*! \_ */ EXTERN uz su_bits_array_find_first_set_after(uz const *xap, uz xaplen, uz startbit); #endif - -/*! @} */ C_DECL_END #include -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class bits; - -/*! - * \ingroup BITS - * C++ variant of \r{BITS} (\r{su/bits.h}) - */ -class bits{ -public: - /*! \copydoc{su_bits_test()} */ - static boole test(uz x, uz bit) {return su_bits_test(x, bit);} - - /*! \copydoc{su_bits_set()} */ - static uz set(uz x, uz bit) {return su_bits_set(x, bit);} - - /*! \copydoc{su_bits_flip()} */ - static uz flip(uz x, uz bit) {return su_bits_flip(x, bit);} - - /*! \copydoc{su_bits_clear()} */ - static uz clear(uz x, uz bit) {return su_bits_clear(x, bit);} - - /*! \copydoc{su_bits_test_and_set()} */ - static boole test_and_set(uz *xp, uz bit){ - return su_bits_test_and_set(xp, bit); - } - - /*! \copydoc{su_bits_test_and_flip()} */ - static boole test_and_flip(uz *xp, uz bit){ - return su_bits_test_and_flip(xp, bit); - } - - /*! \copydoc{su_bits_test_and_clear()} */ - static boole test_and_clear(uz *xp, uz bit){ - return su_bits_test_and_clear(xp, bit); - } - - /*! \copydoc{su_bits_find_first_set()} */ - static uz find_first_set(uz x) {return su_bits_find_first_set(x);} - - /*! \copydoc{su_bits_find_last_set()} */ - static uz find_last_set(uz x) {return su_bits_find_last_set(x);} - - /*! \copydoc{su_bits_rotate_left()} */ - static uz rotate_left(uz x, uz bits) {return su_bits_rotate_left(x, bits);} - - /*! \copydoc{su_bits_rotate_right()} */ - static uz rotate_right(uz x, uz bits){ - return su_bits_rotate_right(x, bits); - } - - /*! \copydoc{su_bits_array_test()} */ - static boole array_test(uz const *xap, uz bit){ - return su_bits_array_test(xap, bit); - } - - /*! \copydoc{su_bits_array_set()} */ - static void array_set(uz *xap, uz bit) {su_bits_array_set(xap, bit);} - - /*! \copydoc{su_bits_array_flip()} */ - static void array_flip(uz *xap, uz bit) {su_bits_array_flip(xap, bit);} - - /*! \copydoc{su_bits_array_clear()} */ - static void array_clear(uz *xap, uz bit) {su_bits_array_clear(xap, bit);} - - /*! \copydoc{su_bits_array_test_and_set()} */ - static boole array_test_and_set(uz *xap, uz bit){ - return su_bits_array_test_and_set(xap, bit); - } - - /*! \copydoc{su_bits_array_test_and_flip()} */ - static boole array_test_and_flip(uz *xap, uz bit){ - return su_bits_array_test_and_flip(xap, bit); - } - - /*! \copydoc{su_bits_array_test_and_clear()} */ - static boole array_test_and_clear(uz *xap, uz bit){ - return su_bits_array_test_and_clear(xap, bit); - } - -#if 0 /* TODO port array_find_first() */ - /*! \copydoc{su_bits_array_find_first_set()} */ - static uz array_find_first_set(uz const *xap, uz xaplen){ - return su_bits_array_find_first_set(xap, xaplen); - } - - /*! \copydoc{su_bits_array_find_last_set()} */ - static uz array_find_last_set(uz const *xap, uz xaplen){ - return su_bits_array_find_last_set(xap, xaplen); - } - - /*! \copydoc{su_bits_array_find_first_set_after()} */ - static uz array_find_first_set_after(uz const *xap, uz xaplen, uz startbit){ - return su_bits_array_find_first_set_after(xap, xaplen, startbit); - } -#endif -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ #endif /* su_BITS_H */ /* s-it-mode */ diff --git a/include/su/code-in.h b/include/su/code-in.h index cdd5f968..76a41b72 100644 --- a/include/su/code-in.h +++ b/include/su/code-in.h @@ -22,9 +22,7 @@ # error su/code-ou.h must be included before including su/code-in.h again #endif #define su_CODE_IN_H - /* LANG */ - #undef C_LANG #undef C_DECL_BEGIN #undef C_DECL_END @@ -35,11 +33,9 @@ #define NSPC_END su_NSPC_END #define NSPC_USE su_NSPC_USE #define NSPC su_NSPC - #if defined su_CXX_HEADER || (defined su_SOURCE && !su_C_LANG) # define CLASS_NO_COPY su_CLASS_NO_COPY # define SELFTHIS_RET su_SELFTHIS_RET - # define PUB su_PUB # define PRO su_PRO # define PRI su_PRI @@ -48,15 +44,11 @@ # define OVR su_OVR # define OVRX su_OVRX #endif - #define S su_S #define R su_R #define C su_C - #define NIL su_NIL - #define SHADOW su_SHADOW - #if defined su_HEADER || defined su_CXX_HEADER # ifdef su_SOURCE # define EXPORT su_EXPORT @@ -85,23 +77,17 @@ # define IMPORT su_IMPORT # define IMPORT_DATA su_IMPORT_DATA #endif - #define CTA su_CTA #define LCTA su_LCTA #define CTAV su_CTAV #define LCTAV su_LCTAV #define MCTA su_MCTA - /* CC */ - #define INLINE su_INLINE #define SINLINE su_SINLINE - #define LIKELY su_LIKELY #define UNLIKELY su_UNLIKELY - /* SUPPORT MACROS+ */ - #undef ABS #undef CLIP #undef IS_POW2 @@ -120,13 +106,11 @@ #define ROUND_DOWN2 su_ROUND_DOWN2 #define ROUND_UP su_ROUND_UP #define ROUND_UP2 su_ROUND_UP2 - #define ALIGNOF su_ALIGNOF #define P_ALIGN su_P_ALIGN #define Z_ALIGN_OVER su_Z_ALIGN_OVER #define Z_ALIGN su_Z_ALIGN #define Z_ALIGN_PZ su_Z_ALIGN_PZ - /* ASSERT series */ #define ASSERT_INJ su_ASSERT_INJ #define ASSERT_INJOR su_ASSERT_INJOR @@ -145,33 +129,26 @@ #define ASSERT_NYD_EXEC_LOC su_ASSERT_NYD_EXEC_LOC #define ASSERT_NYD su_ASSERT_NYD #define ASSERT_NYD_LOC su_ASSERT_NYD_LOC - #define BITENUM_IS su_BITENUM_IS #define BITENUM_MASK su_BITENUM_MASK - #define DBG su_DBG #define NDGB su_NDBG #define DBGOR su_DBGOR #define DVL su_DVL #define NDVL su_NDVL #define DVLOR su_DVLOR - #define FIELD_INITN su_FIELD_INITN #define FIELD_INITI su_FIELD_INITI #define FIELD_OFFSETOF su_FIELD_OFFSETOF #define FIELD_RANGEOF su_FIELD_RANGEOF #define FIELD_SIZEOF su_FIELD_SIZEOF - #define MT su_MT - #define NELEM su_NELEM - /* Not-Yet-Dead macros TODO stubs */ #define NYD_OU_LABEL su_NYD_OU_LABEL #define su__NYD_IN do{ #define su__NYD_OU goto NYD_OU_LABEL;NYD_OU_LABEL:;}while(0) #define su__NYD do{}while(0) - #if defined NDEBUG || (!defined su_HAVE_DEBUG && !defined su_HAVE_DEVEL) # define NYD_IN su__NYD_IN # define NYD_OU su__NYD_OU @@ -200,11 +177,8 @@ # define NYD2_OU su__NYD_OU # define NYD2 su__NYD #endif - #define P2UZ su_P2UZ - #define PCMP su_PCMP - /* Translation: may NOT set errno! */ #undef _ #undef N_ @@ -226,23 +200,16 @@ # define N_(S) S # define V_(S) S #endif - #define SMP su_SMP - #define UCMP su_UCMP - #define UNCONST su_UNCONST #define UNVOLATILE su_UNVOLATILE #define UNALIGN su_UNALIGN - #define UNINIT su_UNINIT #define UNINIT_DECL su_UNINIT_DECL - #define UNUSED su_UNUSED - #define VFIELD_SIZE su_VFIELD_SIZE #define VSTRUCT_SIZEOF su_VSTRUCT_SIZEOF - /* POD TYPE SUPPORT (only if !C++) */ #if defined su_HEADER ||\ ((defined su_SOURCE || defined mx_SOURCE) && su_C_LANG) @@ -250,67 +217,51 @@ # define ui su_ui # define us su_us # define uc su_uc - # define sl su_sl # define si su_si # define ss su_ss # define sc su_sc - # define u8 su_u8 # define s8 su_s8 - # define u16 su_u16 # define s16 su_s16 - # define u32 su_u32 # define s32 su_s32 - # define u64 su_u64 # define s64 su_s64 - # define uz su_uz # define sz su_sz - # define up su_up # define sp su_sp - # define FAL0 su_FAL0 # define TRU1 su_TRU1 # define TRU2 su_TRU2 # define TRUM1 su_TRUM1 # define boole su_boole #endif /* su_HEADER || ((su_SOURCE || mx_SOURCE) && su_C_LANG) */ - #define U8_MAX su_U8_MAX #define S8_MIN su_S8_MIN #define S8_MAX su_S8_MAX - #define U16_MAX su_U16_MAX #define S16_MIN su_S16_MIN #define S16_MAX su_S16_MAX - #define U32_MAX su_U32_MAX #define S32_MIN su_S32_MIN #define S32_MAX su_S32_MAX - #define U64_MAX su_U64_MAX #define S64_MIN su_S64_MIN #define S64_MAX su_S64_MAX #define U64_C su_U64_C #define S64_C su_S64_C - #define UZ_MAX su_UZ_MAX #define SZ_MIN su_SZ_MIN #define SZ_MAX su_SZ_MAX #define UZ_BITS su_UZ_BITS - /* MEMORY */ - #define su_ALLOCATE su_MEM_ALLOCATE #define su_ALLOCATE_LOC su_MEM_ALLOCATE_LOC #define su_REALLOCATE su_MEM_REALLOCATE #define su_REALLOCATE_LOC su_MEM_REALLOCATE_LOC - #define su_ALLOC su_MEM_ALLOC #define su_ALLOC_LOC su_MEM_ALLOC_LOC #define su_ALLOC_LOCOR su_MEM_ALLOC_LOCOR @@ -350,7 +301,6 @@ #define su_FREE su_MEM_FREE #define su_FREE_LOC su_MEM_FREE_LOC #define su_FREE_LOCOR su_MEM_FREE_LOCOR - #if !su_C_LANG # define su_NEW su_MEM_NEW # define su_NEW_LOC su_MEM_NEW_LOC @@ -374,7 +324,6 @@ # define su_DEL_HEAP_PRIVATE_LOC su_MEM_DEL_HEAP_PRIVATE_LOC # define su_DEL_HEAP_PRIVATE_LOCOR su_MEM_DEL_HEAP_PRIVATE_LOCOR #endif /* !C_LANG */ - #ifdef su_MEM_BAG_SELF # ifdef su_HAVE_MEM_BAG_AUTO # define su_AUTO_ALLOC su_MEM_BAG_SELF_AUTO_ALLOC @@ -420,5 +369,4 @@ # define su_LOFI_FREE_LOCOR su_MEM_BAG_SELF_LOFI_FREE_LOCOR # endif /* su_HAVE_MEM_BAG_LOFI */ #endif /* su_MEM_BAG_SELF */ - /* s-it-mode */ diff --git a/include/su/code-ou.h b/include/su/code-ou.h index fbb7dce6..f822c14e 100644 --- a/include/su/code-ou.h +++ b/include/su/code-ou.h @@ -19,9 +19,7 @@ # error su/code-ou.h is useless if su/code-in.h has not been included #endif #undef su_CODE_IN_H - /* LANG */ - #undef C_LANG #undef C_DECL_BEGIN #undef C_DECL_END @@ -29,11 +27,9 @@ #undef NSPC_END #undef NSPC_USE #undef NSPC - #if defined su_CXX_HEADER || (defined su_SOURCE && !su_C_LANG) # undef CLASS_NO_COPY # undef SELFTHIS_RET - # undef PUB # undef PRO # undef PRI @@ -42,38 +38,27 @@ # undef OVR # undef OVRX #endif - #undef S #undef R #undef C - #undef NIL - #undef SHADOW - #undef EXPORT #undef EXPORT_DATA #undef IMPORT #undef IMPORT_DATA - #undef CTA #undef LCTA #undef CTAV #undef LCTAV #undef MCTA - /* CC */ - #undef PACKED - #undef INLINE #undef SINLINE - #undef LIKELY #undef UNLIKELY - /* SUPPORT MACROS+ */ - #undef ABS #undef CLIP #undef IS_POW2 @@ -83,13 +68,11 @@ #undef ROUND_DOWN2 #undef ROUND_UP #undef ROUND_UP2 - #undef ALIGNOF #undef P_ALIGN #undef Z_ALIGN_OVER #undef Z_ALIGN #undef Z_ALIGN_PZ - #undef ASSERT_INJ #undef ASSERT_INJOR #undef ASSERT_NB @@ -107,27 +90,21 @@ #undef ASSERT_NYD_EXEC_LOC #undef ASSERT_NYD #undef ASSERT_NYD_LOC - #undef BITENUM_IS #undef BITENUM_MASK - #undef DBG #undef NDGB #undef DBGOR #undef DVL #undef NDVL #undef DVLOR - #undef FIELD_INITN #undef FIELD_INITI #undef FIELD_OFFSETOF #undef FIELD_RANGEOF #undef FIELD_SIZEOF - #undef MT - #undef NELEM - #undef NYD_OU_LABEL #undef su__NYD_IN #undef su__NYD_OU @@ -138,11 +115,8 @@ #undef NYD2_IN #undef NYD2_OU #undef NYD2 - #undef P2UZ - #undef PCMP - #ifdef mx_SOURCE # undef A_ #endif @@ -151,92 +125,68 @@ # undef N_ # undef V_ #endif - #undef SMP - #undef UCMP - #undef UNCONST #undef UNVOLATILE #undef UNALIGN - #undef UNINIT #undef UNINIT_DECL - #undef UNUSED - #undef VFIELD_SIZE #undef VSTRUCT_SIZEOF - /* POD TYPE SUPPORT (only if !C++) */ - #if defined su_HEADER ||\ ((defined su_SOURCE || defined mx_SOURCE) && su_C_LANG) # undef ul # undef ui # undef us # undef uc - # undef sl # undef si # undef ss # undef sc - # undef u8 # undef s8 - # undef u16 # undef s16 - # undef u32 # undef s32 - # undef u64 # undef s64 - # undef uz # undef sz - # undef up # undef sp - # undef FAL0 # undef TRU1 # undef TRU2 # undef TRUM1 # undef boole #endif /* su_HEADER || ((su_SOURCE || mx_SOURCE) && su_C_LANG) */ - #undef U8_MAX #undef S8_MIN #undef S8_MAX - #undef U16_MAX #undef S16_MIN #undef S16_MAX - #undef U32_MAX #undef S32_MIN #undef S32_MAX - #undef U64_MAX #undef S64_MIN #undef S64_MAX #undef U64_C #undef S64_C - #undef UZ_MAX #undef SZ_MIN #undef SZ_MAX #undef UZ_BITS - /* MEMORY */ - #undef su_ALLOCATE #undef su_ALLOCATE_LOC #undef su_REALLOCATE #undef su_REALLOCATE_LOC - #undef su_ALLOC #undef su_ALLOC_LOC #undef su_ALLOC_LOCOR @@ -276,7 +226,6 @@ #undef su_FREE #undef su_FREE_LOC #undef su_FREE_LOCOR - #if !su_C_LANG # undef su_NEW # undef su_NEW_LOC @@ -300,7 +249,6 @@ # undef su_DEL_HEAP_PRIVATE_LOC # undef su_DEL_HEAP_PRIVATE_LOCOR #endif /* !C_LANG */ - #ifdef su_MEM_BAG_SELF # ifdef su_HAVE_MEM_BAG_AUTO # undef su_AUTO_ALLOC @@ -346,10 +294,8 @@ # undef su_LOFI_FREE_LOCOR # endif /* su_HAVE_MEM_BAG_LOFI */ #endif /* su_MEM_BAG_SELF */ - #undef su_HEADER #undef su_CXX_HEADER #undef mx_HEADER #undef rf_HEADER - /* s-it-mode */ diff --git a/include/su/code.h b/include/su/code.h index 38260e7b..c7a2af35 100644 --- a/include/su/code.h +++ b/include/su/code.h @@ -26,138 +26,38 @@ */ #ifndef su_CODE_H #define su_CODE_H - #include - -/*! - * \mainpage SU --- Steffen's Utilities - * - * Afters years of finding myself too busy to port my old C++ library of which - * i am so prowd to the C language, and because of the ever increasing - * necessity to have a foundation of things i like using nonetheless, - * i finally have started creating a minimal set of tools instead. - * - * Some introductional notes: - * - * \list{\li{ - * The basic infrastructure of \SU is provided by the file \r{su/code.h}. - * Because all other \SU headers include it (thus), having it available is - * almost always implicit. - * It should be noted, however, that the \r{CORE} reacts upon a few - * preprocessor switches, as documented there. - * }\li{ - * Datatype overflow errors and out-of-memory situations are usually detected - * and result in abortions (via \r{su_LOG_EMERG} logs). - * Alternatively all or individual \r{su_state_err_type}s will not cause - * hard-failures. - * - * The actual global mode of operation can be queried via \r{su_state_get()} - * (presence checks with \r{su_state_has()}, - * is configurable via \r{su_state_set()} and \r{su_state_clear()}, and often - * the default can also be changed on a by-call or by-object basis, see - * \r{su_state_err_flags} and \r{su_clone_fun} for more on this. - * - * \remarks{C++ object creation failures via \c{su_MEM_NEW()} etc. will however - * always cause program abortion due to standard imposed execution flow. - * This can be worked around by using \c{su_MEM_NEW_HEAP()} as appropriate.} - * }\li{ - * Most collection and string object types work on 32-bit (or even 31-bit) - * lengths a.k.a. counts a.k.a. sizes. - * For simplicity of use, and because datatype overflow is a handled case, the - * user interface very often uses \r{su_uz} (i.e., \c{size_t}). - * Other behaviour is explicitly declared with a "big" prefix, as in - * "biglist", but none such object does exist at the time of this writing. - * }\li{ - * \SU requires an eight (8) or more byte alignment on the stack and heap. - * This is because some of its facilities may use the lower (up to) three - * bits of pointers for internal, implementation purposes. - * }} - */ - -/*! - * \file - * \ingroup CORE - * \brief \r{CORE} - */ - -/* CONFIG {{{ *//*! - * \defgroup CONFIG SU configuration - * \ingroup CORE - * \brief Overall \SU configuration (\r{su/code.h}) - * - * It reflects the chosen configuration and the build time environment. - * @{ - */ - +/* CONFIG {{{ */ #ifdef DOXYGEN /* Features */ - /*! Whether the \SU namespace exists. - * If not, facilities exist in the global namespace. */ # define su_HAVE_NSPC - -# define su_HAVE_DEBUG /*!< Debug variant, including assertions etc. */ - /*! Test paths available in non-debug code. - * Also, compiler pragmas which suppress some warnings are not set, etc.*/ +# define su_HAVE_DEBUG # define su_HAVE_DEVEL -# define su_HAVE_DOCSTRINGS /*!< Some more helpful strings. */ -# define su_HAVE_MEM_BAG_AUTO /*!< \_ */ -# define su_HAVE_MEM_BAG_LOFI /*!< \_ */ - /*! Normally the debug library provides memory write boundary excess via - * canaries (see \r{MEM_CACHE_ALLOC} and \r{su_MEM_ALLOC_DEBUG}). - * Since this counteracts external memory checkers like \c{valgrind(1)} or - * the ASAN (address sanitizer) compiler extensions, the \SU checkers can be - * disabled explicitly. */ +# define su_HAVE_DOCSTRINGS +# define su_HAVE_MEM_BAG_AUTO +# define su_HAVE_MEM_BAG_LOFI # define su_HAVE_MEM_CANARIES_DISABLE -# define su_HAVE_SMP /*!< \r{SMP} support available? */ - /*!< Multithreading support available? - * This is a subfeature of \r{SMP}. */ +# define su_HAVE_SMP # define su_HAVE_MT - /* Values */ -# define su_PAGE_SIZE /*!< \_ */ +# define su_PAGE_SIZE #endif - -/*! @} *//* CONFIG }}} */ - -/*! - * \defgroup CORE Basic infrastructure - * \brief Macros, POD types, and basic interfaces (\r{su/code.h}) - * - * The basic infrastructure: - * - * \list{\li{ - * Reacts upon \vr{su_HAVE_DEBUG}, \vr{su_HAVE_DEVEL}, and \vr{NDEBUG}. - * Whereas the former two are configuration-time constants which will create - * additional API and cause a different ABI, the latter will only cause - * preprocessor changes, for example for \r{su_ASSERT()}. - * }\li{ - * The latter is a precondition for \vr{su_HAVE_INLINE}. - * }\li{ - * Some macros require \vr{su_FILE} to be defined to a literal. - * }\li{ - * Define \vr{su_MASTER} to inject what is to be injected once; for example, - * it enables \c{su_M*CTA()} compile time assertions. - * }} - * @{ - */ - +/* CONFIG }}} */ /* OS {{{ */ - -#define su_OS_CYGWIN 0 /*!< \_ */ -#define su_OS_DARWIN 0 /*!< \_ */ -#define su_OS_DRAGONFLY 0 /*!< \_ */ -#define su_OS_EMX 0 /*!< \_ */ -#define su_OS_FREEBSD 0 /*!< \_ */ -#define su_OS_LINUX 0 /*!< \_ */ -#define su_OS_MINIX 0 /*!< \_ */ -#define su_OS_MSDOS 0 /*!< \_ */ -#define su_OS_NETBSD 0 /*!< \_ */ -#define su_OS_OPENBSD 0 /*!< \_ */ -#define su_OS_SOLARIS 0 /*!< \_ */ -#define su_OS_SUNOS 0 /*!< \_ */ -#define su_OS_WIN32 0 /*!< \_ */ -#define su_OS_WIN64 0 /*!< \_ */ - +#define su_OS_CYGWIN 0 +#define su_OS_DARWIN 0 +#define su_OS_DRAGONFLY 0 +#define su_OS_EMX 0 +#define su_OS_FREEBSD 0 +#define su_OS_LINUX 0 +#define su_OS_MINIX 0 +#define su_OS_MSDOS 0 +#define su_OS_NETBSD 0 +#define su_OS_OPENBSD 0 +#define su_OS_SOLARIS 0 +#define su_OS_SUNOS 0 +#define su_OS_WIN32 0 +#define su_OS_WIN64 0 #if 0 #elif defined __CYGWIN__ # undef su_OS_CYGWIN @@ -198,21 +98,17 @@ # define su_OS_SUNOS 1 # endif #endif - /* OS }}} */ /* LANG {{{ */ - #ifndef __cplusplus -# define su_C_LANG 1 /*!< \_ */ -# define su_C_DECL_BEGIN /*!< \_ */ -# define su_C_DECL_END /*!< \_ */ - +# define su_C_LANG 1 +# define su_C_DECL_BEGIN +# define su_C_DECL_END /* Casts */ -# define su_S(T,I) ((T)(I)) /*!< \_ */ -# define su_R(T,I) ((T)(I)) /*!< \_ */ -# define su_C(T,I) ((T)su_R(su_up,I)) /*!< \_ */ - -# define su_NIL ((void*)0) /*!< \_ */ +# define su_S(T,I) ((T)(I)) +# define su_R(T,I) ((T)(I)) +# define su_C(T,I) ((T)su_R(su_up,I)) +# define su_NIL ((void*)0) #else # define su_C_LANG 0 # define su_C_DECL_BEGIN extern "C" { @@ -228,13 +124,11 @@ # define su_NSPC_USE(X) /**/ # define su_NSPC(X) /**/:: # endif - /* Disable copy-construction and assignment of class */ # define su_CLASS_NO_COPY(C) private:C(C const &);C &operator=(C const &); /* If C++ class inherits from a C class, and the C class "return self", we * have to waste a return register even if self==this */ # define su_SELFTHIS_RET(X) /* return *(X); */ X; return *this - /* C++ only allows those at the declaration, not the definition */ # define su_PUB # define su_PRO @@ -248,26 +142,13 @@ # else # define su_OVRX override # endif - /* Casts */ # define su_S(T,I) static_cast(I) # define su_R(T,I) reinterpret_cast(I) # define su_C(T,I) const_cast(I) - # define su_NIL (0L) #endif /* __cplusplus */ - -/*! The \r{su_state_err()} mechanism can be configured to not cause - * abortion in case of datatype overflow and out-of-memory situations. - * Most functions return error conditions to pass them to their caller, - * but this is impossible for, e.g., C++ copy-constructors and assignment - * operators. - * And \SU does not use exceptions. - * So if those errors could occur and thus be hidden, the prototype is marked - * with this "keyword" so that callers can decide whether they want to take - * alternative routes to come to the desired result or not. */ #define su_SHADOW - /* "su_EXPORT myfun()", "class su_EXPORT myclass" */ #if su_OS_WIN32 || su_OS_WIN64 # define su_EXPORT __declspec((dllexport)) @@ -275,18 +156,17 @@ # define su_IMPORT __declspec((dllimport)) # define su_IMPORT_DATA __declspec((dllimport)) #else -# define su_EXPORT /*extern*/ /*!< \_ */ -# define su_EXPORT_DATA extern /*!< \_ */ -# define su_IMPORT /*extern*/ /*!< \_ */ -# define su_IMPORT_DATA extern /*!< \_ */ +# define su_EXPORT /*extern*/ +# define su_EXPORT_DATA extern +# define su_IMPORT /*extern*/ +# define su_IMPORT_DATA extern #endif - /* Compile-Time-Assert * Problem is that some compilers warn on unused local typedefs, so add * a special local CTA to overcome this */ #if (!su_C_LANG && __cplusplus +0 >= 201103L) || defined DOXYGEN -# define su_CTA(T,M) static_assert(T, M) /*!< \_ */ -# define su_LCTA(T,M) static_assert(T, M) /*!< \_ */ +# define su_CTA(T,M) static_assert(T, M) +# define su_LCTA(T,M) static_assert(T, M) #elif 0 /* unusable! */ && \ defined __STDC_VERSION__ && __STDC_VERSION__ +0 >= 201112L # define su_CTA(T,M) _Static_assert(T, M) @@ -294,7 +174,6 @@ #else # define su_CTA(T,M) su__CTA_1(T, su_FILE, __LINE__) # define su_LCTA(T,M) su__LCTA_1(T, su_FILE, __LINE__) - # define su__CTA_1(T,F,L) su__CTA_2(T, F, L) # define su__CTA_2(T,F,L) \ typedef char ASSERTION_failed_file_ ## F ## _line_ ## L[(T) ? 1 : -1] @@ -306,29 +185,25 @@ do{\ su_UNUSED(__i_am_unused__);\ }while(0) #endif - -#define su_CTAV(T) su_CTA(T, "Unexpected value of constant") /*!< \_ */ -#define su_LCTAV(T) su_LCTA(T, "Unexpected value of constant") /*!< \_ */ +#define su_CTAV(T) su_CTA(T, "Unexpected value of constant") +#define su_LCTAV(T) su_LCTA(T, "Unexpected value of constant") #ifdef su_MASTER # define su_MCTA(T,M) su_CTA(T, M); #else # define su_MCTA(T,M) #endif - /* LANG }}} */ /* CC {{{ */ - -#define su_CC_CLANG 0 /*!< \_ */ -#define su_CC_VCHECK_CLANG(X,Y) 0 /*!< \_ */ -#define su_CC_GCC 0 /*!< \_ */ -#define su_CC_VCHECK_GCC(X,Y) 0 /*!< \_ */ -#define su_CC_PCC 0 /*!< \_ */ -#define su_CC_VCHECK_PCC(X,Y) 0 /*!< \_ */ -#define su_CC_SUNPROC 0 /*!< \_ */ -#define su_CC_VCHECK_SUNPROC(X,Y) 0 /*!< \_ */ -#define su_CC_TINYC 0 /*!< \_ */ -#define su_CC_VCHECK_TINYC(X,Y) 0 /*!< \_ */ - +#define su_CC_CLANG 0 +#define su_CC_VCHECK_CLANG(X,Y) 0 +#define su_CC_GCC 0 +#define su_CC_VCHECK_GCC(X,Y) 0 +#define su_CC_PCC 0 +#define su_CC_VCHECK_PCC(X,Y) 0 +#define su_CC_SUNPROC 0 +#define su_CC_VCHECK_SUNPROC(X,Y) 0 +#define su_CC_TINYC 0 +#define su_CC_VCHECK_TINYC(X,Y) 0 #ifdef __clang__ # undef su_CC_CLANG # undef su_CC_VCHECK_CLANG @@ -349,7 +224,6 @@ do{\ # error Unsupported __BYTE_ORDER__ # endif # endif - /* __GNUC__ after some other Unix compilers which also define __GNUC__ */ #elif defined __PCC__ /* __clang__ */ # undef su_CC_PCC @@ -370,18 +244,15 @@ do{\ # error Unsupported __BYTE_ORDER__ # endif # endif - #elif defined __SUNPRO_C /* __PCC__ */ # undef su_CC_SUNPROC # define su_CC_SUNPROC 1 # define su_CC_PACKED TODO: PACKED attribute not supported for SunPro C - #elif defined __TINYC__ /* __SUNPRO_C */ # undef su_CC_TINYC # define su_CC_TINYC 1 # define su_CC_EXTEN /* __extension__ (ignored) */ # define su_CC_PACKED __attribute__((packed)) - #elif defined __GNUC__ /* __TINYC__ */ # undef su_CC_GCC # undef su_CC_VCHECK_GCC @@ -401,49 +272,42 @@ do{\ # error Unsupported __BYTE_ORDER__ # endif # endif - #elif !defined su_CC_IGNORE_UNKNOWN # error SU: This compiler is not yet supported. # error SU: To continue with your CFLAGS etc., define su_CC_IGNORE_UNKNOWN. # error SU: It may be necessary to define su_CC_PACKED to a statement that # error SU: enables structure packing; it may not be a #pragma, but a _Pragma #endif - #ifndef su_CC_EXTEN -# define su_CC_EXTEN /*!< \_ */ +# define su_CC_EXTEN #endif #ifndef su_CC_PACKED - /*! \_ */ # define su_CC_PACKED TODO: PACKED attribute not supported for this compiler #endif #if defined su_CC_BOM || defined DOXYGEN # ifdef DOXYGEN - /*! If the CC offers \r{su_BOM} classification macros, defined to either - * \r{su_CC_BOM_LITTLE} or \r{su_CC_BOM_BIG}, otherwise not defined. */ # define su_CC_BOM # endif -# define su_CC_BOM_LITTLE 1234 /*!< Only if there is \r{su_CC_BOM}. */ -# define su_CC_BOM_BIG 4321 /*!< Only if there is \r{su_CC_BOM}. */ +# define su_CC_BOM_LITTLE 1234 +# define su_CC_BOM_BIG 4321 #endif #if !defined su_CC_UZ_TYPE && defined __SIZE_TYPE__ # define su_CC_UZ_TYPE __SIZE_TYPE__ #endif - /* Function name */ #if defined __STDC_VERSION__ && __STDC_VERSION__ +0 >= 199901L -# define su_FUN __func__ /*!< "Not a literal". */ +# define su_FUN __func__ #elif su_CC_CLANG || su_CC_VCHECK_GCC(3, 4) || su_CC_PCC || su_CC_TINYC # define su_FUN __extension__ __FUNCTION__ #else # define su_FUN su_empty /* Something that is not a literal */ #endif - /* inline keyword */ #define su_HAVE_INLINE #if su_C_LANG # ifdef DOXYGEN -# define su_INLINE inline /*!< \_ */ -# define su_SINLINE inline /*!< \_ */ +# define su_INLINE inline +# define su_SINLINE inline # elif su_CC_CLANG || su_CC_GCC || su_CC_PCC # if defined __STDC_VERSION__ && __STDC_VERSION__ +0 >= 199901l # if !defined NDEBUG || !defined __OPTIMIZE__ @@ -475,7 +339,6 @@ do{\ #ifndef NDEBUG # undef su_HAVE_INLINE #endif - #if defined __predict_true && defined __predict_false # define su_LIKELY(X) __predict_true((X) != 0) # define su_UNLIKELY(X) __predict_false((X) != 0) @@ -483,13 +346,11 @@ do{\ # define su_LIKELY(X) __builtin_expect((X) != 0, 1) # define su_UNLIKELY(X) __builtin_expect((X) != 0, 0) #else -# define su_LIKELY(X) ((X) != 0) /*!< \_ */ -# define su_UNLIKELY(X) ((X) != 0) /*!< \_ */ +# define su_LIKELY(X) ((X) != 0) +# define su_UNLIKELY(X) ((X) != 0) #endif - /* CC }}} */ /* SUPPORT MACROS+ {{{ */ - /* USECASE_XY_DISABLED for tagging unused files: * git rm `git grep ^su_USECASE_MX_DISABLED` */ #ifdef su_USECASE_MX @@ -498,124 +359,91 @@ do{\ #ifndef su_USECASE_MX_DISABLED # define su_USECASE_MX_DISABLED #endif - /* Basic support macros, with side effects */ -/*! Absolute value. */ #define su_ABS(A) ((A) < 0 ? -(A) : (A)) -/*! Cramp \a{X} to be in between \a{A} and \a{B}, inclusive. */ #define su_CLIP(X,A,B) (((X) <= (A)) ? (A) : (((X) >= (B)) ? (B) : (X))) -/*! Is power of two? */ #define su_IS_POW2(X) ((((X) - 1) & (X)) == 0) -/*! Maximum value. */ #define su_MAX(A,B) ((A) < (B) ? (B) : (A)) -/*! Minimum value. */ #define su_MIN(A,B) ((A) < (B) ? (A) : (B)) -/*! Round down \a{X} to nearest multiple of \a{BASE}. */ #define su_ROUND_DOWN(X,BASE) (((X) / (BASE)) * (BASE)) -/*! Ditto, if \a{BASE} is a power of two. */ #define su_ROUND_DOWN2(X,BASE) ((X) & (~((BASE) - 1))) -/*! Round up \a{X} to nearest multiple of \a{BASE}. */ #define su_ROUND_UP(X,BASE) ((((X) + ((BASE) - 1)) / (BASE)) * (BASE)) -/*! Ditto, if \a{BASE} is a power of two. */ #define su_ROUND_UP2(X,BASE) (((X) + ((BASE) - 1)) & (~((BASE) - 1))) - /* Alignment. Note: su_uz POW2 asserted in POD section below! */ /* Commented out: "_Alignof() applied to an expression is a GNU extension" */ #if 0 && defined __STDC_VERSION__ && __STDC_VERSION__ +0 >= 201112L # include # define su_ALIGNOF(X) _Alignof(X) #else - /*! \c{_Alignof()} if available, something hacky otherwise */ # define su_ALIGNOF(X) su_ROUND_UP2(sizeof(X), su__ZAL_L) #endif - -/*! Align a pointer \a{MEM} by the \r{su_ALIGNOF()} of \a{OTYPE}, and cast - * the result to \a{DTYPE}. */ #define su_P_ALIGN(DTYPE,OTYPE,MEM) \ su_R(DTYPE,\ su_IS_POW2(su_ALIGNOF(OTYPE))\ ? su_ROUND_UP2(su_R(su_up,MEM), su_ALIGNOF(OTYPE))\ : su_ROUND_UP(su_R(su_up,MEM), su_ALIGNOF(OTYPE))) - /* Roundup/align an integer; Note: POW2 asserted in POD section below! */ -/*! Overalign an integer value to a size that cannot cause just any problem - * for anything which does not use special alignment directives. - * \remarks{It is safe to assume that \r{su_P_ALIGN()} can be used to place an - * object into a memory region spaced with it.} */ #define su_Z_ALIGN_OVER(X) su_ROUND_UP2(su_S(su_uz,X), 2 * su__ZAL_L) - -/*! Smaller than \r{su_Z_ALIGN_OVER()}, but sufficient for plain-old-data. */ #define su_Z_ALIGN(X) su_ROUND_UP2(su_S(su_uz,X), su__ZAL_L) - -/*! \r{su_Z_ALIGN()}, but only for pointers and \r{su_uz}. */ #define su_Z_ALIGN_PZ(X) su_ROUND_UP2(su_S(su_uz,X), su__ZAL_S) - /* (These are below MCTA()d to be of equal size[, however].) * _L must adhere to the minimum aligned claimed in the \mainpage */ # define su__ZAL_S su_MAX(sizeof(su_uz), sizeof(void*)) # define su__ZAL_L su_MAX(su__ZAL_S, sizeof(su_u64))/* XXX FP,128bit */ - /* Variants of ASSERT */ #if defined NDEBUG || defined DOXYGEN -# define su_ASSERT_INJ(X) /*!< Injection! */ -# define su_ASSERT_INJOR(X,Y) Y /*!< Injection! */ -# define su_ASSERT_NB(X) ((void)0) /*!< No block. */ -# define su_ASSERT(X) do{}while(0) /*!< \_ */ -# define su_ASSERT_LOC(X,FNAME,LNNO) do{}while(0) /*!< \_ */ -# define su_ASSERT_EXEC(X,S) do{}while(0) /*!< \_ */ -# define su_ASSERT_EXEC_LOC(X,S,FNAME,LNNO) do{}while(0) /*!< \_ */ -# define su_ASSERT_JUMP(X,L) do{}while(0) /*!< \_ */ -# define su_ASSERT_JUMP_LOC(X,L,FNAME,LNNO) do{}while(0) /*!< \_ */ -# define su_ASSERT_RET(X,Y) do{}while(0) /*!< \_ */ -# define su_ASSERT_RET_LOC(X,Y,FNAME,LNNO) do{}while(0) /*!< \_ */ -# define su_ASSERT_RET_VOID(X) do{}while(0) /*!< \_ */ -# define su_ASSERT_RET_VOID_LOC(X,Y,FNAME,LNNO) do{}while(0) /*!< \_ */ -# define su_ASSERT_NYD_EXEC(X,Y) do{}while(0) /*!< \_ */ -# define su_ASSERT_NYD_EXEC_LOC(X,FNAME,LNNO) do{}while(0) /*!< \_ */ -# define su_ASSERT_NYD(X) do{}while(0) /*!< \_ */ -# define su_ASSERT_NYD_LOC(X,FNAME,LNNO) do{}while(0) /*!< \_ */ +# define su_ASSERT_INJ(X) +# define su_ASSERT_INJOR(X,Y) Y +# define su_ASSERT_NB(X) ((void)0) +# define su_ASSERT(X) do{}while(0) +# define su_ASSERT_LOC(X,FNAME,LNNO) do{}while(0) +# define su_ASSERT_EXEC(X,S) do{}while(0) +# define su_ASSERT_EXEC_LOC(X,S,FNAME,LNNO) do{}while(0) +# define su_ASSERT_JUMP(X,L) do{}while(0) +# define su_ASSERT_JUMP_LOC(X,L,FNAME,LNNO) do{}while(0) +# define su_ASSERT_RET(X,Y) do{}while(0) +# define su_ASSERT_RET_LOC(X,Y,FNAME,LNNO) do{}while(0) +# define su_ASSERT_RET_VOID(X) do{}while(0) +# define su_ASSERT_RET_VOID_LOC(X,Y,FNAME,LNNO) do{}while(0) +# define su_ASSERT_NYD_EXEC(X,Y) do{}while(0) +# define su_ASSERT_NYD_EXEC_LOC(X,FNAME,LNNO) do{}while(0) +# define su_ASSERT_NYD(X) do{}while(0) +# define su_ASSERT_NYD_LOC(X,FNAME,LNNO) do{}while(0) #else # define su_ASSERT_INJ(X) X # define su_ASSERT_INJOR(X,Y) X - # define su_ASSERT_NB(X) \ su_R(void,((X) ? su_TRU1 \ : su_assert(su_STRING(X), __FILE__, __LINE__, su_FUN, su_TRU1), su_FAL0)) - # define su_ASSERT(X) su_ASSERT_LOC(X, __FILE__, __LINE__) # define su_ASSERT_LOC(X,FNAME,LNNO) \ do if(!(X))\ su_assert(su_STRING(X), FNAME, LNNO, su_FUN, su_TRU1);\ while(0) - # define su_ASSERT_EXEC(X,S) su_ASSERT_EXEC_LOC(X, S, __FILE__, __LINE__) # define su_ASSERT_EXEC_LOC(X,S,FNAME,LNNO) \ do if(!(X)){\ su_assert(su_STRING(X), FNAME, LNNO, su_FUN, su_FAL0);\ S;\ }while(0) - # define su_ASSERT_JUMP(X,L) su_ASSERT_JUMP_LOC(X, L, __FILE__, __LINE__) # define su_ASSERT_JUMP_LOC(X,L,FNAME,LNNO) \ do if(!(X)){\ su_assert(su_STRING(X), FNAME, LNNO, su_FUN, su_FAL0);\ goto L;\ }while(0) - # define su_ASSERT_RET(X,Y) su_ASSERT_RET_LOC(X, Y, __FILE__, __LINE__) # define su_ASSERT_RET_LOC(X,Y,FNAME,LNNO) \ do if(!(X)){\ su_assert(su_STRING(X), FNAME, LNNO, su_FUN, su_FAL0);\ return Y;\ }while(0) - # define su_ASSERT_RET_VOID(X) su_ASSERT_RET_VOID_LOC(X, __FILE__, __LINE__) # define su_ASSERT_RET_VOID_LOC(X,FNAME,LNNO) \ do if(!(X)){\ su_assert(su_STRING(X), FNAME, LNNO, su_FUN, su_FAL0);\ return;\ }while(0) - # define su_ASSERT_NYD_EXEC(X,Y) \ su_ASSERT_NYD_EXEC_LOC(X, Y, __FILE__, __LINE__) # define su_ASSERT_NYD_EXEC_LOC(X,Y,FNAME,LNNO) \ @@ -623,7 +451,6 @@ do if(!(X)){\ su_assert(su_STRING(X), FNAME, LNNO, su_FUN, su_FAL0);\ Y; goto su_NYD_OU_LABEL;\ }while(0) - # define su_ASSERT_NYD(X) su_ASSERT_NYD_LOC(X, __FILE__, __LINE__) # define su_ASSERT_NYD_LOC(X,FNAME,LNNO) \ do if(!(X)){\ @@ -631,40 +458,24 @@ do if(!(X)){\ goto su_NYD_OU_LABEL;\ }while(0) #endif /* defined NDEBUG || defined DOXYGEN */ - -/*! There are no bit-\c{enum}erations, but we use \c{enum}s as such, since the - * only other option for bit constants would be preprocessor macros. - * Since enumerations are expected to represent a single value, a normal - * integer is often used to store enumeration values. - * To be explicit, this macro is used instead, \a{X} is the pod, \a{Y} is the - * enumeration name that is actually meant. */ #define su_BITENUM_IS(X,Y) X - -/*! Create a bit mask for the inclusive bit range \a{LO} to \a{HI}. - * \remarks{\a{HI} cannot use highest bit!} - * \remarks{Identical to \r{su_BITS_RANGE_MASK().} */ #define su_BITENUM_MASK(LO,HI) (((1u << ((HI) + 1)) - 1) & ~((1u << (LO)) - 1)) - -/*! For injection macros like su_DBG(), NDBG, DBGOR, 64, 32, 6432 */ #define su_COMMA , - /* Debug injections */ #if defined su_HAVE_DEBUG && !defined NDEBUG -# define su_DBG(X) X /*!< \_ */ -# define su_NDBG(X) /*!< \_ */ -# define su_DBGOR(X,Y) X /*!< \_ */ +# define su_DBG(X) X +# define su_NDBG(X) +# define su_DBGOR(X,Y) X #else # define su_DBG(X) # define su_NDBG(X) X # define su_DBGOR(X,Y) Y #endif - /* Debug file location arguments. (For an usage example see su/mem.h.) */ #if defined su_HAVE_DEVEL || defined su_HAVE_DEBUG # define su_HAVE_DBG_LOC_ARGS # define su_DBG_LOC_ARGS_FILE su__dbg_loc_args_file # define su_DBG_LOC_ARGS_LINE su__dbg_loc_args_line - # define su_DBG_LOC_ARGS_DECL_SOLE \ char const *su_DBG_LOC_ARGS_FILE, su_u32 su_DBG_LOC_ARGS_LINE # define su_DBG_LOC_ARGS_DECL , su_DBG_LOC_ARGS_DECL_SOLE @@ -691,127 +502,90 @@ do{\ # define su_DBG_LOC_ARGS_ORUSE su_DBG_LOC_ARGS_FILE, su_DBG_LOC_ARGS_LINE # define su_DBG_LOC_ARGS_UNUSED() do{}while(0) #endif /* su_HAVE_DEVEL || su_HAVE_DEBUG */ - /* Development injections */ #if defined su_HAVE_DEVEL || defined su_HAVE_DEBUG /* Not: !defined NDEBUG) */\ || defined DOXYGEN -# define su_DVL(X) X /*!< \_ */ -# define su_NDVL(X) /*!< \_ */ -# define su_DVLOR(X,Y) X /*!< \_ */ +# define su_DVL(X) X +# define su_NDVL(X) +# define su_DVLOR(X,Y) X #else # define su_DVL(X) # define su_NDVL(X) X # define su_DVLOR(X,Y) Y #endif - -/*! To avoid files that are overall empty */ #define su_EMPTY_FILE() typedef int su_CONCAT(su_notempty_shall_b_, su_FILE); - /* C field init */ #if (su_C_LANG && defined __STDC_VERSION__ && \ __STDC_VERSION__ +0 >= 199901L) || defined DOXYGEN -# define su_FIELD_INITN(N) .N = /*!< \_ */ -# define su_FIELD_INITI(I) [I] = /*!< \_ */ +# define su_FIELD_INITN(N) .N = +# define su_FIELD_INITI(I) [I] = #else # define su_FIELD_INITN(N) # define su_FIELD_INITI(I) #endif - /* XXX offsetof+: clang,pcc check faked! */ #if su_CC_VCHECK_CLANG(5, 0) || su_CC_VCHECK_GCC(4, 1) ||\ su_CC_VCHECK_PCC(1, 2) || defined DOXYGEN - /*! The offset of field \a{F} in the type \a{T}. */ # define su_FIELD_OFFSETOF(T,F) __builtin_offsetof(T, F) #else # define su_FIELD_OFFSETOF(T,F) \ su_S(su_uz,su_S(su_up,&(su_R(T *,0x1)->F)) - 1) #endif - -/*! Distance in between the fields \a{S}tart and \a{E}end in type \a{T}. */ #define su_FIELD_RANGEOF(T,S,E) \ (su_FIELD_OFFSETOF(T, E) - su_FIELD_OFFSETOF(T, S)) - -/*! sizeof() for member fields */ #define su_FIELD_SIZEOF(T,F) sizeof(su_S(T *,su_NIL)->F) - /* Multithread injections */ #ifdef su_HAVE_MT -# define su_MT(X) X /*!< \_ */ +# define su_MT(X) X #else # define su_MT(X) #endif - -/*! Members in constant array */ #define su_NELEM(A) (sizeof(A) / sizeof((A)[0])) - -/*! NYD comes from code-{in,ou}.h (support function below). - * Instrumented functions will always have one label for goto: purposes. */ #define su_NYD_OU_LABEL su__nydou - -/*! Pointer to size_t */ #define su_P2UZ(X) su_S(su_uz,(su_up)(X)) - -/*! Pointer comparison */ #define su_PCMP(A,C,B) (su_R(su_up,A) C su_R(su_up,B)) - /* SMP injections */ #ifdef su_HAVE_SMP -# define su_SMP(X) X /*!< \_ */ +# define su_SMP(X) X #else # define su_SMP(X) #endif - /* String stuff. * __STDC_VERSION__ is ISO C99, so also use __STDC__, which should work */ #if defined __STDC__ || defined __STDC_VERSION__ || su_C_LANG || \ defined DOXYGEN -# define su_STRING(X) #X /*!< \_ */ -# define su_XSTRING(X) su_STRING(X) /*!< \_ */ -# define su_CONCAT(S1,S2) su__CONCAT_1(S1, S2) /*!< \_ */ +# define su_STRING(X) #X +# define su_XSTRING(X) su_STRING(X) +# define su_CONCAT(S1,S2) su__CONCAT_1(S1, S2) # define su__CONCAT_1(S1,S2) S1 ## S2 #else # define su_STRING(X) "X" # define su_XSTRING STRING # define su_CONCAT(S1,S2) S1/* will no work out though */S2 #endif - #if su_C_LANG || defined DOXYGEN - /*! Compare (maybe mixed-signed) integers cases to \a{T} bits, unsigned, - * \a{T} is one of our homebrew integers, e.g., - * \c{UCMP(32, su_ABS(n), >, wleft)}. - * \remarks{Does not sign-extend correctly, this is up to the caller.} */ # define su_UCMP(T,A,C,B) (su_S(su_ ## u ## T,A) C su_S(su_ ## u ## T,B)) #else # define su_UCMP(T,A,C,B) \ (su_S(su_NSPC(su) u ## T,A) C su_S(su_NSPC(su) u ## T,B)) #endif - -/*! Casts-away (*NOT* cast-away) */ #define su_UNCONST(T,P) su_R(T,su_R(su_up,su_S(void const*,P))) -/*! Casts-away (*NOT* cast-away) */ #define su_UNVOLATILE(T,P) su_R(T,su_R(su_up,su_S(void volatile*,P))) -/*! To avoid warnings with modern compilers for "char*i; *(s32_t*)i=;" */ #define su_UNALIGN(T,P) su_R(T,su_R(su_up,P)) #define su_UNXXX(T,C,P) su_R(T,su_R(su_up,su_S(C,P))) - /* Avoid "may be used uninitialized" warnings */ #if (defined NDEBUG && !(defined su_HAVE_DEBUG || defined su_HAVE_DEVEL)) || \ defined DOYGEN -# define su_UNINIT(N,V) su_S(void,0) /*!< \_ */ -# define su_UNINIT_DECL(V) /*!< \_ */ +# define su_UNINIT(N,V) su_S(void,0) +# define su_UNINIT_DECL(V) #else # define su_UNINIT(N,V) N = V # define su_UNINIT_DECL(V) = V #endif - -/*! Avoid "unused" warnings */ #define su_UNUSED(X) ((void)(X)) - #if (su_C_LANG && defined __STDC_VERSION__ && \ __STDC_VERSION__ +0 >= 199901L) || defined DOXYGEN - /*! Variable-type size (with byte array at end) */ # define su_VFIELD_SIZE(X) - /*! Variable-type size (with byte array at end) */ # define su_VSTRUCT_SIZEOF(T,F) sizeof(T) #else # define su_VFIELD_SIZE(X) \ @@ -819,41 +593,33 @@ do{\ : (su_S(su_sz,X) < 0 ? sizeof(su_uz) - su_ABS(X) : su_S(su_uz,X))) # define su_VSTRUCT_SIZEOF(T,F) (sizeof(T) - su_FIELD_SIZEOF(T, F)) #endif - /* SUPPORT MACROS+ }}} */ - /* We are ready to start using our own style */ #ifndef su_CC_SIZE_TYPE # include /* TODO create config time script, */ #endif - #include /* TODO query infos and drop */ #include /* TODO those includes! */ - #define su_HEADER #include C_DECL_BEGIN - /* POD TYPE SUPPORT TODO maybe configure-time, from a su/config.h?! {{{ */ /* TODO Note: the PRI* series will go away once we have FormatCtx! */ - /* First some shorter aliases for "normal" integers */ -typedef unsigned long su_ul; /*!< \_ */ -typedef unsigned int su_ui; /*!< \_ */ -typedef unsigned short su_us; /*!< \_ */ -typedef unsigned char su_uc; /*!< \_ */ - -typedef signed long su_sl; /*!< \_ */ -typedef signed int su_si; /*!< \_ */ -typedef signed short su_ss; /*!< \_ */ -typedef signed char su_sc; /*!< \_ */ - +typedef unsigned long su_ul; +typedef unsigned int su_ui; +typedef unsigned short su_us; +typedef unsigned char su_uc; +typedef signed long su_sl; +typedef signed int su_si; +typedef signed short su_ss; +typedef signed char su_sc; #if defined UINT8_MAX || defined DOXYGEN -# define su_U8_MAX UINT8_MAX /*!< \_ */ -# define su_S8_MIN INT8_MIN /*!< \_ */ -# define su_S8_MAX INT8_MAX /*!< \_ */ -typedef uint8_t su_u8; /*!< \_ */ -typedef int8_t su_s8; /*!< \_ */ +# define su_U8_MAX UINT8_MAX +# define su_S8_MIN INT8_MIN +# define su_S8_MAX INT8_MAX +typedef uint8_t su_u8; +typedef int8_t su_s8; #elif UCHAR_MAX != 255 # error UCHAR_MAX must be 255 #else @@ -863,20 +629,18 @@ typedef int8_t su_s8; /*!< \_ */ typedef unsigned char su_u8; typedef signed char su_s8; #endif - #if !defined PRIu8 || !defined PRId8 # undef PRIu8 # undef PRId8 # define PRIu8 "hhu" # define PRId8 "hhd" #endif - #if defined UINT16_MAX || defined DOXYGEN -# define su_U16_MAX UINT16_MAX /*!< \_ */ -# define su_S16_MIN INT16_MIN /*!< \_ */ -# define su_S16_MAX INT16_MAX /*!< \_ */ -typedef uint16_t su_u16; /*!< \_ */ -typedef int16_t su_s16; /*!< \_ */ +# define su_U16_MAX UINT16_MAX +# define su_S16_MIN INT16_MIN +# define su_S16_MAX INT16_MAX +typedef uint16_t su_u16; +typedef int16_t su_s16; #elif USHRT_MAX != 0xFFFFu # error USHRT_MAX must be 0xFFFF #else @@ -886,7 +650,6 @@ typedef int16_t su_s16; /*!< \_ */ typedef unsigned short su_u16; typedef signed short su_s16; #endif - #if !defined PRIu16 || !defined PRId16 # undef PRIu16 # undef PRId16 @@ -898,13 +661,12 @@ typedef signed short su_s16; # define PRId16 "hd" # endif #endif - #if defined UINT32_MAX || defined DOXYGEN -# define su_U32_MAX UINT32_MAX /*!< \_ */ -# define su_S32_MIN INT32_MIN /*!< \_ */ -# define su_S32_MAX INT32_MAX /*!< \_ */ -typedef uint32_t su_u32; /*!< \_ */ -typedef int32_t su_s32; /*!< \_ */ +# define su_U32_MAX UINT32_MAX +# define su_S32_MIN INT32_MIN +# define su_S32_MAX INT32_MAX +typedef uint32_t su_u32; +typedef int32_t su_s32; #elif ULONG_MAX == 0xFFFFFFFFu # define su_U32_MAX ULONG_MAX # define su_S32_MIN LONG_MIN @@ -920,7 +682,6 @@ typedef signed long int su_s32; typedef unsigned int su_u32; typedef signed int su_s32; #endif - #if !defined PRIu32 || !defined PRId32 # undef PRIu32 # undef PRId32 @@ -932,15 +693,14 @@ typedef signed int su_s32; # define PRId32 "d" # endif #endif - #if defined UINT64_MAX || defined DOXYGEN -# define su_U64_MAX UINT64_MAX /*!< \_ */ -# define su_S64_MIN INT64_MIN /*!< \_ */ -# define su_S64_MAX INT64_MAX /*!< \_ */ -# define su_S64_C(C) INT64_C(C) /*!< \_ */ -# define su_U64_C(C) UINT64_C(C) /*!< \_ */ -typedef uint64_t su_u64; /*!< \_ */ -typedef int64_t su_s64; /*!< \_ */ +# define su_U64_MAX UINT64_MAX +# define su_S64_MIN INT64_MIN +# define su_S64_MAX INT64_MAX +# define su_S64_C(C) INT64_C(C) +# define su_U64_C(C) UINT64_C(C) +typedef uint64_t su_u64; +typedef int64_t su_s64; #elif ULONG_MAX <= 0xFFFFFFFFu # if !defined ULLONG_MAX # error We need a 64 bit integer @@ -962,7 +722,6 @@ su_CC_EXTEN typedef signed long long su_s64; typedef unsigned long su_u64; typedef signed long su_s64; #endif - #if !defined PRIu64 || !defined PRId64 || !defined PRIX64 || !defined PRIo64 # undef PRIu64 # undef PRId64 @@ -980,21 +739,19 @@ typedef signed long su_s64; # define PRIo64 "lo" # endif #endif - /* (So that we can use UCMP() for size_t comparison, too) */ #ifdef su_CC_SIZE_TYPE typedef su_CC_SIZE_TYPE su_uz; #else -typedef size_t su_uz; /*!< \_ */ +typedef size_t su_uz; #endif - #undef PRIuZ #undef PRIdZ #if (defined __STDC_VERSION__ && __STDC_VERSION__ +0 >= 199901L) ||\ defined DOXYGEN # define PRIuZ "zu" # define PRIdZ "zd" -# define su_UZ_MAX SIZE_MAX /*!< \_ */ +# define su_UZ_MAX SIZE_MAX #elif defined SIZE_MAX /* UnixWare has size_t as unsigned as required but uses a signed limit * constant (which is thus false!) */ @@ -1021,13 +778,13 @@ MCTA(sizeof(size_t) == sizeof(unsigned long), #endif /* The signed equivalence is not really compliant to the standard */ #if su_UZ_MAX == su_U32_MAX || su_UZ_MAX == su_S32_MAX || defined DOXYGEN -# define su_SZ_MIN su_S32_MIN /*!< \_ */ -# define su_SZ_MAX su_S32_MAX /*!< \_ */ -# define su_UZ_BITS 32u /*!< \_ */ -# define su_64(X) /*!< \_ */ -# define su_32(X) X /*!< \_ */ -# define su_6432(X,Y) Y /*!< \_ */ -typedef su_s32 su_sz; /*!< \_ */ +# define su_SZ_MIN su_S32_MIN +# define su_SZ_MAX su_S32_MAX +# define su_UZ_BITS 32u +# define su_64(X) +# define su_32(X) X +# define su_6432(X,Y) Y +typedef su_s32 su_sz; #elif su_UZ_MAX == su_U64_MAX # define su_SZ_MIN su_S64_MIN # define su_SZ_MAX su_S64_MAX @@ -1039,14 +796,12 @@ typedef su_s64 su_sz; #else # error I cannot handle this maximum value of size_t #endif - MCTA(sizeof(su_uz) == sizeof(void*), "SU cannot handle sizeof(su_uz) != sizeof(void*)") - /* Regardless of P2UZ provide this one; only use it rarely */ #if defined UINTPTR_MAX || defined DOXYGEN -typedef uintptr_t su_up; /*!< \_ */ -typedef intptr_t su_sp; /*!< \_ */ +typedef uintptr_t su_up; +typedef intptr_t su_sp; #else # ifdef SIZE_MAX typedef su_uz su_up; @@ -1056,81 +811,32 @@ typedef su_ul su_up; typedef su_sl su_sp; # endif #endif - -/*! Values for #su_boole (normally only \c{FAL0} and \c{TRU1}). */ enum{ - su_FAL0, /*!< 0 (no bits set). */ - su_TRU1, /*!< The value 1. */ - su_TRU2, /*!< The value 2. */ - su_TRUM1 = -1 /*!< All bits set. */ + su_FAL0, + su_TRU1, + su_TRU2, + su_TRUM1 = -1 }; -typedef su_s8 su_boole; /*!< The \SU boolean type (see \FAL0 etc.). */ - +typedef su_s8 su_boole; /* POD TYPE SUPPORT }}} */ /* BASIC TYPE TRAITS {{{ */ - struct su_toolbox; /* plus PTF typedefs */ - -/*! Create a new default instance of an object type, return it or \NIL. - * See \r{su_clone_fun} for the meaning of \a{estate}. */ typedef void *(*su_new_fun)(u32 estate); - -/*! Create a clone of \a{t}, and return it. - * \a{estate} might be set to some \r{su_state_err_type}s to be turned to - * non-fatal errors, and contain \r{su_state_err_flags} with additional - * control requests. - * Otherwise (\a{estate} is 0) \NIL can still be returned for - * \r{su_STATE_ERR_NOMEM} or \r{su_STATE_ERR_OVERFLOW}, dependent on the - * global \r{su_state_get()} / \r{su_state_has()} setting, - * as well as for other errors and with other \r{su_err_number}s, of course. - * Also see \r{su_STATE_ERR_NIL_IS_VALID_OBJECT}. */ typedef void *(*su_clone_fun)(void const *t, u32 estate); - -/*! Delete an instance returned by \r{su_new_fun} or \r{su_clone_fun} (or - * \r{su_assign_fun}). */ typedef void (*su_delete_fun)(void *self); - -/*! Assign \a{t}; see \r{su_clone_fun} for the meaning of \a{estate}. - * In-place update of \SELF is (and should) not (be) assumed, but instead the - * return value has to be used, with the exception as follows. - * First all resources of \a{self} should be released (an operation which is - * not supposed to fail), then the assignment be performed. - * If this fails, \a{self} should be turned to cleared state again, - * and \NIL should be returned. - * - * \remarks{This function is not used by (object owning) \r{COLL} unless - * \r{su_STATE_ERR_NIL_IS_VALID_OBJECT} is set. Regardless, if \NIL is - * returned to indicate error then the caller which passed a non-\NIL object - * is responsible for deletion or taking other appropriate steps.} - * - * \remarks{If \a{self} and \a{t} are \r{COLL}, then if assignment fails then - * whereas \a{self} will not manage any elements, it has been assigned \a{t}'s - * possible existent \r{su_toolbox} as well as other attributes. - * Some \r{COLL} will provide an additional \c{assign_elems()} function.} */ typedef void *(*su_assign_fun)(void *self, void const *t, u32 estate); - -/*! Compare \a{a} and \a{b}, and return a value less than 0 if \a{a} is "less - * than \a{b}", 0 on equality, and a value greater than 0 if \a{a} is - * "greate than \a{b}". */ typedef su_sz (*su_compare_fun)(void const *a, void const *b); - -/*! Create a hash that reproducibly represents \SELF. */ typedef su_uz (*su_hash_fun)(void const *self); - /* Needs to be binary compatible with \c{su::{toolbox,type_toolbox}}! */ -/*! A toolbox provides object handling knowledge to \r{COLL}. - * Also see \r{su_TOOLBOX_I9R()}. */ struct su_toolbox{ - su_clone_fun tb_clone; /*!< \copydoc{su_clone_fun}. */ - su_delete_fun tb_delete; /*!< \copydoc{su_delete_fun}. */ - su_assign_fun tb_assign; /*!< \copydoc{su_assign_fun}. */ - su_compare_fun tb_compare; /*!< \copydoc{su_compare_fun}. */ - su_hash_fun tb_hash; /*!< \copydoc{su_hash_fun}. */ + su_clone_fun tb_clone; + su_delete_fun tb_delete; + su_assign_fun tb_assign; + su_compare_fun tb_compare; + su_hash_fun tb_hash; }; - /* Use C-style casts, not and ever su_R()! */ -/*! Initialize a \r{su_toolbox}. */ #define su_TOOLBOX_I9R(CLONE,DELETE,ASSIGN,COMPARE,HASH) \ {\ su_FIELD_INITN(tb_clone) (su_clone_fun)(CLONE),\ @@ -1139,27 +845,19 @@ struct su_toolbox{ su_FIELD_INITN(tb_compare) (su_compare_fun)(COMPARE),\ su_FIELD_INITN(tb_hash) (su_hash_fun)(HASH)\ } - /* BASIC TYPE TRAITS }}} */ /* BASIC C INTERFACE (SYMBOLS) {{{ */ - -/*! Byte order mark macro; there are also \r{su_bom}, \r{su_BOM_IS_BIG()} and - * \r{su_BOM_IS_LITTLE()}. */ #define su_BOM 0xFEFFu - /* su_state.. machinery: first byte: global log instance.. */ - -/*! Log priorities, for simplicity of use without _LEVEL or _LVL prefix, - * for \r{su_log_set_level()}. */ enum su_log_level{ - su_LOG_EMERG, /*!< System is unusable (abort()s the program) */ - su_LOG_ALERT, /*!< Action must be taken immediately */ - su_LOG_CRIT, /*!< Critical conditions */ - su_LOG_ERR, /*!< Error conditions */ - su_LOG_WARN, /*!< Warning conditions */ - su_LOG_NOTICE, /*!< Normal but significant condition */ - su_LOG_INFO, /*!< Informational */ - su_LOG_DEBUG /*!< Debug-level message */ + su_LOG_EMERG, + su_LOG_ALERT, + su_LOG_CRIT, + su_LOG_ERR, + su_LOG_WARN, + su_LOG_NOTICE, + su_LOG_INFO, + su_LOG_DEBUG }; enum{ su__LOG_MAX = su_LOG_DEBUG, @@ -1167,106 +865,36 @@ enum{ su__LOG_MASK = (1u << su__LOG_SHIFT) - 1 }; MCTA(1u< su__LOG_MAX, "Bit ranges may not overlap") - -/*! Flags that can be ORd to \r{su_log_level}. */ enum su_log_flags{ - /*! In environments where \r{su_log_write()} is (also) hooked to an output - * channel, do not log the message through that. */ su_LOG_F_CORE = 1u<<(su__LOG_SHIFT+0) }; - -/*! Adjustment possibilities for the global log domain (e.g, - * \r{su_log_write()}), to be set via \r{su_state_set()}, to be queried via - * \r{su_state_has()}. */ enum su_state_log_flags{ - /*! Prepend a messages \r{su_log_level}. */ su_STATE_LOG_SHOW_LEVEL = 1u<<4, - /*! Show the PID (Process IDentification number). - * This flag is only honoured if \r{su_program} set to non-\NIL. */ su_STATE_LOG_SHOW_PID = 1u<<5 }; - /* ..second byte: hardening errors.. */ - -/*! Global hardening for out-of-memory and integer etc. overflow: types. - * By default out-of-memory situations, or container and string etc. - * insertions etc. which cause count/offset datatype overflow result in - * \r{su_LOG_EMERG}s, and thus program abortion. - * - * This global default can be changed by including the corresponding - * \c{su_state_err_type} (\r{su_STATE_ERR_NOMEM} and - * \r{su_STATE_ERR_OVERFLOW}, respectively), in the global \SU state machine - * via \r{su_state_set()}, in which case logging uses \r{su_LOG_ALERT} level, - * a corresponding \r{su_err_number} will be assigned for \r{su_err_no()}, and - * the failed function will return error. - * - * Often functions and object allow additional control over the global on - * a by-call or by-object basis, taking a state argument which consists of - * \c{su_state_err_type} and \r{su_state_err_flags} bits. - * In order to support this these values do not form an enumeration, but - * rather are combinable bits. */ enum su_state_err_type{ - su_STATE_ERR_NOMEM = 1u<<8, /*!< Out-of-memory. */ - su_STATE_ERR_OVERFLOW = 1u<<9 /*!< Integer/xy domain overflow. */ + su_STATE_ERR_NOMEM = 1u<<8, + su_STATE_ERR_OVERFLOW = 1u<<9 }; - -/*! Hardening for out-of-memory and integer etc. overflow: adjustment flags. - * Many functions offer the possibility to adjust the global \r{su_state_get()} - * (\r{su_state_has()}) \r{su_state_err_type} default on a per-call level, and - * object types (can) do so on a per-object basis. - * - * If so, the global state can (selectively) be bypassed by adding in - * \r{su_state_err_type}s to be ignored to an (optional) function argument, - * or object control function or field. - * It is also possible to instead enforce program abortion regardless of - * a global ignorance policy, and pass other control flags. */ enum su_state_err_flags{ - /*! A mask containing all \r{su_state_err_type} bits. */ su_STATE_ERR_TYPE_MASK = su_STATE_ERR_NOMEM | su_STATE_ERR_OVERFLOW, - /*! Allow passing of all errors. - * This is just a better name alias for \r{su_STATE_ERR_TYPE_MASK}. */ su_STATE_ERR_PASS = su_STATE_ERR_TYPE_MASK, - /*! Regardless of global (and additional local) policy, if this flag is - * set, an actual error causes a hard program abortion. */ su_STATE_ERR_NOPASS = 1u<<12, - /*! If this flag is set and no abortion is about to happen, a corresponding - * \r{su_err_number} will not be assigned to \r{su_err_no()}. */ su_STATE_ERR_NOERRNO = 1u<<13, - /*! This is special in that it plays no role in the global state machine. - * However, many types or functions which provide \a{estate} arguments and - * use (NOT) \r{su_STATE_ERR_MASK} to overload that with meaning, adding - * support for owning \r{COLL} (for \r{su_toolbox} users, to be exact) - * actually made sense: if this bit is set it indicates that \NIL values - * returned by \r{su_toolbox} members are acceptible values (and thus do not - * cause actions like insertion, replacement etc. to fail). */ su_STATE_ERR_NIL_IS_VALID_OBJECT = 1u<<14, - /*! Alias for \r{su_STATE_ERR_NIL_IS_VALID_OBJECT}. */ su_STATE_ERR_NILISVALO = su_STATE_ERR_NIL_IS_VALID_OBJECT, - /*! Handy mask for the entire family of error \SU error bits, - * \r{su_state_err_type} and \r{su_state_err_flags}. - * It can be used by functions or methods which allow fine-tuning of error - * behaviour to strip down an user argument. - * - * \remarks{This mask itself is covered by the mask \c{0xFF00}. - * This condition is compile-time asserted.} */ su_STATE_ERR_MASK = su_STATE_ERR_TYPE_MASK | su_STATE_ERR_PASS | su_STATE_ERR_NOPASS | su_STATE_ERR_NOERRNO | su_STATE_ERR_NIL_IS_VALID_OBJECT }; - /* ..third byte: misc flags */ - -/*! \_ */ enum su_state_flags{ - su_STATE_NONE, /*!< No flag: this is 0. */ - su_STATE_DEBUG = 1u<<16, /*!< \_ */ - su_STATE_VERBOSE = 1u<<17, /*!< \_ */ - /*! Reproducible behaviour switch. - * See \r{su_reproducible_build}, - * and \xln{https://reproducible-builds.org}. */ + su_STATE_NONE, + su_STATE_DEBUG = 1u<<16, + su_STATE_VERBOSE = 1u<<17, su_STATE_REPRODUCIBLE = 1u<<18 }; - enum su__state_flags{ /* enum su_log_level is first "member" */ su__STATE_LOG_MASK = 0x0Fu, @@ -1278,7 +906,6 @@ enum su__state_flags{ MCTA(S(uz,su_LOG_DEBUG) <= S(uz,su__STATE_LOG_MASK), "Bit ranges may not overlap") MCTA((S(uz,su_STATE_ERR_MASK) & ~0xFF00) == 0, "Bits excess documented bounds") - #ifdef su_HAVE_MT enum su__glock_type{ su__GLOCK_STATE, @@ -1286,134 +913,70 @@ enum su__glock_type{ su__GLOCK_MAX = su__GLOCK_LOG }; #endif - -/*! The \SU error number constants. - * In order to achieve a 1:1 mapping of the \SU and the host value, e.g., - * of \ERR{INTR} and \c{EINTR}, the actual values will be detected at - * compilation time. - * Non resolvable (native) mappings will map to \ERR{NOTOBACCO}, - * \SU mappings with no (native) mapping will have high unsigned numbers. */ enum su_err_number{ #ifdef DOXYGEN - su_ERR_NONE, /*!< No error. */ - su_ERR_NOTOBACCO /*!< No such errno, fallback: no mapping exists. */ + su_ERR_NONE, + su_ERR_NOTOBACCO #else su__ERR_NUMBER_ENUM_C # undef su__ERR_NUMBER_ENUM_C #endif }; - union su__bom_union{ char bu_buf[2]; u16 bu_val; }; - /* Known endianness bom versions, see su_bom_little, su_bom_big */ EXPORT_DATA union su__bom_union const su__bom_little; EXPORT_DATA union su__bom_union const su__bom_big; - /* (Not yet) Internal enum su_state_* bit carrier */ EXPORT_DATA uz su__state; - -/*! The byte order mark \r{su_BOM} in host, \r{su_bom_little} and - * \r{su_bom_big} byte order. - * The latter two are macros which access constant union data. - * We also define two helpers \r{su_BOM_IS_BIG()} and \r{su_BOM_IS_LITTLE()}, - * which will expand to preprocessor statements if possible (by using - * \r{su_CC_BOM}, \r{su_CC_BOM_LITTLE} and \r{su_CC_BOM_BIG}), but otherwise - * to comparisons of the external constants. */ EXPORT_DATA u16 const su_bom; - -#define su_bom_little su__bom_little.bu_val /*!< \_ */ -#define su_bom_big su__bom_big.bu_val /*!< \_ */ - +#define su_bom_little su__bom_little.bu_val +#define su_bom_big su__bom_big.bu_val #if defined su_CC_BOM || defined DOXYGEN -# define su_BOM_IS_BIG() (su_CC_BOM == su_CC_BOM_BIG) /*!< \r{su_bom}. */ -# define su_BOM_IS_LITTLE() (su_CC_BOM == su_CC_BOM_LITTLE) /*!< \r{su_bom}. */ +# define su_BOM_IS_BIG() (su_CC_BOM == su_CC_BOM_BIG) +# define su_BOM_IS_LITTLE() (su_CC_BOM == su_CC_BOM_LITTLE) #else # define su_BOM_IS_BIG() (su_bom == su_bom_big) # define su_BOM_IS_LITTLE() (su_bom == su_bom_little) #endif - -/*! The empty string. */ EXPORT_DATA char const su_empty[1]; - -/*! The string \c{reproducible_build}, see \r{su_STATE_REPRODUCIBLE}. */ EXPORT_DATA char const su_reproducible_build[]; - -/*! Can be set to the name of the program to, e.g., create a common log - * message prefix. - * Also see \r{su_STATE_LOG_SHOW_PID}, \r{su_STATE_LOG_SHOW_LEVEL}. */ EXPORT_DATA char const *su_program; - /**/ #ifdef su_HAVE_MT EXPORT void su__glock(enum su__glock_type gt); EXPORT void su__gunlock(enum su__glock_type gt); #endif - -/*! Interaction with the SU library (global) state machine. - * This covers \r{su_state_log_flags}, \r{su_state_err_type}, - * and \r{su_state_flags} flags and values. */ INLINE u32 su_state_get(void){ return (su__state & su__STATE_GLOBAL_MASK); } - -/*! Interaction with the SU library (global) state machine: - * test whether all (not any) of \a{flags} are set in \r{su_state_get()}. */ INLINE boole su_state_has(uz flags){ flags &= su__STATE_GLOBAL_MASK; return ((su__state & flags) == flags); } - -/*! \_ */ INLINE void su_state_set(uz flags){ MT( su__glock(su__GLOCK_STATE); ) su__state |= flags & su__STATE_GLOBAL_MASK; MT( su__gunlock(su__GLOCK_STATE); ) } - -/*! \_ */ INLINE void su_state_clear(uz flags){ MT( su__glock(su__GLOCK_STATE); ) su__state &= ~(flags & su__STATE_GLOBAL_MASK); MT( su__gunlock(su__GLOCK_STATE); ) } - -/*! Notify an error to the \SU (global) state machine. - * If the function is allowd to return a corresponding \r{su_err_number} will - * be returned. */ EXPORT s32 su_state_err(enum su_state_err_type err, uz state, char const *msg_or_nil); - -/*! \_ */ EXPORT s32 su_err_no(void); - -/*! \_ */ EXPORT s32 su_err_set_no(s32 eno); - -/*! Return string(s) describing C error number \a{eno}. - * Effectively identical to \r{su_err_name()} if either the compile-time - * option \r{su_HAVE_DOCSTRINGS} is missing (always), or when - * \r{su_state_has()} \r{su_STATE_REPRODUCIBLE} set. */ EXPORT char const *su_err_doc(s32 eno); - -/*! \_ */ EXPORT char const *su_err_name(s32 eno); - -/*! Try to map an error name to an error number. - * Returns the fallback error as a negative value if none found */ EXPORT s32 su_err_from_name(char const *name); - -/*! \_ */ EXPORT s32 su_err_no_via_errno(void); - -/*! \_ */ INLINE enum su_log_level su_log_get_level(void){ return S(enum su_log_level,su__state & su__STATE_LOG_MASK); } - -/*! \_ */ INLINE void su_log_set_level(enum su_log_level nlvl){ uz lvl; /*MT( su__glock(su__GLOCK_STATE); )*/ @@ -1421,638 +984,38 @@ INLINE void su_log_set_level(enum su_log_level nlvl){ su__state = (su__state & su__STATE_GLOBAL_MASK) | lvl; /*MT( su__gunlock(su__GLOCK_STATE); )*/ } - -/*! \_ */ INLINE boole su_log_would_write(enum su_log_level lvl){ return ((S(u32,lvl) & su__LOG_MASK) <= (su__state & su__STATE_LOG_MASK) || (su__state & su__STATE_D_V)); } - -/*! Log functions of various sort. - * \a{lvl} is a bitmix of a \r{su_log_level} and \r{su_log_flags}. - * Regardless of the level these also log if \c{STATE_DEBUG|STATE_VERBOSE}. - * If \r{su_program} is set, it will be prepended to messages. */ EXPORT void su_log_write(BITENUM_IS(u32,su_log_level) lvl, char const *fmt, ...); - -/*! See \r{su_log_write()}. The \a{vp} is a \c{&va_list}. */ EXPORT void su_log_vwrite(BITENUM_IS(u32,su_log_level) lvl, char const *fmt, void *vp); - -/*! Like perror(3). */ EXPORT void su_perr(char const *msg, s32 eno_or_0); - -/*! SMP lock the global log domain. */ INLINE void su_log_lock(void){ MT( su__glock(su__GLOCK_LOG); ) } - -/*! SMP unlock the global log domain. */ INLINE void su_log_unlock(void){ MT( su__gunlock(su__GLOCK_LOG); ) } - #if !defined su_ASSERT_EXPAND_NOTHING || defined DOXYGEN -/*! With a \FAL0 crash this only logs. - * In order to get rid of linkage define \c{su_ASSERT_EXPAND_NOTHING}. */ EXPORT void su_assert(char const *expr, char const *file, u32 line, char const *fun, boole crash); #else # define su_assert(EXPR,FILE,LINE,FUN,CRASH) #endif - #if DVLOR(1, 0) -/*! When \a{disabled}, \r{su_nyd_chirp()} will return quick. */ EXPORT void su_nyd_set_disabled(boole disabled); - -/*! In event-loop driven software that uses long jumps it may be desirable to - * reset the recursion level at times. \a{nlvl} is only honoured when smaller - * than the current recursion level. */ EXPORT void su_nyd_reset_level(u32 nlvl); - -/*! Not-yet-dead chirp. - * Normally used from the support macros in code-{in,ou}.h. */ EXPORT void su_nyd_chirp(u8 act, char const *file, u32 line, char const *fun); - -/*! Dump all existing not-yet-dead entries via \a{ptf}. - * \a{buf} is NUL terminated despite \a{blen} being passed, too. */ EXPORT void su_nyd_dump(void (*ptf)(up cookie, char const *buf, uz blen), up cookie); #endif - /* BASIC C INTERFACE (SYMBOLS) }}} */ - C_DECL_END #include -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -/* POD TYPE SUPPORT {{{ */ - -// All instanceless static encapsulators. -class min; -class max; - -// Define in-namespace wrappers for C types. code-in/ou do not define short -// names for POD when used from within C++ -typedef su_ul ul; /*!< \_ */ -typedef su_ui ui; /*!< \_ */ -typedef su_us us; /*!< \_ */ -typedef su_uc uc; /*!< \_ */ - -typedef su_sl sl; /*!< \_ */ -typedef su_si si; /*!< \_ */ -typedef su_ss ss; /*!< \_ */ -typedef su_sc sc; /*!< \_ */ - -typedef su_u8 u8; /*!< \_ */ -typedef su_s8 s8; /*!< \_ */ -typedef su_u16 u16; /*!< \_ */ -typedef su_s16 s16; /*!< \_ */ -typedef su_u32 u32; /*!< \_ */ -typedef su_s32 s32; /*!< \_ */ -typedef su_u64 u64; /*!< \_ */ -typedef su_s64 s64; /*!< \_ */ - -typedef su_uz uz; /*!< \_ */ -typedef su_sz sz; /*!< \_ */ - -typedef su_up up; /*!< \_ */ -typedef su_sp sp; /*!< \_ */ - -typedef su_boole boole; /*!< \_ */ -/*! Values for \r{su_boole}. */ -enum{ - FAL0 = su_FAL0, /*!< \_ */ - TRU1 = su_TRU1, /*!< \_ */ - TRU2 = su_TRU2, /*!< \_ */ - TRUM1 = su_TRUM1 /*!< All bits set. */ -}; - -/* Place the mentioned alignment CTAs */ -MCTA(IS_POW2(sizeof(uz)), "Must be power of two") -MCTA(IS_POW2(su__ZAL_S), "Must be power of two") -MCTA(IS_POW2(su__ZAL_L), "Must be power of two") - -/*! \_ */ -class min{ -public: - static NSPC(su)s8 const s8 = su_S8_MIN; /*!< \copydoc{su_S8_MIN} */ - static NSPC(su)s16 const s16 = su_S16_MIN; /*!< \copydoc{su_S16_MIN} */ - static NSPC(su)s32 const s32 = su_S32_MIN; /*!< \copydoc{su_S32_MIN} */ - static NSPC(su)s64 const s64 = su_S64_MIN; /*!< \copydoc{su_S64_MIN} */ - static NSPC(su)sz const sz = su_SZ_MIN; /*!< \copydoc{su_SZ_MIN} */ -}; - -/*! \_ */ -class max{ -public: - static NSPC(su)s8 const s8 = su_S8_MAX; /*!< \copydoc{su_S8_MAX} */ - static NSPC(su)s16 const s16 = su_S16_MAX; /*!< \copydoc{su_S16_MAX} */ - static NSPC(su)s32 const s32 = su_S32_MAX; /*!< \copydoc{su_S32_MAX} */ - static NSPC(su)s64 const s64 = su_S64_MAX; /*!< \copydoc{su_S64_MAX} */ - static NSPC(su)sz const sz = su_SZ_MAX; /*!< \copydoc{su_SZ_MAX} */ - - static NSPC(su)u8 const u8 = su_U8_MAX; /*!< \copydoc{su_U8_MAX} */ - static NSPC(su)u16 const u16 = su_U16_MAX; /*!< \copydoc{su_U16_MAX} */ - static NSPC(su)u32 const u32 = su_U32_MAX; /*!< \copydoc{su_U32_MAX} */ - static NSPC(su)u64 const u64 = su_U64_MAX; /*!< \copydoc{su_U64_MAX} */ - static NSPC(su)uz const uz = su_UZ_MAX; /*!< \copydoc{su_UZ_MAX} */ -}; - -/* POD TYPE SUPPORT }}} */ -/* BASIC TYPE TRAITS {{{ */ - -template class type_traits; -template struct type_toolbox; -// Plus C wrapper typedef - -// External forward, defined in a-t-t.h. -template class auto_type_toolbox; - -typedef su_toolbox toolbox; /*!< See \r{type_toolbox}, \r{COLL}. */ - -/*! See \r{type_toolbox}, \r{COLL}. */ -template -class type_traits{ -public: - typedef T type; /*!< \_ */ - typedef T *tp; /*!< \_ */ - typedef T const type_const; /*!< \_ */ - typedef T const *tp_const; /*!< \_ */ - - typedef NSPC(su)type_toolbox type_toolbox; /*!< \_ */ - typedef NSPC(su)auto_type_toolbox auto_type_toolbox; /*!< \_ */ - - /*! Non-pointer types are by default own-guessed, pointer based ones not. */ - static boole const ownguess = TRU1; - /*! Ditto, associative collections, keys. */ - static boole const ownguess_key = TRU1; - - /*! \_ */ - static void *to_vp(tp_const t) {return C(void*,S(void const*,t));} - /*! \_ */ - static void const *to_const_vp(tp_const t) {return t;} - - /*! \_ */ - static tp to_tp(void const *t) {return C(tp,S(tp_const,t));} - /*! \_ */ - static tp_const to_const_tp(void const *t) {return S(tp_const,t);} -}; - -// Some specializations -template -class type_traits{ // (ugly, but required for some node based colls..) -public: - typedef T type; - typedef T *tp; - typedef T const type_const; - typedef T const *tp_const; - typedef NSPC(su)type_toolbox type_toolbox; - typedef NSPC(su)auto_type_toolbox auto_type_toolbox; - - static boole const ownguess = FAL0; - static boole const ownguess_key = TRU1; - - static void *to_vp(tp_const t) {return C(tp,t);} - static void const *to_const_vp(tp_const t) {return t;} - static tp to_tp(void const *t) {return C(tp,S(tp_const,t));} - static tp_const to_const_tp(void const *t) {return S(tp_const,t);} -}; - -template -class type_traits{ -public: - typedef T type; - typedef T *tp; - typedef T const type_const; - typedef T const *tp_const; - typedef NSPC(su)type_toolbox type_toolbox; - typedef NSPC(su)auto_type_toolbox auto_type_toolbox; - - static boole const ownguess = FAL0; - static boole const ownguess_key = TRU1; - - static void *to_vp(tp_const t) {return C(tp,t);} - static void const *to_const_vp(tp_const t) {return t;} - static tp to_tp(void const *t) {return C(tp,S(tp_const,t));} - static tp_const to_const_tp(void const *t) {return S(tp_const,t);} -}; - -template<> -class type_traits{ -public: - typedef void *type; - typedef void *tp; - typedef void const *type_const; - typedef void const *tp_const; - typedef NSPC(su)toolbox type_toolbox; - typedef NSPC(su)auto_type_toolbox auto_type_toolbox; - - static boole const ownguess = FAL0; - static boole const ownguess_key = FAL0; - - static void *to_vp(tp_const t) {return C(tp,t);} - static void const *to_const_vp(tp_const t) {return t;} - static tp to_tp(void const *t) {return C(tp,S(tp_const,t));} - static tp_const to_const_tp(void const *t) {return S(tp_const,t);} -}; - -template<> -class type_traits{ -public: - typedef void const *type; - typedef void const *tp; - typedef void const *type_const; - typedef void const *tp_const; - typedef NSPC(su)toolbox type_toolbox; - typedef NSPC(su)auto_type_toolbox auto_type_toolbox; - - static boole const ownguess = FAL0; - static boole const ownguess_key = FAL0; - - static void *to_vp(tp_const t) {return C(void*,t);} - static void const *to_const_vp(tp_const t) {return t;} - static tp to_tp(void const *t) {return C(void*,t);} - static tp_const to_const_tp(void const *t) {return t;} -}; - -template<> -class type_traits{ -public: - typedef char *type; - typedef char *tp; - typedef char const *type_const; - typedef char const *tp_const; - typedef NSPC(su)type_toolbox type_toolbox; - typedef NSPC(su)auto_type_toolbox auto_type_toolbox; - - static boole const ownguess = FAL0; - static boole const ownguess_key = TRU1; - - static void *to_vp(tp_const t) {return C(tp,t);} - static void const *to_const_vp(tp_const t) {return t;} - static tp to_tp(void const *t) {return C(tp,S(tp_const,t));} - static tp_const to_const_tp(void const *t) {return S(tp_const,t);} -}; - -template<> -class type_traits{ -public: - typedef char const *type; - typedef char const *tp; - typedef char const *type_const; - typedef char const *tp_const; - typedef NSPC(su)type_toolbox type_toolbox; - typedef NSPC(su)auto_type_toolbox auto_type_toolbox; - - static boole const ownguess = FAL0; - static boole const ownguess_key = TRU1; - - static void *to_vp(tp_const t) {return C(char*,t);} - static void const *to_const_vp(tp_const t) {return t;} - static tp to_tp(void const *t) {return C(char*,S(tp_const,t));} - static tp_const to_const_tp(void const *t) {return S(tp_const,t);} -}; - -/*! This is binary compatible with \r{toolbox} (and \r{su_toolbox})! - * Also see \r{COLL}. */ -template -struct type_toolbox{ - /*! \_ */ - typedef NSPC(su)type_traits type_traits; - - /*! \copydoc{su_clone_fun} */ - typedef typename type_traits::tp (*clone_fun)( - typename type_traits::tp_const t, u32 estate); - /*! \copydoc{su_delete_fun} */ - typedef void (*delete_fun)(typename type_traits::tp self); - /*! \copydoc{su_assign_fun} */ - typedef typename type_traits::tp (*assign_fun)( - typename type_traits::tp self, typename type_traits::tp_const t, - u32 estate); - /*! \copydoc{su_compare_fun} */ - typedef sz (*compare_fun)(typename type_traits::tp_const self, - typename type_traits::tp_const t); - /*! \copydoc{su_hash_fun} */ - typedef uz (*hash_fun)(typename type_traits::tp_const self); - - /*! \r{#clone_fun} */ - clone_fun ttb_clone; - /*! \r{#delete_fun} */ - delete_fun ttb_delete; - /*! \r{#assign_fun} */ - assign_fun ttb_assign; - /*! \r{#compare_fun} */ - compare_fun ttb_compare; - /*! \r{#hash_fun} */ - hash_fun ttb_hash; -}; - -/*! Initialize a \r{type_toolbox}. */ -#define su_TYPE_TOOLBOX_I9R(CLONE,DELETE,ASSIGN,COMPARE,HASH) \ - { CLONE, DELETE, ASSIGN, COMPARE, HASH } - -// abc,clip,max,min,pow2 -- the C macros are in SUPPORT MACROS+ -/*! \_ */ -template inline T get_abs(T const &a) {return su_ABS(a);} - -/*! \copydoc{su_CLIP()} */ -template -inline T const &get_clip(T const &a, T const &min, T const &max){ - return su_CLIP(a, min, max); -} - -/*! \copydoc{su_MAX()} */ -template -inline T const &get_max(T const &a, T const &b) {return su_MAX(a, b);} - -/*! \copydoc{su_MIN()} */ -template -inline T const &get_min(T const &a, T const &b) {return su_MIN(a, b);} - -/*! \copydoc{su_ROUND_DOWN()} */ -template -inline T const &get_round_down(T const &a, T const &b){ - return su_ROUND_DOWN(a, b); -} - -/*! \copydoc{su_ROUND_DOWN2()} */ -template -inline T const &get_round_down2(T const &a, T const &b){ - return su_ROUND_DOWN2(a, b); -} - -/*! \copydoc{su_ROUND_UP()} */ -template -inline T const &get_round_up(T const &a, T const &b){ - return su_ROUND_UP(a, b); -} - -/*! \copydoc{su_ROUND_UP2()} */ -template -inline T const &get_round_up2(T const &a, T const &b){ - return su_ROUND_UP2(a, b); -} - -/*! \copydoc{su_IS_POW2()} */ -template inline int is_pow2(T const &a) {return su_IS_POW2(a);} - -/* BASIC TYPE TRAITS }}} */ -/* BASIC C++ INTERFACE (SYMBOLS) {{{ */ - -// FIXME C++ does not yet expose the public C EXPORT_DATA symbols - -// All instanceless static encapsulators. -class bom; -class err; -class log; -class state; - -/*! \copydoc{su_bom} */ -class bom{ -public: - /*! \copydoc{su_BOM} */ - static u16 host(void) {return su_BOM;} - - /*! \copydoc{su_bom_little} */ - static u16 little(void) {return su_bom_little;} - - /*! \copydoc{su_bom_big} */ - static u16 big(void) {return su_bom_big;} -}; - -/*! \_ */ -class err{ -public: - /*! \copydoc{su_err_number} */ - enum err_number{ -#ifdef DOXYGEN - enone, /*!< No error. */ - enotobacco /*!< No such errno, fallback: no mapping exists. */ -#else - su__CXX_ERR_NUMBER_ENUM -# undef su__CXX_ERR_NUMBER_ENUM -#endif - }; - - /*! \copydoc{su_err_no()} */ - static s32 no(void) {return su_err_no();} - - /*! \copydoc{su_err_set_no()} */ - static void set_no(s32 eno) {su_err_set_no(eno);} - - /*! \copydoc{su_err_doc()} */ - static char const *doc(s32 eno) {return su_err_doc(eno);} - - /*! \copydoc{su_err_name()} */ - static char const *name(s32 eno) {return su_err_name(eno);} - - /*! \copydoc{su_err_from_name()} */ - static s32 from_name(char const *name) {return su_err_from_name(name);} - - /*! \copydoc{su_err_no_via_errno()} */ - static s32 no_via_errno(void) {return su_err_no_via_errno();} -}; - -/*! \_ */ -class log{ -public: - /*! \copydoc{su_log_level} */ - enum level{ - emerg = su_LOG_EMERG, /*!< \copydoc{su_LOG_EMERG} */ - alert = su_LOG_ALERT, /*!< \copydoc{su_LOG_ALERT} */ - crit = su_LOG_CRIT, /*!< \copydoc{su_LOG_CRIT} */ - err = su_LOG_ERR, /*!< \copydoc{su_LOG_ERR} */ - warn = su_LOG_WARN, /*!< \copydoc{su_LOG_WARN} */ - notice = su_LOG_NOTICE, /*!< \copydoc{su_LOG_NOTICE} */ - info = su_LOG_INFO, /*!< \copydoc{su_LOG_INFO} */ - debug = su_LOG_DEBUG /*!< \copydoc{su_LOG_DEBUG} */ - }; - - /*! \copydoc{su_log_flags} */ - enum flags{ - f_core = su_LOG_F_CORE, /*!< \copydoc{su_LOG_F_CORE} */ - }; - - // Log functions of various sort. - // Regardless of the level these also log if state_debug|state_verbose. - // The vp is a &va_list - /*! \copydoc{su_log_get_level()} */ - static level get_level(void) {return S(level,su_log_get_level());} - - /*! \copydoc{su_log_set_level()} */ - static void set_level(level lvl) {su_log_set_level(S(su_log_level,lvl));} - - /*! \copydoc{su_STATE_LOG_SHOW_LEVEL} */ - static boole get_show_level(void){ - return su_state_has(su_STATE_LOG_SHOW_LEVEL); - } - - /*! \copydoc{su_STATE_LOG_SHOW_LEVEL} */ - static void set_show_level(boole on){ - if(on) - su_state_set(su_STATE_LOG_SHOW_LEVEL); - else - su_state_clear(su_STATE_LOG_SHOW_LEVEL); - } - - /*! \copydoc{su_STATE_LOG_SHOW_PID} */ - static boole get_show_pid(void){ - return su_state_has(su_STATE_LOG_SHOW_PID); - } - - /*! \copydoc{su_STATE_LOG_SHOW_PID} */ - static void set_show_pid(boole on){ - if(on) - su_state_set(su_STATE_LOG_SHOW_PID); - else - su_state_clear(su_STATE_LOG_SHOW_PID); - } - - /*! \copydoc{su_log_would_write()} */ - static boole would_write(level lvl){ - return su_log_would_write(S(su_log_level,lvl)); - } - - /*! \copydoc{su_log_write()} */ - static void write(BITENUM_IS(u32,level) lvl, char const *fmt, ...); - - /*! \copydoc{su_log_vwrite()} */ - static void vwrite(BITENUM_IS(u32,level) lvl, char const *fmt, void *vp){ - su_log_vwrite(lvl, fmt, vp); - } - - /*! \copydoc{su_perr()} */ - static void perr(char const *msg, s32 eno_or_0) {su_perr(msg, eno_or_0);} - - /*! \copydoc{su_log_lock()} */ - static void lock(void) {su_log_lock();} - - /*! \copydoc{su_log_unlock()} */ - static void unlock(void) {su_log_unlock();} -}; - -/*! \_ */ -class state{ -public: - /*! \copydoc{su_state_err_type} */ - enum err_type{ - /*! \copydoc{su_STATE_ERR_NOMEM} */ - err_nomem = su_STATE_ERR_NOMEM, - /*! \copydoc{su_STATE_ERR_OVERFLOW} */ - err_overflow = su_STATE_ERR_OVERFLOW - }; - - /*! \copydoc{su_state_err_flags} */ - enum err_flags{ - /*! \copydoc{su_STATE_ERR_TYPE_MASK} */ - err_type_mask = su_STATE_ERR_TYPE_MASK, - /*! \copydoc{su_STATE_ERR_PASS} */ - err_pass = su_STATE_ERR_PASS, - /*! \copydoc{su_STATE_ERR_NOPASS} */ - err_nopass = su_STATE_ERR_NOPASS, - /*! \copydoc{su_STATE_ERR_NOERRNO} */ - err_noerrno = su_STATE_ERR_NOERRNO, - /*! \copydoc{su_STATE_ERR_MASK} */ - err_mask = su_STATE_ERR_MASK - }; - - /*! \copydoc{su_state_flags} */ - enum flags{ - /*! \copydoc{su_STATE_NONE} */ - none = su_STATE_NONE, - /*! \copydoc{su_STATE_DEBUG} */ - debug = su_STATE_DEBUG, - /*! \copydoc{su_STATE_VERBOSE} */ - verbose = su_STATE_VERBOSE, - /*! \copydoc{su_STATE_REPRODUCIBLE} */ - reproducible = su_STATE_REPRODUCIBLE - }; - - /*! \copydoc{su_program} */ - static char const *get_program(void) {return su_program;} - - /*! \copydoc{su_program} */ - static void set_program(char const *name) {su_program = name;} - - /*! \copydoc{su_state_get()} */ - static boole get(void) {return su_state_get();} - - /*! \copydoc{su_state_has()} */ - static boole has(uz state) {return su_state_has(state);} - - /*! \copydoc{su_state_set()} */ - static void set(uz state) {su_state_set(state);} - - /*! \copydoc{su_state_clear()} */ - static void clear(uz state) {su_state_clear(state);} - - /*! \copydoc{su_state_err()} */ - static s32 err(err_type err, uz state, char const *msg_or_nil=NIL){ - return su_state_err(S(su_state_err_type,err), state, msg_or_nil); - } -}; - -/* BASIC C++ INTERFACE (SYMBOLS) }}} */ - -NSPC_END(su) -#include -#endif /* !C_LANG || CXX_DOXYGEN */ - /* MORE DOXYGEN TOP GROUPS {{{ */ -/*! - * \defgroup COLL Collections - * \brief Collections - * - * In \SU, and by default, collections learn how to deal with managed objects - * through \r{su_toolbox} objects. - * The C++ variants deduce many more things, and automatically, through - * (specializations of) \r{type_traits}, \r{type_toolbox}, and - * \r{auto_type_toolbox}. - * - * Because the C++ versions are template wrappers around their \c{void*} based - * C "supertypes", it is inefficient or even impossible to use \SU collections - * for plain-old-data; to overcome this restriction (some) specializations to - * work with POD exist. - */ - -/*! - * \defgroup IO Input/Output - * \brief Input and Output - */ - -/*! - * \defgroup NET Network - * \brief Network - */ - -/*! - * \defgroup MEM Memory - * \brief Memory - */ - -/*! - * \defgroup MISC Miscellaneous - * \brief Miscellaneous - */ - -/*! - * \defgroup SMP SMP - * \brief Simultaneous Multi Processing - * - * This covers general \r{su_HAVE_SMP}, as well as its multi-threading subset - * \r{su_HAVE_MT}. - */ - -/*! - * \defgroup TEXT Text - * \brief Text - */ /* MORE DOXYGEN TOP GROUPS }}} */ - -/*! @} */ #endif /* !su_CODE_H */ /* s-it-mode */ diff --git a/include/su/config.h b/include/su/config.h index 1b82550b..e335ef10 100644 --- a/include/su/config.h +++ b/include/su/config.h @@ -21,14 +21,11 @@ #endif #ifndef su_CONFIG_H #define su_CONFIG_H - /*#define su_HAVE_NSPC*/ - /* For now thought of _MX, _ROFF; _SU: standalone library */ #ifndef su_USECASE_SU # define su_USECASE_MX #endif - #ifdef su_USECASE_MX /* In this case we get our config, error maps etc., all from here. * We must take care not to break OPT_AMALGAMATION though */ @@ -38,40 +35,30 @@ #else # include #endif - /* Internal configurables: values */ - /* Number of Not-Yet-Dead calls that are remembered */ #define su_NYD_ENTRIES (25 * 84) - /* Global configurables (code.h:CONFIG): features */ - #ifdef mx_HAVE_DEBUG # define su_HAVE_DEBUG #endif #ifdef mx_HAVE_DEVEL # define su_HAVE_DEVEL #endif - #ifdef mx_HAVE_DOCSTRINGS # define su_HAVE_DOCSTRINGS #endif - #define su_HAVE_MEM_BAG_AUTO #define su_HAVE_MEM_BAG_LOFI #ifdef mx_HAVE_NOMEMDBG # define su_HAVE_MEM_CANARIES_DISABLE #endif - #undef su_HAVE_MT #undef su_HAVE_SMP - /* Global configurables (code.h:CONFIG): values */ - /* Hardware page size (xxx additional dynamic lookup support) */ #ifndef su_PAGE_SIZE # error Need su_PAGE_SIZE configuration #endif - #endif /* !su_CONFIG_H */ /* s-it-mode */ diff --git a/include/su/cs-dict.h b/include/su/cs-dict.h dissimilarity index 63% index da6bf6fd..9b46d36b 100644 --- a/include/su/cs-dict.h +++ b/include/su/cs-dict.h @@ -1,746 +1,271 @@ -/*@ Dictionary with char* keys. - * - * Copyright (c) 2001 - 2020 Steffen (Daode) Nurpmeso . - * SPDX-License-Identifier: ISC - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, 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. - */ -#ifndef su_CS_DICT_H -#define su_CS_DICT_H - -/*! - * \file - * \ingroup CS_DICT - * \brief \r{CS_DICT} - */ - -#include - -#define su_HEADER -#include -C_DECL_BEGIN - -struct su_cs_dict; -struct su_cs_dict_view; - -/*! - * \defgroup CS_DICT Dictionary with C-style string keys - * \ingroup COLL - * \brief Dictionary with C-style string keys (\r{su/cs-dict.h}) - * - * A dictionary for unique non-\NIL \c{char*} a.k.a. byte character data keys - * with a maximum length of \r{su_S32_MAX} bytes. - * The view type is the associative unidirectional \r{su_cs_dict_view}: - * \r{CS_DICT_VIEW}. - * - * \list{\li{ - * Keys will be stored in full in the list nodes which make up the dictionary. - * They will be hashed and compared by means of \ref{CS}. - * }\li{ - * Values are optionally owned (\r{su_CS_DICT_OWNS}), in which case the given, - * then mandatory \r{su_toolbox} is used to manage value objects. - * Dependent upon \r{su_CS_DICT_NIL_IS_VALID_OBJECT} \NIL values will still be - * supported. - * }\li{ - * \r{su_STATE_ERR_PASS} may be enforced on a per-object level by setting - * \r{su_CS_DICT_ERR_PASS}. - * This interacts with \r{su_CS_DICT_NIL_IS_VALID_OBJECT}. - * }\li{ - * In-array-index list node head resorting can be controlled via - * \r{su_CS_DICT_HEAD_RESORT}. - * }\li{ - * The array size / node count spacing relation is controllable via - * \r{su_cs_dict_set_treshold_shift()}. - * Automatic shrinks are unaffected by that and happen only if - * \r{su_CS_DICT_AUTO_SHRINK} is enabled. - * }\li{ - * It is possible to turn instances into \r{su_CS_DICT_FROZEN} state. - * \r{su_cs_dict_balance()} can be used at a later time to thaw the object - * and make it reflect its new situation, if so desired. - * }} - * - * \remarks{This collection does not offer \fn{hash()} and \fn{compare()} - * functions, because these operations would be too expensive: for reproducable - * and thus correct results a temporary sorted copy would be necessary. - * - * Due to lack of this functionality it also does not offer a \r{su_toolbox} - * instance to operate on object-instances of itself.} - * @{ - */ - -/*! Flags for \r{su_cs_dict_create()}, to be queried via - * \r{su_cs_dict_flags()}, and to be adjusted via \r{su_cs_dict_add_flags()} - * and \r{su_cs_dict_clear_flags()}. */ -enum su_cs_dict_flags{ - /*! Whether power-of-two spacing and mask indexing is used. - * If this is not set, prime spacing and modulo indexing will be used. - * \remarks{Changing this setting later on is possible, but testifying the - * implied consequences work out is up to the caller.} */ - su_CS_DICT_POW2_SPACED = 1u<<0, - /*! Values are owned. - * \remarks{Changing this setting later on is possible, but testifying the - * implied consequences work out is up to the caller.} */ - su_CS_DICT_OWNS = 1u<<1, - /*! Keys shall be hashed, compared and stored case-insensitively. */ - su_CS_DICT_CASE = 1u<<2, - /*! Enable array-index list head rotation? - * This dictionary uses an array of nodes which form singly-linked lists. - * With this bit set, whenever a key is found in such a list, its list node - * will become the new head of the list, which could over time improve - * lookup speed due to lists becoming sorted by "hotness" over time. */ - su_CS_DICT_HEAD_RESORT = 1u<<3, - /*! Enable automatic shrinking of the management array. - * This is not enabled by default (the array only grows). - * See \r{su_CS_DICT_FROZEN} (and \r{su_cs_dict_set_treshold_shift()}). */ - su_CS_DICT_AUTO_SHRINK = 1u<<4, - /*! Freeze the dictionary. - * A frozen dictionary will neither grow nor shrink the management array of - * nodes automatically. - * When inserting/removing many key/value tuples it increases efficiency to - * first freeze, perform the operations, and then perform finalization - * by calling \r{su_cs_dict_balance()}. */ - su_CS_DICT_FROZEN = 1u<<5, - /*! Mapped to \r{su_STATE_ERR_PASS}. */ - su_CS_DICT_ERR_PASS = su_STATE_ERR_PASS, - /*! Mapped to \r{su_STATE_ERR_NIL_IS_VALID_OBJECT}, but only honoured for - * dictionaries which \r{su_CS_DICT_OWNS} its values. */ - su_CS_DICT_NIL_IS_VALID_OBJECT = su_STATE_ERR_NIL_IS_VALID_OBJECT, - /*! Alias for \r{su_CS_DICT_NIL_IS_VALID_OBJECT}. */ - su_CS_DICT_NILISVALO = su_CS_DICT_NIL_IS_VALID_OBJECT, - - su__CS_DICT_CREATE_MASK = su_CS_DICT_POW2_SPACED | - su_CS_DICT_OWNS | su_CS_DICT_CASE | - su_CS_DICT_HEAD_RESORT | su_CS_DICT_AUTO_SHRINK | su_CS_DICT_FROZEN | - su_CS_DICT_ERR_PASS | su_CS_DICT_NIL_IS_VALID_OBJECT -}; -#ifdef su_SOURCE_CS_DICT -CTA((su_STATE_ERR_MASK & ~0xFF00u) == 0, - "Reuse of low order bits impossible, or mask excesses storage"); -#endif - -/*! Opaque. */ -struct su_cs_dict{ - struct su__cs_dict_node **csd_array; - u16 csd_flags; - u8 csd_tshift; - u8 csd__pad[su_6432(5,1)]; - u32 csd_count; - u32 csd_size; - struct su_toolbox const *csd_tbox; -}; - -struct su__cs_dict_node{ - struct su__cs_dict_node *csdn_next; - void *csdn_data; - uz csdn_khash; - u32 csdn_klen; - char csdn_key[su_VFIELD_SIZE(4)]; -}; - -/* "The const is preserved logically" */ -EXPORT struct su__cs_dict_node *su__cs_dict_lookup( - struct su_cs_dict const *self, char const *key, void *lookarg_or_nil); -/* *lookarg_or_nil is always updated */ -EXPORT s32 su__cs_dict_insrep(struct su_cs_dict *self, char const *key, - void *value, up replace_and_view_or_nil); -#if DVLOR(1, 0) -EXPORT void su__cs_dict_stats(struct su_cs_dict const *self); -#endif - -/*! Easy iteration support. - * \a{VIEWNAME} must be a(n) (non-pointer) instance of \r{su_cs_dict_view}. */ -#define su_CS_DICT_FOREACH(SELF,VIEWNAME) \ - for(su_cs_dict_view_begin(su_cs_dict_view_setup(VIEWNAME, SELF));\ - su_cs_dict_view_is_valid(VIEWNAME);\ - su_cs_dict_view_next(VIEWNAME)) - -/*! Create an instance. - * \a{flags} is a mix of \r{su_cs_dict_flags}. - * If \r{su_CS_DICT_OWNS} is specified, \a{tbox_or_nil} is a mandatory, - * asserted argument. */ -EXPORT struct su_cs_dict *su_cs_dict_create(struct su_cs_dict *self, - u16 flags, struct su_toolbox const *tbox_or_nil); - -/*! Initialization plus \r{su_cs_dict_assign()}. - * \remarks{In difference to assignment this inherits all flags and - * properties from \a{t}.} */ -EXPORT SHADOW struct su_cs_dict *su_cs_dict_create_copy( - struct su_cs_dict *self, struct su_cs_dict const *t); - -/*! Destructor. */ -EXPORT void su_cs_dict_gut(struct su_cs_dict *self); - -/*! Assign \a{t}, and return 0 on success or, depending on the - * \r{su_CS_DICT_ERR_PASS} setting, the corresponding \r{su_state_err()}. - * \remarks{The element order of \SELF and \a{t} may not be identical.} - * \copydoc{su_assign_fun} */ -EXPORT s32 su_cs_dict_assign(struct su_cs_dict *self, - struct su_cs_dict const *t); - -/*! Like \r{su_cs_dict_assign()}, but it only assigns the elements of \a{t}, - * it does neither assign the toolbox nor any configuration flags. */ -EXPORT s32 su_cs_dict_assign_elems(struct su_cs_dict *self, - struct su_cs_dict const *t); - -/*! Remove all elements, and release all memory. */ -EXPORT struct su_cs_dict *su_cs_dict_clear(struct su_cs_dict *self); - -/*! Remove only the elements, keep other allocations. */ -EXPORT struct su_cs_dict *su_cs_dict_clear_elems(struct su_cs_dict *self); - -/*! Swap the fields of \a{self} and \a{t}. */ -EXPORT struct su_cs_dict *su_cs_dict_swap(struct su_cs_dict *self, - struct su_cs_dict *t); - -/*! Get the used \r{su_cs_dict_flags}. */ -INLINE u16 su_cs_dict_flags(struct su_cs_dict const *self){ - ASSERT(self); - return self->csd_flags; -} - -/*! Set some \r{su_cs_dict_flags}. */ -INLINE struct su_cs_dict *su_cs_dict_add_flags(struct su_cs_dict *self, - u16 flags){ - ASSERT(self); - flags &= su__CS_DICT_CREATE_MASK; - self->csd_flags |= flags; - return self; -} - -/*! Clear some \r{su_cs_dict_flags}. */ -INLINE struct su_cs_dict *su_cs_dict_clear_flags(struct su_cs_dict *self, - u16 flags){ - ASSERT(self); - flags &= su__CS_DICT_CREATE_MASK; - self->csd_flags &= ~flags; - return self; -} - -/*! Get the used treshold shift. - * See \r{su_cs_dict_set_treshold_shift()}. */ -INLINE u8 su_cs_dict_treshold_shift(struct su_cs_dict const *self){ - ASSERT(self); - return self->csd_tshift; -} - -/*! Set the treshold shift. - * The treshold shift is used to decide when the internal array is to be grown - * according to the algorithm - * \cb{count-of-buckets >= array-capacity << treshold-shift} - * The value will be \r{su_CLIP()}ped in between 1 and 8; the default is 2. - * It does not affect shrinking (controlled via \r{su_CS_DICT_AUTO_SHRINK}). */ -INLINE struct su_cs_dict *su_cs_dict_set_treshold_shift( - struct su_cs_dict *self, u8 ntshift){ - ASSERT(self); - self->csd_tshift = CLIP(ntshift, 1, 8); - return self; -} - -/*! Get the used \r{su_toolbox}, or \NIL. */ -INLINE struct su_toolbox const *su_cs_dict_toolbox( - struct su_cs_dict const *self){ - ASSERT(self); - return self->csd_tbox; -} - -/*! Set the (possibly) used \r{su_toolbox}. - * The toolbox is asserted if \r{su_CS_DICT_OWNS} is set. */ -INLINE struct su_cs_dict *su_cs_dict_set_toolbox(struct su_cs_dict *self, - struct su_toolbox const *tbox_or_nil){ - ASSERT(self); - ASSERT(!(su_cs_dict_flags(self) & su_CS_DICT_OWNS) || - (tbox_or_nil != NIL && tbox_or_nil->tb_clone != NIL && - tbox_or_nil->tb_delete != NIL && tbox_or_nil->tb_assign != NIL)); - self->csd_tbox = tbox_or_nil; - return self; -} - -/*! Current number of key/value element pairs. */ -INLINE u32 su_cs_dict_count(struct su_cs_dict const *self){ - ASSERT(self); - return self->csd_count; -} - -/*! Thaw and balance \a{self}. - * Thaw \SELF from (a possible) \r{su_CS_DICT_FROZEN} state, recalculate the - * perfect size of the management table for the current number of managed - * elements, and rebalance \SELF as necessary. - * \remarks{If memory failures occur the balancing is simply not performed.} */ -EXPORT struct su_cs_dict *su_cs_dict_balance(struct su_cs_dict *self); - -/*! Test whether \a{key} is present in \SELF. */ -INLINE boole su_cs_dict_has_key(struct su_cs_dict const *self, - char const *key){ - ASSERT(self); - ASSERT_RET(key != NIL, FAL0); - return (su__cs_dict_lookup(self, key, NIL) != NIL); -} - -/*! Lookup a value, return it (possibly \NIL) or \NIL. */ -INLINE void *su_cs_dict_lookup(struct su_cs_dict *self, char const *key){ - struct su__cs_dict_node *csdnp; - ASSERT(self != NIL); - ASSERT_RET(key != NIL, NIL); - csdnp = su__cs_dict_lookup(self, key, NIL); - return (csdnp != NIL) ? csdnp->csdn_data : NIL; -} - -/*! Insert a new \a{key} mapping to \a{value}. - * Returns 0 upon successful insertion, -1 if \a{key} already exists (use - * \r{su_cs_dict_replace()} if you want to insert or update a value), - * or a \r{su_err_number} (including, also depending on the setting of - * \r{su_CS_DICT_ERR_PASS}, a corresponding \r{su_state_err()}). - * If \a{value} is \NIL (after cloning) and \r{su_CS_DICT_OWNS} is set and - * \r{su_CS_DICT_NIL_IS_VALID_OBJECT} is not, \ERR{INVAL} is returned. */ -INLINE s32 su_cs_dict_insert(struct su_cs_dict *self, char const *key, - void *value){ - ASSERT(self); - ASSERT_RET(key != NIL, 0); - return su__cs_dict_insrep(self, key, value, FAL0); -} - -/*! Insert a new, or update an existing \a{key} mapping to \a{value}. - * Returns 0 upon successful insertion of a new \a{key}, -1 upon update - * of an existing \a{key}, or a \r{su_err_number} (including, also depending on - * the setting of \r{su_CS_DICT_ERR_PASS}, a corresponding \r{su_state_err()}). - * If \a{value} is \NIL and \r{su_CS_DICT_OWNS} is set and - * \r{su_CS_DICT_NIL_IS_VALID_OBJECT} is not, \ERR{INVAL} is returned. - * - * \remarks{When \SELF owns its values and \r{su_CS_DICT_NILISVALO} is set, - * then if updating a non-\NIL value via the \r{su_assign_fun} of the used - * \r{su_toolbox} fails, the old object will be deleted, \NIL will be inserted, - * and this function fails.} - * - * Likewise, if \r{su_CS_DICT_NILISVALO} is not set, then if the - * \r{su_clone_fun} of the toolbox fails to create a duplicate of \a{value}, - * then the old value will remain unchanged and this function fails.} */ -INLINE s32 su_cs_dict_replace(struct su_cs_dict *self, char const *key, - void *value){ - ASSERT(self); - ASSERT_RET(key != NIL, 0); - return su__cs_dict_insrep(self, key, value, TRU1); -} - -/*! Returns the false boolean if \a{key} cannot be found. */ -EXPORT boole su_cs_dict_remove(struct su_cs_dict *self, char const *key); - -/*! With \r{su_HAVE_DEBUG} and/or \r{su_HAVE_DEVEL} this will - * \r{su_log_write()} statistics about \SELF. */ -INLINE void su_cs_dict_statistics(struct su_cs_dict const *self){ - UNUSED(self); -#if DVLOR(1, 0) - su__cs_dict_stats(self); -#endif -} - -/*! - * \defgroup CS_DICT_VIEW View of and for su_cs_dict - * \ingroup CS_DICT - * \brief View of and for \r{su_cs_dict} (\r{su/cs-dict.h}) - * - * This implements an associative unidirectional view type. - * Whereas it documents C++ interfaces, \r{su/view.h} also applies to C views. - */ - -enum su__cs_dict_view_move_types{ - su__CS_DICT_VIEW_MOVE_BEGIN, - su__CS_DICT_VIEW_MOVE_HAS_NEXT, - su__CS_DICT_VIEW_MOVE_NEXT -}; - -/*! \_ */ -struct su_cs_dict_view{ - struct su_cs_dict *csdv_parent; /*!< We are \fn{is_setup()} with it. */ - struct su__cs_dict_node *csdv_node; - u32 csdv_index; - /* Those only valid after _move(..HAS_NEXT) */ - u32 csdv_next_index; - struct su__cs_dict_node *csdv_next_node; -}; - -/* "The const is preserved logically" */ -EXPORT struct su_cs_dict_view *su__cs_dict_view_move( - struct su_cs_dict_view *self, u8 type); - -/*! Easy iteration support; \a{SELF} must be \r{su_cs_dict_view_setup()}. */ -#define su_CS_DICT_VIEW_FOREACH(SELF) \ - for(su_cs_dict_view_begin(SELF); su_cs_dict_view_is_valid(SELF);\ - su_cs_dict_view_next(SELF)) - -/*! Create a tie in between \SELF and its parent collection object. */ -INLINE struct su_cs_dict_view *su_cs_dict_view_setup( - struct su_cs_dict_view *self, struct su_cs_dict *parent){ - ASSERT(self); - self->csdv_parent = parent; - self->csdv_node = NIL; - ASSERT_RET(parent != NIL, self); - return self; -} - -/*! \r{su_cs_dict_view_setup()} must have been called before. */ -INLINE struct su_cs_dict *su_cs_dict_view_parent( - struct su_cs_dict_view const *self){ - ASSERT(self); - return self->csdv_parent; -} - -/*! \_ */ -INLINE boole su_cs_dict_view_is_valid(struct su_cs_dict_view const *self){ - ASSERT(self); - return (self->csdv_node != NIL); -} - -/*! \_ */ -INLINE struct su_cs_dict_view *su_cs_dict_view_reset( - struct su_cs_dict_view *self){ - ASSERT(self); - self->csdv_node = NIL; - return self; -} - -/*! \_ */ -INLINE char const *su_cs_dict_view_key(struct su_cs_dict_view const *self){ - ASSERT(self); - ASSERT_RET(su_cs_dict_view_is_valid(self), NIL); - return self->csdv_node->csdn_key; -} - -/*! \_ */ -INLINE u32 su_cs_dict_view_key_len(struct su_cs_dict_view const *self){ - ASSERT(self); - ASSERT_RET(su_cs_dict_view_is_valid(self), 0); - return self->csdv_node->csdn_klen; -} - -/*! \_ */ -INLINE uz su_cs_dict_view_key_hash(struct su_cs_dict_view const *self){ - ASSERT(self); - ASSERT_RET(su_cs_dict_view_is_valid(self), 0); - return self->csdv_node->csdn_khash; -} - -/*! \_ */ -INLINE void *su_cs_dict_view_data(struct su_cs_dict_view const *self){ - ASSERT(self); - ASSERT_RET(su_cs_dict_view_is_valid(self), NIL); - return self->csdv_node->csdn_data; -} - -/*! Replace the data of a \r{su_cs_dict_view_is_valid()} view. - * Behaves like \r{su_cs_dict_replace()}. */ -EXPORT s32 su_cs_dict_view_set_data(struct su_cs_dict_view *self, void *value); - -/*! Move a setup view to the first position, if there is one. - * \r{su_cs_dict_view_is_valid()} must be tested thereafter. */ -INLINE struct su_cs_dict_view *su_cs_dict_view_begin( - struct su_cs_dict_view *self){ - ASSERT(self); - return su__cs_dict_view_move(self, su__CS_DICT_VIEW_MOVE_BEGIN); -} - -/*! Whether another position follows a \r{su_cs_dict_view_is_valid()} one. - * A following \r{su_cs_dict_view_next()} will use informations collected by - * this function. */ -INLINE boole su_cs_dict_view_has_next(struct su_cs_dict_view const *self){ - ASSERT(self); - ASSERT_RET(su_cs_dict_view_is_valid(self), FAL0); - return (su__cs_dict_view_move(C(struct su_cs_dict_view*,self), - su__CS_DICT_VIEW_MOVE_HAS_NEXT)->csdv_next_node != NIL); -} - -/*! Step forward a \r{su_cs_dict_view_is_valid()} view. */ -INLINE struct su_cs_dict_view *su_cs_dict_view_next( - struct su_cs_dict_view *self){ - ASSERT(self); - ASSERT_RET(su_cs_dict_view_is_valid(self), self); - return su__cs_dict_view_move(self, su__CS_DICT_VIEW_MOVE_NEXT); -} - -/*! Search for \a{key} and return the new \r{su_cs_dict_view_is_valid()}. */ -EXPORT boole su_cs_dict_view_find(struct su_cs_dict_view *self, - char const *key); - -/*! See \r{su_cs_dict_insert()}. - * Upon success 0 is returned and \r{su_cs_dict_view_is_valid()} will be true. - * It is also true if -1 is returned because an existing \a{key} has not been - * updated. */ -INLINE s32 su_cs_dict_view_reset_insert(struct su_cs_dict_view *self, - char const *key, void *value){ - ASSERT(self); - ASSERT_RET(key != NIL, 0); - return su__cs_dict_insrep(self->csdv_parent, key, value, FAL0 | R(up,self)); -} - -/*! See \r{su_cs_dict_replace()}. - * Upon success 0 or -1 is returned and \r{su_cs_dict_view_is_valid()}. */ -INLINE s32 su_cs_dict_view_reset_replace(struct su_cs_dict_view *self, - char const *key, void *value){ - ASSERT(self); - ASSERT_RET(key != NIL, 0); - return su__cs_dict_insrep(self->csdv_parent, key, value, TRU1 | R(up,self)); -} - -/*! Remove the key/value tuple of a \r{su_cs_dict_view_is_valid()} view, - * then move to the next valid position, if any. */ -EXPORT struct su_cs_dict_view *su_cs_dict_view_remove( - struct su_cs_dict_view *self); - -/*! Test two views for equality. */ -INLINE sz su_cs_dict_view_cmp(struct su_cs_dict_view const *self, - struct su_cs_dict_view const *t){ - ASSERT_RET(self, -(t != NIL)); - ASSERT_RET(t, 1); - return (self->csdv_node == t->csdv_node); -} - -/*! @} */ -/*! @} */ -C_DECL_END -#include -#if !su_C_LANG || defined CXX_DOXYGEN -# include - -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -template class cs_dict; - -/*! - * \ingroup CS_DICT - * C++ variant of \r{CS_DICT} (\r{su/cs-dict.h}) - */ -template::ownguess> -class cs_dict : private su_cs_dict{ - class gview; - - class gview : private su_cs_dict_view{ - public: - // xxx clang 5.0.1 BUG: needed this-> to find superclass field - gview(void) {this->csdv_parent = NIL; this->csdv_node = NIL;} - gview(gview const &t) {*this = t;} - ~gview(void) {} - gview &operator=(gview const &t){ - SELFTHIS_RET(*S(su_cs_dict_view*,this) = - *S(su_cs_dict_view const*,&t)); - } - gview &setup(su_cs_dict &parent){ - SELFTHIS_RET(su_cs_dict_view_setup(this, &parent)); - } - boole is_setup(void) const {return su_cs_dict_view_parent(this) != NIL;} - boole is_same_parent(gview const &t) const{ - return su_cs_dict_view_parent(this) == su_cs_dict_view_parent(&t); - } - boole is_valid(void) const {return su_cs_dict_view_is_valid(this);} - gview &reset(void){ - SELFTHIS_RET(su_cs_dict_view_reset(this)); - } - char const *key(void) const {return su_cs_dict_view_key(this);} - void *data(void) {return su_cs_dict_view_data(this);} - void const *data(void) const {return su_cs_dict_view_data(this);} - s32 set_data(void *value) {return su_cs_dict_view_set_data(this, value);} - gview &begin(void) {SELFTHIS_RET(su_cs_dict_view_begin(this));} - boole has_next(void) const {return su_cs_dict_view_has_next(this);} - gview &next(void) {SELFTHIS_RET(su_cs_dict_view_next(this));} - boole find(void const *key){ - return su_cs_dict_view_find(this, S(char const*,key)); - } - s32 reset_insert(void const *key, void *value){ - return su_cs_dict_view_reset_insert(this, S(char const*,key), value); - } - s32 reset_replace(void const *key, void *value){ - return su_cs_dict_view_reset_replace(this, S(char const*,key), value); - } - gview &remove(void) {SELFTHIS_RET(su_cs_dict_view_remove(this));} - sz cmp(gview const &t) const {return su_cs_dict_view_cmp(this, &t);} - }; - -public: - /*! \copydoc{su_cs_dict_flags} */ - enum flags{ - f_none, /*!< This is 0. */ - /*! \copydoc{su_CS_DICT_POW2_SPACED} */ - f_pow2_spaced = su_CS_DICT_POW2_SPACED, - /*! \copydoc{su_CS_DICT_CASE} */ - f_case = su_CS_DICT_CASE, - /*! \copydoc{su_CS_DICT_HEAD_RESORT} */ - f_head_resort = su_CS_DICT_HEAD_RESORT, - /*! \copydoc{su_CS_DICT_AUTO_SHRINK} */ - f_auto_shrink = su_CS_DICT_AUTO_SHRINK, - /*! \copydoc{su_CS_DICT_FROZEN} */ - f_frozen = su_CS_DICT_FROZEN, - /*! \copydoc{su_CS_DICT_ERR_PASS} */ - f_err_pass = su_CS_DICT_ERR_PASS, - /*! \copydoc{su_CS_DICT_NIL_IS_VALID_OBJECT} */ - f_nil_is_valid_object = su_CS_DICT_NIL_IS_VALID_OBJECT, - /*! Alias for \r{f_nil_is_valid_object}. */ - f_nilisvalo = su_CS_DICT_NILISVALO - }; - - /*! \_ */ - typedef NSPC(su)type_traits type_traits; - - /*! \_ */ - typedef typename type_traits::type_toolbox type_toolbox; - - /*! \_ */ - typedef typename type_traits::auto_type_toolbox auto_type_toolbox; - - /*! \_ */ - typedef typename type_traits::tp tp; - - /*! \_ */ - typedef typename type_traits::tp_const tp_const; - - /*! \_ */ - typedef NSPC(su)view_traits - view_traits; - - friend class NSPC(su)view_assoc_unidir; - friend class NSPC(su)view_assoc_unidir_const; - - /*! \r{CS_DICT_VIEW} (\r{su/cs-dict.h}) */ - typedef NSPC(su)view_assoc_unidir view; - - /*! \r{CS_DICT_VIEW} (\r{su/cs-dict.h}) */ - typedef NSPC(su)view_assoc_unidir_const view_const; - - /*! \copydoc{su_cs_dict_create()} */ - cs_dict(type_toolbox const *ttbox=NIL, u16 flags=f_none){ - ASSERT(!OWNS || (ttbox != NIL && ttbox->ttb_clone != NIL && - ttbox->ttb_delete != NIL && ttbox->ttb_assign != NIL)); - flags &= su__CS_DICT_CREATE_MASK & ~su_CS_DICT_OWNS; - if(OWNS) - flags |= su_CS_DICT_OWNS; - su_cs_dict_create(this, flags, R(su_toolbox const*,ttbox)); - } - - /*! \copydoc{su_cs_dict_create_copy()} */ - SHADOW cs_dict(cs_dict const &t) {su_cs_dict_create_copy(this, &t);} - - /*! \copydoc{su_cs_dict_gut()} */ - ~cs_dict(void) {su_cs_dict_gut(this);} - - /*! \copydoc{su_cs_dict_assign()} */ - s32 assign(cs_dict const &t) {return su_cs_dict_assign(this, &t);} - - /*! \r{assign()} */ - SHADOW cs_dict &operator=(cs_dict const &t) {SELFTHIS_RET(assign(t));} - - /*! \copydoc{su_cs_dict_assign_elems()} */ - s32 assign_elems(cs_dict const &t){ - return su_cs_dict_assign_elems(this, &t); - } - - /*! \copydoc{su_cs_dict_clear()} */ - cs_dict &clear(void) {SELFTHIS_RET(su_cs_dict_clear(this));} - - /*! \copydoc{su_cs_dict_clear_elems()} */ - cs_dict &clear_elems(void) {SELFTHIS_RET(su_cs_dict_clear_elems(this));} - - /*! \copydoc{su_cs_dict_swap()} */ - cs_dict &swap(cs_dict &t) {SELFTHIS_RET(su_cs_dict_swap(this, &t));} - - /*! \copydoc{su_cs_dict_flags()} */ - u16 flags(void) const {return (su_cs_dict_flags(this) & ~su_CS_DICT_OWNS);} - - /*! \copydoc{su_cs_dict_add_flags()} */ - cs_dict &add_flags(u16 flags){ - SELFTHIS_RET(su_cs_dict_add_flags(this, flags & ~su_CS_DICT_OWNS)); - } - - /*! \copydoc{su_cs_dict_clear_flags()} */ - cs_dict &clear_flags(u16 flags){ - SELFTHIS_RET(su_cs_dict_clear_flags(this, flags & ~su_CS_DICT_OWNS)); - } - - /*! \copydoc{su_cs_dict_treshold_shift()} */ - u8 treshold_shift(void) const {return su_cs_dict_treshold_shift(this);} - - /*! \copydoc{su_cs_dict_set_treshold_shift()} */ - cs_dict &set_treshold_shift(u8 tshift){ - SELFTHIS_RET(su_cs_dict_set_treshold_shift(this, tshift)); - } - - /*! \copydoc{su_cs_dict_toolbox()} */ - type_toolbox const *toolbox(void) const{ - return R(type_toolbox const*,su_cs_dict_toolbox(this)); - } - - /*! \copydoc{su_cs_dict_set_toolbox()} */ - cs_dict &set_toolbox(type_toolbox const *tbox_or_nil){ - SELFTHIS_RET(su_cs_dict_set_toolbox(this, - R(su_toolbox const*,tbox_or_nil))); - } - - /*! \copydoc{su_cs_dict_count()} */ - u32 count(void) const {return csd_count;} - - /*! Whether \r{count()} is 0. */ - boole is_empty(void) const {return (count() == 0);} - - /*! \copydoc{su_cs_dict_balance()} */ - cs_dict &balance(void) {SELFTHIS_RET(su_cs_dict_balance(this));} - - /*! \copydoc{su_cs_dict_has_key()} */ - boole has_key(char const *key) const{ - ASSERT_RET(key != NIL, FAL0); - return su_cs_dict_has_key(this, key); - } - - /*! \copydoc{su_cs_dict_lookup()} */ - tp lookup(char const *key){ - ASSERT_RET(key != NIL, NIL); - return type_traits::to_tp(su_cs_dict_lookup(this, key)); - } - - /*! \r{lookup()} */ - tp operator[](char const *key) {return lookup(key);} - - /*! \r{lookup()} */ - tp_const lookup(char const *key) const{ - ASSERT_RET(key != NIL, NIL); - return type_traits::to_const_tp(su_cs_dict_lookup(C(su_cs_dict*,this), - key)); - } - - /*! \r{lookup()} */ - tp_const operator[](char const *key) const {return lookup(key);} - - /*! \copydoc{su_cs_dict_insert()} */ - s32 insert(char const *key, tp_const value){ - ASSERT_RET(key != NIL, 0); - return su_cs_dict_insert(this, key, type_traits::to_vp(value)); - } - - /*! \copydoc{su_cs_dict_replace()} */ - s32 replace(char const *key, tp_const value){ - ASSERT_RET(key != NIL, 0); - return su_cs_dict_replace(this, key, type_traits::to_vp(value)); - } - - /*! \copydoc{su_cs_dict_remove()} */ - boole remove(char const *key){ - ASSERT_RET(key != NIL, FAL0); - return su_cs_dict_remove(this, key); - } - - /*! \copydoc{su_cs_dict_statistics()} */ - void statistics(void) const {su_cs_dict_statistics(this);} -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ -#endif /* su_CS_DICT_H */ -/* s-it-mode */ +/*@ Dictionary with char* keys. + * + * Copyright (c) 2001 - 2020 Steffen (Daode) Nurpmeso . + * SPDX-License-Identifier: ISC + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, 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. + */ +#ifndef su_CS_DICT_H +#define su_CS_DICT_H +#include +#define su_HEADER +#include +C_DECL_BEGIN +struct su_cs_dict; +struct su_cs_dict_view; +enum su_cs_dict_flags{ + su_CS_DICT_POW2_SPACED = 1u<<0, + su_CS_DICT_OWNS = 1u<<1, + su_CS_DICT_CASE = 1u<<2, + su_CS_DICT_HEAD_RESORT = 1u<<3, + su_CS_DICT_AUTO_SHRINK = 1u<<4, + su_CS_DICT_FROZEN = 1u<<5, + su_CS_DICT_ERR_PASS = su_STATE_ERR_PASS, + su_CS_DICT_NIL_IS_VALID_OBJECT = su_STATE_ERR_NIL_IS_VALID_OBJECT, + su_CS_DICT_NILISVALO = su_CS_DICT_NIL_IS_VALID_OBJECT, + su__CS_DICT_CREATE_MASK = su_CS_DICT_POW2_SPACED | + su_CS_DICT_OWNS | su_CS_DICT_CASE | + su_CS_DICT_HEAD_RESORT | su_CS_DICT_AUTO_SHRINK | su_CS_DICT_FROZEN | + su_CS_DICT_ERR_PASS | su_CS_DICT_NIL_IS_VALID_OBJECT +}; +#ifdef su_SOURCE_CS_DICT +CTA((su_STATE_ERR_MASK & ~0xFF00u) == 0, + "Reuse of low order bits impossible, or mask excesses storage"); +#endif +struct su_cs_dict{ + struct su__cs_dict_node **csd_array; + u16 csd_flags; + u8 csd_tshift; + u8 csd__pad[su_6432(5,1)]; + u32 csd_count; + u32 csd_size; + struct su_toolbox const *csd_tbox; +}; +struct su__cs_dict_node{ + struct su__cs_dict_node *csdn_next; + void *csdn_data; + uz csdn_khash; + u32 csdn_klen; + char csdn_key[su_VFIELD_SIZE(4)]; +}; +/* "The const is preserved logically" */ +EXPORT struct su__cs_dict_node *su__cs_dict_lookup( + struct su_cs_dict const *self, char const *key, void *lookarg_or_nil); +/* *lookarg_or_nil is always updated */ +EXPORT s32 su__cs_dict_insrep(struct su_cs_dict *self, char const *key, + void *value, up replace_and_view_or_nil); +#if DVLOR(1, 0) +EXPORT void su__cs_dict_stats(struct su_cs_dict const *self); +#endif +#define su_CS_DICT_FOREACH(SELF,VIEWNAME) \ + for(su_cs_dict_view_begin(su_cs_dict_view_setup(VIEWNAME, SELF));\ + su_cs_dict_view_is_valid(VIEWNAME);\ + su_cs_dict_view_next(VIEWNAME)) +EXPORT struct su_cs_dict *su_cs_dict_create(struct su_cs_dict *self, + u16 flags, struct su_toolbox const *tbox_or_nil); +EXPORT SHADOW struct su_cs_dict *su_cs_dict_create_copy( + struct su_cs_dict *self, struct su_cs_dict const *t); +EXPORT void su_cs_dict_gut(struct su_cs_dict *self); +EXPORT s32 su_cs_dict_assign(struct su_cs_dict *self, + struct su_cs_dict const *t); +EXPORT s32 su_cs_dict_assign_elems(struct su_cs_dict *self, + struct su_cs_dict const *t); +EXPORT struct su_cs_dict *su_cs_dict_clear(struct su_cs_dict *self); +EXPORT struct su_cs_dict *su_cs_dict_clear_elems(struct su_cs_dict *self); +EXPORT struct su_cs_dict *su_cs_dict_swap(struct su_cs_dict *self, + struct su_cs_dict *t); +INLINE u16 su_cs_dict_flags(struct su_cs_dict const *self){ + ASSERT(self); + return self->csd_flags; +} +INLINE struct su_cs_dict *su_cs_dict_add_flags(struct su_cs_dict *self, + u16 flags){ + ASSERT(self); + flags &= su__CS_DICT_CREATE_MASK; + self->csd_flags |= flags; + return self; +} +INLINE struct su_cs_dict *su_cs_dict_clear_flags(struct su_cs_dict *self, + u16 flags){ + ASSERT(self); + flags &= su__CS_DICT_CREATE_MASK; + self->csd_flags &= ~flags; + return self; +} +INLINE u8 su_cs_dict_treshold_shift(struct su_cs_dict const *self){ + ASSERT(self); + return self->csd_tshift; +} +INLINE struct su_cs_dict *su_cs_dict_set_treshold_shift( + struct su_cs_dict *self, u8 ntshift){ + ASSERT(self); + self->csd_tshift = CLIP(ntshift, 1, 8); + return self; +} +INLINE struct su_toolbox const *su_cs_dict_toolbox( + struct su_cs_dict const *self){ + ASSERT(self); + return self->csd_tbox; +} +INLINE struct su_cs_dict *su_cs_dict_set_toolbox(struct su_cs_dict *self, + struct su_toolbox const *tbox_or_nil){ + ASSERT(self); + ASSERT(!(su_cs_dict_flags(self) & su_CS_DICT_OWNS) || + (tbox_or_nil != NIL && tbox_or_nil->tb_clone != NIL && + tbox_or_nil->tb_delete != NIL && tbox_or_nil->tb_assign != NIL)); + self->csd_tbox = tbox_or_nil; + return self; +} +INLINE u32 su_cs_dict_count(struct su_cs_dict const *self){ + ASSERT(self); + return self->csd_count; +} +EXPORT struct su_cs_dict *su_cs_dict_balance(struct su_cs_dict *self); +INLINE boole su_cs_dict_has_key(struct su_cs_dict const *self, + char const *key){ + ASSERT(self); + ASSERT_RET(key != NIL, FAL0); + return (su__cs_dict_lookup(self, key, NIL) != NIL); +} +INLINE void *su_cs_dict_lookup(struct su_cs_dict *self, char const *key){ + struct su__cs_dict_node *csdnp; + ASSERT(self != NIL); + ASSERT_RET(key != NIL, NIL); + csdnp = su__cs_dict_lookup(self, key, NIL); + return (csdnp != NIL) ? csdnp->csdn_data : NIL; +} +INLINE s32 su_cs_dict_insert(struct su_cs_dict *self, char const *key, + void *value){ + ASSERT(self); + ASSERT_RET(key != NIL, 0); + return su__cs_dict_insrep(self, key, value, FAL0); +} +INLINE s32 su_cs_dict_replace(struct su_cs_dict *self, char const *key, + void *value){ + ASSERT(self); + ASSERT_RET(key != NIL, 0); + return su__cs_dict_insrep(self, key, value, TRU1); +} +EXPORT boole su_cs_dict_remove(struct su_cs_dict *self, char const *key); +INLINE void su_cs_dict_statistics(struct su_cs_dict const *self){ + UNUSED(self); +#if DVLOR(1, 0) + su__cs_dict_stats(self); +#endif +} +enum su__cs_dict_view_move_types{ + su__CS_DICT_VIEW_MOVE_BEGIN, + su__CS_DICT_VIEW_MOVE_HAS_NEXT, + su__CS_DICT_VIEW_MOVE_NEXT +}; +struct su_cs_dict_view{ + struct su_cs_dict *csdv_parent; + struct su__cs_dict_node *csdv_node; + u32 csdv_index; + /* Those only valid after _move(..HAS_NEXT) */ + u32 csdv_next_index; + struct su__cs_dict_node *csdv_next_node; +}; +/* "The const is preserved logically" */ +EXPORT struct su_cs_dict_view *su__cs_dict_view_move( + struct su_cs_dict_view *self, u8 type); +#define su_CS_DICT_VIEW_FOREACH(SELF) \ + for(su_cs_dict_view_begin(SELF); su_cs_dict_view_is_valid(SELF);\ + su_cs_dict_view_next(SELF)) +INLINE struct su_cs_dict_view *su_cs_dict_view_setup( + struct su_cs_dict_view *self, struct su_cs_dict *parent){ + ASSERT(self); + self->csdv_parent = parent; + self->csdv_node = NIL; + ASSERT_RET(parent != NIL, self); + return self; +} +INLINE struct su_cs_dict *su_cs_dict_view_parent( + struct su_cs_dict_view const *self){ + ASSERT(self); + return self->csdv_parent; +} +INLINE boole su_cs_dict_view_is_valid(struct su_cs_dict_view const *self){ + ASSERT(self); + return (self->csdv_node != NIL); +} +INLINE struct su_cs_dict_view *su_cs_dict_view_reset( + struct su_cs_dict_view *self){ + ASSERT(self); + self->csdv_node = NIL; + return self; +} +INLINE char const *su_cs_dict_view_key(struct su_cs_dict_view const *self){ + ASSERT(self); + ASSERT_RET(su_cs_dict_view_is_valid(self), NIL); + return self->csdv_node->csdn_key; +} +INLINE u32 su_cs_dict_view_key_len(struct su_cs_dict_view const *self){ + ASSERT(self); + ASSERT_RET(su_cs_dict_view_is_valid(self), 0); + return self->csdv_node->csdn_klen; +} +INLINE uz su_cs_dict_view_key_hash(struct su_cs_dict_view const *self){ + ASSERT(self); + ASSERT_RET(su_cs_dict_view_is_valid(self), 0); + return self->csdv_node->csdn_khash; +} +INLINE void *su_cs_dict_view_data(struct su_cs_dict_view const *self){ + ASSERT(self); + ASSERT_RET(su_cs_dict_view_is_valid(self), NIL); + return self->csdv_node->csdn_data; +} +EXPORT s32 su_cs_dict_view_set_data(struct su_cs_dict_view *self, void *value); +INLINE struct su_cs_dict_view *su_cs_dict_view_begin( + struct su_cs_dict_view *self){ + ASSERT(self); + return su__cs_dict_view_move(self, su__CS_DICT_VIEW_MOVE_BEGIN); +} +INLINE boole su_cs_dict_view_has_next(struct su_cs_dict_view const *self){ + ASSERT(self); + ASSERT_RET(su_cs_dict_view_is_valid(self), FAL0); + return (su__cs_dict_view_move(C(struct su_cs_dict_view*,self), + su__CS_DICT_VIEW_MOVE_HAS_NEXT)->csdv_next_node != NIL); +} +INLINE struct su_cs_dict_view *su_cs_dict_view_next( + struct su_cs_dict_view *self){ + ASSERT(self); + ASSERT_RET(su_cs_dict_view_is_valid(self), self); + return su__cs_dict_view_move(self, su__CS_DICT_VIEW_MOVE_NEXT); +} +EXPORT boole su_cs_dict_view_find(struct su_cs_dict_view *self, + char const *key); +INLINE s32 su_cs_dict_view_reset_insert(struct su_cs_dict_view *self, + char const *key, void *value){ + ASSERT(self); + ASSERT_RET(key != NIL, 0); + return su__cs_dict_insrep(self->csdv_parent, key, value, FAL0 | R(up,self)); +} +INLINE s32 su_cs_dict_view_reset_replace(struct su_cs_dict_view *self, + char const *key, void *value){ + ASSERT(self); + ASSERT_RET(key != NIL, 0); + return su__cs_dict_insrep(self->csdv_parent, key, value, TRU1 | R(up,self)); +} +EXPORT struct su_cs_dict_view *su_cs_dict_view_remove( + struct su_cs_dict_view *self); +INLINE sz su_cs_dict_view_cmp(struct su_cs_dict_view const *self, + struct su_cs_dict_view const *t){ + ASSERT_RET(self, -(t != NIL)); + ASSERT_RET(t, 1); + return (self->csdv_node == t->csdv_node); +} +C_DECL_END +#include +#endif /* su_CS_DICT_H */ +/* s-it-mode */ diff --git a/include/su/cs.h b/include/su/cs.h dissimilarity index 71% index 47800ed3..d14a078b 100644 --- a/include/su/cs.h +++ b/include/su/cs.h @@ -1,493 +1,118 @@ -/*@ Anything (locale agnostic: ASCII only) around char and char*. - * - * Copyright (c) 2001 - 2020 Steffen (Daode) Nurpmeso . - * SPDX-License-Identifier: ISC - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, 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. - */ -#ifndef su_CS_H -#define su_CS_H - -/*! - * \file - * \ingroup CS - * \brief \r{CS} tools and heap - */ - -#include - -#define su_HEADER -#include -C_DECL_BEGIN - -/*! - * \defgroup CS Byte character data - * \ingroup TEXT - * \brief Byte character data, locale agnostic: ASCII only (\r{su/cs.h}) - * - * Oh, the vivid part this is! - * @{ - */ - -/*! \_ */ -enum su_cs_ctype{ - su_CS_CTYPE_NONE, /*!< \_ */ - su_CS_CTYPE_ALNUM = 1u<<0, /*!< \_ */ - su_CS_CTYPE_ALPHA = 1u<<1, /*!< \_ */ - su_CS_CTYPE_BLANK = 1u<<2, /*!< \_ */ - su_CS_CTYPE_CNTRL = 1u<<3, /*!< \_ */ - su_CS_CTYPE_DIGIT = 1u<<4, /*!< \_ */ - su_CS_CTYPE_GRAPH = 1u<<5, /*!< \_ */ - su_CS_CTYPE_LOWER = 1u<<6, /*!< \_ */ - su_CS_CTYPE_PRINT = 1u<<7, /*!< \_ */ - su_CS_CTYPE_PUNCT = 1u<<8, /*!< \_ */ - su_CS_CTYPE_SPACE = 1u<<9, /*!< \_ */ - su_CS_CTYPE_UPPER = 1u<<10, /*!< \_ */ - su_CS_CTYPE_WHITE = 1u<<11, /*!< SPACE, HT or LF */ - su_CS_CTYPE_XDIGIT = 1u<<12, /*!< \_ */ - - su__CS_CTYPE_MAXSHIFT = 13u, - su__CS_CTYPE_MASK = (1u< -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_A_T_T_DECL_ONLY -# include - -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class cs; - -/*! - * \ingroup CS - * C++ variant of \r{CS} (\r{su/cs.h}) - */ -class EXPORT cs{ -public: - /*! \copydoc{su_cs_ctype} */ - enum ctype{ - /*! \copydoc{su_CS_CTYPE_NONE} */ - ctype_none = su_CS_CTYPE_NONE, - /*! \copydoc{su_CS_CTYPE_ALNUM} */ - ctype_alnum = su_CS_CTYPE_ALNUM, - /*! \copydoc{su_CS_CTYPE_ALPHA} */ - ctype_alpha = su_CS_CTYPE_ALPHA, - /*! \copydoc{su_CS_CTYPE_BLANK} */ - ctype_blank = su_CS_CTYPE_BLANK, - /*! \copydoc{su_CS_CTYPE_CNTRL} */ - ctype_cntrl = su_CS_CTYPE_CNTRL, - /*! \copydoc{su_CS_CTYPE_DIGIT} */ - ctype_digit = su_CS_CTYPE_DIGIT, - /*! \copydoc{su_CS_CTYPE_GRAPH} */ - ctype_graph = su_CS_CTYPE_GRAPH, - /*! \copydoc{su_CS_CTYPE_LOWER} */ - ctype_lower = su_CS_CTYPE_LOWER, - /*! \copydoc{su_CS_CTYPE_PRINT} */ - ctype_print = su_CS_CTYPE_PRINT, - /*! \copydoc{su_CS_CTYPE_PUNCT} */ - ctype_punct = su_CS_CTYPE_PUNCT, - /*! \copydoc{su_CS_CTYPE_SPACE} */ - ctype_space = su_CS_CTYPE_SPACE, - /*! \copydoc{su_CS_CTYPE_UPPER} */ - ctype_upper = su_CS_CTYPE_UPPER, - /*! \copydoc{su_CS_CTYPE_WHITE} */ - ctype_white = su_CS_CTYPE_WHITE, - /*! \copydoc{su_CS_CTYPE_XDIGIT} */ - ctype_xdigit = su_CS_CTYPE_XDIGIT - }; - - /*! \copydoc{su_cs_toolbox} */ - static NSPC(su)type_toolbox const * const type_toolbox; - /*! \copydoc{su_cs_toolbox} */ - static NSPC(su)type_toolbox const * const const_type_toolbox; - - /*! \copydoc{su_cs_toolbox_case} */ - static NSPC(su)type_toolbox const * const type_toolbox_case; - /*! \copydoc{su_cs_toolbox_case} */ - static NSPC(su)type_toolbox const * const - const_type_toolbox_case; - - /*! \copydoc{su_cs_is_ascii()} */ - static boole is_ascii(s32 x) {return su_cs_is_ascii(x);} - - /*! \copydoc{su_cs_is_alnum()} */ - static boole is_alnum(s32 x) {return su_cs_is_alnum(x);} - - /*! \copydoc{su_cs_is_alpha()} */ - static boole is_alpha(s32 x) {return su_cs_is_alpha(x);} - - /*! \copydoc{su_cs_is_blank()} */ - static boole is_blank(s32 x) {return su_cs_is_blank(x);} - - /*! \copydoc{su_cs_is_cntrl()} */ - static boole is_cntrl(s32 x) {return su_cs_is_cntrl(x);} - - /*! \copydoc{su_cs_is_digit()} */ - static boole is_digit(s32 x) {return su_cs_is_digit(x);} - - /*! \copydoc{su_cs_is_graph()} */ - static boole is_graph(s32 x) {return su_cs_is_graph(x);} - - /*! \copydoc{su_cs_is_lower()} */ - static boole is_lower(s32 x) {return su_cs_is_lower(x);} - - /*! \copydoc{su_cs_is_print()} */ - static boole is_print(s32 x) {return su_cs_is_print(x);} - - /*! \copydoc{su_cs_is_punct()} */ - static boole is_punct(s32 x) {return su_cs_is_punct(x);} - - /*! \copydoc{su_cs_is_space()} */ - static boole is_space(s32 x) {return su_cs_is_space(x);} - - /*! \copydoc{su_cs_is_upper()} */ - static boole is_upper(s32 x) {return su_cs_is_upper(x);} - - /*! \copydoc{su_cs_is_white()} */ - static boole is_white(s32 x) {return su_cs_is_white(x);} - - /*! \copydoc{su_cs_is_xdigit()} */ - static boole is_xdigit(s32 x) {return su_cs_is_xdigit(x);} - - /*! \copydoc{su_cs_is_ctype()} */ - static boole is_ctype(s32 x, u32 ct) {return su_cs_is_ctype(x, ct);} - - /*! \copydoc{su_cs_cmp()} */ - static sz cmp(char const *cp1, char const *cp2){ - return su_cs_cmp(cp1, cp2); - } - - /*! \copydoc{su_cs_cmp_n()} */ - static sz cmp(char const *cp1, char const *cp2, uz n){ - return su_cs_cmp_n(cp1, cp2, n); - } - - /*! \copydoc{su_cs_cmp_case()} */ - static sz cmp_case(char const *cp1, char const *cp2){ - return su_cs_cmp_case(cp1, cp2); - } - - /*! \copydoc{su_cs_cmp_case_n()} */ - static sz cmp_case(char const *cp1, char const *cp2, uz n){ - return su_cs_cmp_case_n(cp1, cp2, n); - } - - /*! \copydoc{su_cs_copy_n()} */ - static char *copy(char *dst, char const *src, uz n){ - return su_cs_copy_n(dst, src, n); - } - - /*! \copydoc{su_cs_dup_cbuf()} */ - static char *dup(char const *buf, uz len, u32 estate=state::none){ - return su_cs_dup_cbuf(buf, len, estate); - } - - /*! \copydoc{su_cs_dup()} */ - static char *dup(char const *cp, u32 estate=state::none){ - return su_cs_dup(cp, estate); - } - - /*! \copydoc{su_cs_find()} */ - static char *find(char const *cp, char const *x) {return su_cs_find(cp, x);} - - /*! \copydoc{su_cs_find_c()} */ - static char *find(char const *cp, char x) {return su_cs_find_c(cp, x);} - - /*! \copydoc{su_cs_hash_cbuf()} */ - static uz hash(char const *buf, uz len) {return su_cs_hash_cbuf(buf, len);} - - /*! \copydoc{su_cs_hash()} */ - static uz hash(char const *cp) {return su_cs_hash(cp);} - - /*! \copydoc{su_cs_hash_case_cbuf()} */ - static uz hash_case(char const *buf, uz len){ - return su_cs_hash_case_cbuf(buf, len); - } - - /*! \copydoc{su_cs_hash_case()} */ - static uz hash_case(char const *cp) {return su_cs_hash_case(cp);} - - /*! \copydoc{su_cs_len()} */ - static uz len(char const *cp) {return su_cs_len(cp);} - - /*! \copydoc{su_cs_pcopy()} */ - static char *pcopy(char *dst, char const *src){ - return su_cs_pcopy(dst, src); - } - - /*! \copydoc{su_cs_pcopy_n()} */ - static char *pcopy(char *dst, char const *src, uz n){ - return su_cs_pcopy_n(dst, src, n); - } - - /*! \copydoc{su_cs_rfind_c()} */ - static char *rfind(char const *cp, char x) {return su_cs_rfind_c(cp, x);} - - /*! \copydoc{su_cs_sep_c()} */ - static char *sep(char **iolist, char sep, boole ignore_empty){ - return su_cs_sep_c(iolist, sep, ignore_empty); - } - - /*! \copydoc{su_cs_sep_escable_c()} */ - static char *sep_escable(char **iolist, char sep, boole ignore_empty){ - return su_cs_sep_escable_c(iolist, sep, ignore_empty); - } - - /*! \copydoc{su_cs_starts_with()} */ - static boole starts_with(char const *cp, char const *x){ - return su_cs_starts_with(cp, x); - } - - /*! \copydoc{su_cs_to_lower()} */ - static s32 to_lower(s32 c) {return su_cs_to_lower(c);} - - /*! \copydoc{su_cs_to_upper()} */ - static s32 to_upper(s32 c) {return su_cs_to_upper(c);} -}; - -/*! - * \ingroup CS - * \r{auto_type_toolbox} specialization (also \r{cs::toolbox}; \r{su/cs.h}) - */ -template<> -class auto_type_toolbox{ -public: - /*! \_ */ - static type_toolbox const *get_instance(void){ - return cs::type_toolbox; - } -}; - -/*! - * \ingroup CS - * \r{auto_type_toolbox} specialization (also \r{cs::toolbox}; \r{su/cs.h}) - */ -template<> -class auto_type_toolbox{ -public: - /*! \_ */ - static type_toolbox const *get_instance(void){ - return cs::const_type_toolbox; - } -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ -#endif /* su_CS_H */ -/* s-it-mode */ +/*@ Anything (locale agnostic: ASCII only) around char and char*. + * + * Copyright (c) 2001 - 2020 Steffen (Daode) Nurpmeso . + * SPDX-License-Identifier: ISC + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, 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. + */ +#ifndef su_CS_H +#define su_CS_H +#include +#define su_HEADER +#include +C_DECL_BEGIN +enum su_cs_ctype{ + su_CS_CTYPE_NONE, + su_CS_CTYPE_ALNUM = 1u<<0, + su_CS_CTYPE_ALPHA = 1u<<1, + su_CS_CTYPE_BLANK = 1u<<2, + su_CS_CTYPE_CNTRL = 1u<<3, + su_CS_CTYPE_DIGIT = 1u<<4, + su_CS_CTYPE_GRAPH = 1u<<5, + su_CS_CTYPE_LOWER = 1u<<6, + su_CS_CTYPE_PRINT = 1u<<7, + su_CS_CTYPE_PUNCT = 1u<<8, + su_CS_CTYPE_SPACE = 1u<<9, + su_CS_CTYPE_UPPER = 1u<<10, + su_CS_CTYPE_WHITE = 1u<<11, + su_CS_CTYPE_XDIGIT = 1u<<12, + su__CS_CTYPE_MAXSHIFT = 13u, + su__CS_CTYPE_MASK = (1u< +#endif /* su_CS_H */ +/* s-it-mode */ diff --git a/include/su/icodec.h b/include/su/icodec.h dissimilarity index 64% index f96a84db..09dffba9 100644 --- a/include/su/icodec.h +++ b/include/su/icodec.h @@ -1,511 +1,153 @@ -/*@ ATOI and ITOA: simple non-restartable integer conversion. - * - * Copyright (c) 2017 - 2020 Steffen (Daode) Nurpmeso . - * SPDX-License-Identifier: ISC - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, 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. - */ -#ifndef su_ICODEC_H -#define su_ICODEC_H - -/*! - * \file - * \ingroup ICODEC - * \brief \r{ICODEC} - */ - -#include - -#define su_HEADER -#include -C_DECL_BEGIN - -/*! - * \defgroup ICODEC Integer/String conversion - * \ingroup TEXT - * \brief Convert integers from and to strings (\r{su/icodec.h}) - * @{ - */ - -/*! - * \defgroup IDEC Integers from Strings - * \ingroup ICODEC - * \brief Parsing integers out of string buffers (\r{su/icodec.h}) - * @{ - */ - -/*! \_ */ -enum su_idec_mode{ - su_IDEC_MODE_NONE, /*!< \_ */ - /*! Will be used to choose limits, error constants, etc. */ - su_IDEC_MODE_SIGNED_TYPE = 1u<<0, - /*! If a power-of-two is used explicitly, or if a \a{base} of 0 is used - * and a known standard prefix is seen, enforce interpretation as unsigned. - * This only makes a difference in conjunction with - * \r{su_IDEC_MODE_SIGNED_TYPE}. */ - su_IDEC_MODE_POW2BASE_UNSIGNED = 1u<<1, - /*! Relaxed \a{base} 0 convenience: if the input used \c{BASE#number} number - * sign syntax, then the scan will be restarted anew with the base given. - * Like this an UI can be permissive and support \c{s=' -008'; eval 10#$s} - * out of the box (it would require a lot of logic otherwise). */ - su_IDEC_MODE_BASE0_NUMBER_SIGN_RESCAN = 1u<<2, -#if 0 - su_IDEC_MODE_SIGN_FORCE_SIGNED_TYPE = 1u<<2, -#endif - /*! Assume input is an 8-bit integer (limits, saturation, etc.). */ - su_IDEC_MODE_LIMIT_8BIT = 1u<<3, - /*! Assume input is an 16-bit integer (limits, saturation, etc.). */ - su_IDEC_MODE_LIMIT_16BIT = 2u<<3, - /*! Assume input is an 32-bit integer (limits, saturation, etc.). */ - su_IDEC_MODE_LIMIT_32BIT = 3u<<3, - su__IDEC_MODE_LIMIT_MASK = 3u<<3, - /*! Do not treat it as an error if the limit is excessed! - * Like this saturated (and bit-limited) results can be created - * (in that \r{su_IDEC_STATE_EOVERFLOW is suppressed). */ - su_IDEC_MODE_LIMIT_NOERROR = 1u<<5, - /* These bits are duplicated in the _state result bits! */ - su__IDEC_MODE_MASK = (1u<<6) - 1 -}; - -/*! \_ */ -enum su_idec_state{ - su_IDEC_STATE_NONE, /*!< \_*/ - /*! Malformed input, no usable result has been stored. */ - su_IDEC_STATE_EINVAL = 1u<<8, - /*! Bad character according to base, but we have seen some good ones - * before, otherwise \r{su_IDEC_STATE_EINVAL} would have been used. */ - su_IDEC_STATE_EBASE = 2u<<8, - su_IDEC_STATE_EOVERFLOW = 3u<<8, /*!< Result too large. */ - su_IDEC_STATE_EMASK = 3u<<8, /*!< Any errors, that is. */ - su_IDEC_STATE_SEEN_MINUS = 1u<<16, /*!< Seen hyphen-minus in the input? */ - su_IDEC_STATE_CONSUMED = 1u<<17, /*!< All the input has been consumed. */ - su__IDEC_PRIVATE_SHIFT1 = 24u -}; -MCTA(su__IDEC_MODE_MASK <= (1u<<8) - 1, "Shared bit range overlaps") - -/*! Decode \a{clen} (or \r{su_cs_len()} if \r{su_UZ_MAX}) bytes of \a{cbuf} - * into an integer according to the \r{su_idec_mode} \a{idec_mode}, - * store a/the result in \a{*resp} (in the \r{su_IDEC_STATE_EINVAL} case an - * overflow constant is used, for signed types it depends on parse state - * whether MIN/MAX are used), which must point to storage of the correct type, - * return the resulting \r{su_idec_state} (which includes \a{idec_mode}). - * If \a{endptr_or_nil} is will be pointed to the last parsed byte. - * Base auto-detection can be enfored by setting \a{base} to 0. */ -EXPORT u32 su_idec(void *resp, char const *cbuf, uz clen, u8 base, - u32 idec_mode, char const **endptr_or_nil); - -/*! \_ */ -INLINE u32 su_idec_cp(void *resp, char const *cp, u8 base, u32 idec_mode, - char const **endptr_or_nil){ - uz len = UZ_MAX; - ASSERT_EXEC(cp != NIL, len = 0); - return su_idec(resp, cp, len, base, idec_mode, endptr_or_nil); -} - -/*! \_ */ -#define su_idec_u8(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_8BIT), CLP) -/*! \_ */ -#define su_idec_u8_cp(RP,CBP,B,CLP) su_idec_u8(RP,CBP,su_UZ_MAX,B,CLP) - -/*! \_ */ -#define su_idec_s8(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B,\ - (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_8BIT), CLP) -/*! \_ */ -#define su_idec_s8_cp(RP,CBP,B,CLP) su_idec_s8(RP,CBP,su_UZ_MAX,B,CLP) - -/*! \_ */ -#define su_idec_u16(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_16BIT), CLP) -/*! \_ */ -#define su_idec_u16_cp(RP,CBP,B,CLP) su_idec_u16(RP,CBP,su_UZ_MAX,B,CLP) - -/*! \_ */ -#define su_idec_s16(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B,\ - (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_16BIT), CLP) -/*! \_ */ -#define su_idec_s16_cp(RP,CBP,B,CLP) su_idec_s16(RP,CBP,su_UZ_MAX,B,CLP) - -/*! \_ */ -#define su_idec_u32(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_32BIT), CLP) -/*! \_ */ -#define su_idec_u32_cp(RP,CBP,B,CLP) su_idec_u32(RP,CBP,su_UZ_MAX,B,CLP) - -/*! \_ */ -#define su_idec_s32(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B,\ - (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_32BIT), CLP) -/*! \_ */ -#define su_idec_s32_cp(RP,CBP,B,CLP) su_idec_s32(RP,CBP,su_UZ_MAX,B,CLP) - -/*! \_ */ -#define su_idec_u64(RP,CBP,CL,B,CLP) su_idec(RP, CBP, CL, B, 0, CLP) -/*! \_ */ -#define su_idec_u64_cp(RP,CBP,B,CLP) su_idec_u64(RP,CBP,su_UZ_MAX,B,CLP) - -/*! \_ */ -#define su_idec_s64(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B, (su_IDEC_MODE_SIGNED_TYPE), CLP) -/*! \_ */ -#define su_idec_s64_cp(RP,CBP,B,CLP) su_idec_s64(RP,CBP,su_UZ_MAX,B,CLP) - -#if UZ_BITS == 32 - /*! \_ */ -# define su_idec_uz(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_32BIT), CLP) - /*! \_ */ -# define su_idec_sz(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B,\ - (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_32BIT), CLP) -#else -# define su_idec_uz(RP,CBP,CL,B,CLP) su_idec(RP, CBP, CL, B, 0, CLP) -# define su_idec_sz(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B, (su_IDEC_MODE_SIGNED_TYPE), CLP) -#endif -/*! \_ */ -#define su_idec_uz_cp(RP,CBP,B,CLP) su_idec_uz(RP,CBP,su_UZ_MAX,B,CLP) -/*! \_ */ -#define su_idec_sz_cp(RP,CBP,B,CLP) su_idec_sz(RP,CBP,su_UZ_MAX,B,CLP) - -#if UZ_BITS == 32 - /*! \_ */ -# define su_idec_up(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_32BIT), CLP) - /*! \_ */ -# define su_idec_sp(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B,\ - (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_32BIT), CLP) -#else -# define su_idec_up(RP,CBP,CL,B,CLP) su_idec(RP, CBP, CL, B, 0, CLP) -# define su_idec_sp(RP,CBP,CL,B,CLP) \ - su_idec(RP, CBP, CL, B, (su_IDEC_MODE_SIGNED_TYPE), CLP) -#endif -/*! \_ */ -#define su_idec_up_cp(RP,CBP,B,CLP) su_idec_up(RP,CBP,su_UZ_MAX,B,CLP) -/*! \_ */ -#define su_idec_sp_cp(RP,CBP,B,CLP) su_idec_sp(RP,CBP,su_UZ_MAX,B,CLP) - -/*! @} */ -/*! - * \defgroup IENC Integers to Strings - * \ingroup ICODEC - * \brief Creating textual integer representations (\r{su/icodec.h}) - * - * \remarks{The support macros simply cast the type to the given type, - * therefore care for correct signedness extension etc. has to be taken.} - * @{ - */ - -enum{ - /*! Maximum buffer size needed by \r{su_ienc()}, - * including \c{NUL} and base prefixes. */ - su_IENC_BUFFER_SIZE = 80u -}; - -/*! \_ */ -enum su_ienc_mode{ - su_IENC_MODE_NONE, /*!< \_ */ - /*! Whether signedness correction shall be applied. */ - su_IENC_MODE_SIGNED_TYPE = 1u<<1, - /*! Positive nubers shall have a plus-sign \c{+} prefix. */ - su_IENC_MODE_SIGNED_PLUS = 1u<<2, - /*! Positive nubers shall have a space prefix. - * Has a lower priority than \r{su_IENC_MODE_SIGNED_PLUS}. */ - su_IENC_MODE_SIGNED_SPACE = 1u<<3, - /*! No base prefixes shall prepend the number, even if the conversion base - * would normally place one. */ - su_IENC_MODE_NO_PREFIX = 1u<<4, - /*! For bases greater ten (10), use lowercase letters instead of the default - * uppercase. - * This does not cover the base. */ - su_IENC_MODE_LOWERCASE = 1u<<5, - - su__IENC_MODE_SHIFT = 6u, - su__IENC_MODE_MASK = (1u< -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class idec; -class ienc; - -/*! - * \ingroup IDEC - * C++ variant of \r{IDEC} (\r{su/icodec.h}) - */ -class idec{ -public: - /*! \copydoc{su_idec_mode} */ - enum mode{ - /*! \copydoc{su_IDEC_MODE_NONE} */ - mode_none = su_IDEC_MODE_NONE, - /*! \copydoc{su_IDEC_MODE_SIGNED_TYPE} */ - mode_signed_type = su_IDEC_MODE_SIGNED_TYPE, - /*! \copydoc{su_IDEC_MODE_POW2BASE_UNSIGNED} */ - mode_pow2base_unsigned = su_IDEC_MODE_POW2BASE_UNSIGNED, - /*! \copydoc{su_IDEC_MODE_BASE0_NUMBER_SIGN_RESCAN} */ - mode_base0_number_sign_rescan = su_IDEC_MODE_BASE0_NUMBER_SIGN_RESCAN, - /*! \copydoc{su_IDEC_MODE_LIMIT_8BIT} */ - mode_limit_8bit = su_IDEC_MODE_LIMIT_8BIT, - /*! \copydoc{su_IDEC_MODE_LIMIT_16BIT} */ - mode_limit_16bit = su_IDEC_MODE_LIMIT_16BIT, - /*! \copydoc{su_IDEC_MODE_LIMIT_32BIT} */ - mode_limit_32bit = su_IDEC_MODE_LIMIT_32BIT, - /*! \copydoc{su_IDEC_MODE_LIMIT_NOERROR} */ - mode_limit_noerror = su_IDEC_MODE_LIMIT_NOERROR - }; - - /*! \copydoc{su_idec_state} */ - enum state{ - /*! \copydoc{su_IDEC_STATE_NONE} */ - state_none = su_IDEC_STATE_NONE, - /*! \copydoc{su_IDEC_STATE_EINVAL} */ - state_einval = su_IDEC_STATE_EINVAL, - /*! \copydoc{su_IDEC_STATE_EBASE} */ - state_ebase = su_IDEC_STATE_EBASE, - /*! \copydoc{su_IDEC_STATE_EOVERFLOW} */ - state_eoverflow = su_IDEC_STATE_EOVERFLOW, - /*! \copydoc{su_IDEC_STATE_EMASK} */ - state_emask = su_IDEC_STATE_EMASK, - /*! \copydoc{su_IDEC_STATE_SEEN_MINUS} */ - state_seen_minus = su_IDEC_STATE_SEEN_MINUS, - /*! \copydoc{su_IDEC_STATE_CONSUMED} */ - state_consumed = su_IDEC_STATE_CONSUMED - }; - - /*! \copydoc{su_idec()} */ - static u32 convert(void *resp, char const *cbuf, uz clen, u8 base, u32 mode, - char const **endptr_or_nil=NIL){ - return su_idec(resp, cbuf, clen, base, mode, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(void *resp, char const *cbuf, u8 base, u32 mode, - char const **endptr_or_nil=NIL){ - return su_idec_cp(resp, cbuf, base, mode, endptr_or_nil); - } - - /*! \r{su_idec()} */ - static u32 convert(u8 &resr, char const *cbuf, uz clen, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_u8(&resr, cbuf, clen, base, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(u8 &resr, char const *cbuf, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_u8_cp(&resr, cbuf, base, endptr_or_nil); - } - - /*! \r{su_idec()} */ - static u32 convert(s8 &resr, char const *cbuf, uz clen, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_s8(&resr, cbuf, clen, base, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(s8 &resr, char const *cbuf, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_s8_cp(&resr, cbuf, base, endptr_or_nil); - } - - /*! \r{su_idec()} */ - static u32 convert(u16 &resr, char const *cbuf, uz clen, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_u16(&resr, cbuf, clen, base, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(u16 &resr, char const *cbuf, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_u16_cp(&resr, cbuf, base, endptr_or_nil); - } - - /*! \r{su_idec()} */ - static u32 convert(s16 &resr, char const *cbuf, uz clen, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_s16(&resr, cbuf, clen, base, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(s16 &resr, char const *cbuf, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_s16_cp(&resr, cbuf, base, endptr_or_nil); - } - - /*! \r{su_idec()} */ - static u32 convert(u32 &resr, char const *cbuf, uz clen, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_u32(&resr, cbuf, clen, base, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(u32 &resr, char const *cbuf, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_u32_cp(&resr, cbuf, base, endptr_or_nil); - } - - /*! \r{su_idec()} */ - static u32 convert(s32 &resr, char const *cbuf, uz clen, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_s32(&resr, cbuf, clen, base, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(s32 &resr, char const *cbuf, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_s32_cp(&resr, cbuf, base, endptr_or_nil); - } - - /*! \r{su_idec()} */ - static u32 convert(u64 &resr, char const *cbuf, uz clen, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_u64(&resr, cbuf, clen, base, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(u64 &resr, char const *cbuf, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_u64_cp(&resr, cbuf, base, endptr_or_nil); - } - - /*! \r{su_idec()} */ - static u32 convert(s64 &resr, char const *cbuf, uz clen, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_s64(&resr, cbuf, clen, base, endptr_or_nil); - } - /*! \r{su_idec()} */ - static u32 convert(s64 &resr, char const *cbuf, u8 base, - char const **endptr_or_nil=NIL){ - return su_idec_s64_cp(&resr, cbuf, base, endptr_or_nil); - } -}; - -/*! - * \ingroup IENC - * C++ variant of \r{IENC} (\r{su/icodec.h}) - */ -class ienc{ -public: - enum{ - /*! \copydoc{su_IENC_BUFFER_SIZE} */ - buffer_size = su_IENC_BUFFER_SIZE - }; - - /*! \copydoc{su_ienc_mode} */ - enum mode{ - /*! \copydoc{su_IENC_MODE_NONE} */ - mode_none = su_IENC_MODE_NONE, - /*! \copydoc{su_IENC_MODE_SIGNED_TYPE} */ - mode_signed_type = su_IENC_MODE_SIGNED_TYPE, - /*! \copydoc{su_IENC_MODE_SIGNED_PLUS} */ - mode_signed_plus = su_IENC_MODE_SIGNED_PLUS, - /*! \copydoc{su_IENC_MODE_SIGNED_SPACE} */ - mode_signed_space = su_IENC_MODE_SIGNED_SPACE, - /*! \copydoc{su_IENC_MODE_NO_PREFIX} */ - mode_no_prefix = su_IENC_MODE_NO_PREFIX, - /*! \copydoc{su_IENC_MODE_LOWERCASE} */ - mode_lowercase = su_IENC_MODE_LOWERCASE - }; - - /*! \copydoc{su_ienc()} */ - static char *convert(char *cbuf, u64 value, u8 base=10, u32 mode=mode_none){ - return su_ienc(cbuf, value, base, mode); - } - /*! \r{su_ienc()} */ - static char *convert(char *cbuf, s64 value, u8 base=10, u32 mode=mode_none){ - return su_ienc(cbuf, value, base, mode); - } - - /*! \r{su_ienc()} */ - static char *convert(char *cbuf, u32 value, u8 base=10, u32 mode=mode_none){ - return su_ienc(cbuf, value, base, mode); - } - /*! \r{su_ienc()} */ - static char *convert(char *cbuf, s32 value, u8 base=10, u32 mode=mode_none){ - return su_ienc(cbuf, value, base, mode); - } - - /*! \r{su_ienc()} */ - static char *convert(char *cbuf, u16 value, u8 base=10, u32 mode=mode_none){ - return su_ienc(cbuf, value, base, mode); - } - /*! \r{su_ienc()} */ - static char *convert(char *cbuf, s16 value, u8 base=10, u32 mode=mode_none){ - return su_ienc(cbuf, value, base, mode); - } - - /*! \r{su_ienc()} */ - static char *convert(char *cbuf, u8 value, u8 base=10, u32 mode=mode_none){ - return su_ienc(cbuf, value, base, mode); - } - /*! \r{su_ienc()} */ - static char *convert(char *cbuf, s8 value, u8 base=10, u32 mode=mode_none){ - return su_ienc(cbuf, value, base, mode); - } -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ -#endif /* su_ICODEC_H */ -/* s-it-mode */ +/*@ ATOI and ITOA: simple non-restartable integer conversion. + * + * Copyright (c) 2017 - 2020 Steffen (Daode) Nurpmeso . + * SPDX-License-Identifier: ISC + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, 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. + */ +#ifndef su_ICODEC_H +#define su_ICODEC_H +#include +#define su_HEADER +#include +C_DECL_BEGIN +enum su_idec_mode{ + su_IDEC_MODE_NONE, + su_IDEC_MODE_SIGNED_TYPE = 1u<<0, + su_IDEC_MODE_POW2BASE_UNSIGNED = 1u<<1, + su_IDEC_MODE_BASE0_NUMBER_SIGN_RESCAN = 1u<<2, +#if 0 + su_IDEC_MODE_SIGN_FORCE_SIGNED_TYPE = 1u<<2, +#endif + su_IDEC_MODE_LIMIT_8BIT = 1u<<3, + su_IDEC_MODE_LIMIT_16BIT = 2u<<3, + su_IDEC_MODE_LIMIT_32BIT = 3u<<3, + su__IDEC_MODE_LIMIT_MASK = 3u<<3, + su_IDEC_MODE_LIMIT_NOERROR = 1u<<5, + /* These bits are duplicated in the _state result bits! */ + su__IDEC_MODE_MASK = (1u<<6) - 1 +}; +enum su_idec_state{ + su_IDEC_STATE_NONE, + su_IDEC_STATE_EINVAL = 1u<<8, + su_IDEC_STATE_EBASE = 2u<<8, + su_IDEC_STATE_EOVERFLOW = 3u<<8, + su_IDEC_STATE_EMASK = 3u<<8, + su_IDEC_STATE_SEEN_MINUS = 1u<<16, + su_IDEC_STATE_CONSUMED = 1u<<17, + su__IDEC_PRIVATE_SHIFT1 = 24u +}; +MCTA(su__IDEC_MODE_MASK <= (1u<<8) - 1, "Shared bit range overlaps") +EXPORT u32 su_idec(void *resp, char const *cbuf, uz clen, u8 base, + u32 idec_mode, char const **endptr_or_nil); +INLINE u32 su_idec_cp(void *resp, char const *cp, u8 base, u32 idec_mode, + char const **endptr_or_nil){ + uz len = UZ_MAX; + ASSERT_EXEC(cp != NIL, len = 0); + return su_idec(resp, cp, len, base, idec_mode, endptr_or_nil); +} +#define su_idec_u8(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_8BIT), CLP) +#define su_idec_u8_cp(RP,CBP,B,CLP) su_idec_u8(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_s8(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B,\ + (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_8BIT), CLP) +#define su_idec_s8_cp(RP,CBP,B,CLP) su_idec_s8(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_u16(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_16BIT), CLP) +#define su_idec_u16_cp(RP,CBP,B,CLP) su_idec_u16(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_s16(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B,\ + (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_16BIT), CLP) +#define su_idec_s16_cp(RP,CBP,B,CLP) su_idec_s16(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_u32(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_32BIT), CLP) +#define su_idec_u32_cp(RP,CBP,B,CLP) su_idec_u32(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_s32(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B,\ + (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_32BIT), CLP) +#define su_idec_s32_cp(RP,CBP,B,CLP) su_idec_s32(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_u64(RP,CBP,CL,B,CLP) su_idec(RP, CBP, CL, B, 0, CLP) +#define su_idec_u64_cp(RP,CBP,B,CLP) su_idec_u64(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_s64(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B, (su_IDEC_MODE_SIGNED_TYPE), CLP) +#define su_idec_s64_cp(RP,CBP,B,CLP) su_idec_s64(RP,CBP,su_UZ_MAX,B,CLP) +#if UZ_BITS == 32 +# define su_idec_uz(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_32BIT), CLP) +# define su_idec_sz(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B,\ + (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_32BIT), CLP) +#else +# define su_idec_uz(RP,CBP,CL,B,CLP) su_idec(RP, CBP, CL, B, 0, CLP) +# define su_idec_sz(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B, (su_IDEC_MODE_SIGNED_TYPE), CLP) +#endif +#define su_idec_uz_cp(RP,CBP,B,CLP) su_idec_uz(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_sz_cp(RP,CBP,B,CLP) su_idec_sz(RP,CBP,su_UZ_MAX,B,CLP) +#if UZ_BITS == 32 +# define su_idec_up(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B, (su_IDEC_MODE_LIMIT_32BIT), CLP) +# define su_idec_sp(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B,\ + (su_IDEC_MODE_SIGNED_TYPE | su_IDEC_MODE_LIMIT_32BIT), CLP) +#else +# define su_idec_up(RP,CBP,CL,B,CLP) su_idec(RP, CBP, CL, B, 0, CLP) +# define su_idec_sp(RP,CBP,CL,B,CLP) \ + su_idec(RP, CBP, CL, B, (su_IDEC_MODE_SIGNED_TYPE), CLP) +#endif +#define su_idec_up_cp(RP,CBP,B,CLP) su_idec_up(RP,CBP,su_UZ_MAX,B,CLP) +#define su_idec_sp_cp(RP,CBP,B,CLP) su_idec_sp(RP,CBP,su_UZ_MAX,B,CLP) +enum{ + su_IENC_BUFFER_SIZE = 80u +}; +enum su_ienc_mode{ + su_IENC_MODE_NONE, + su_IENC_MODE_SIGNED_TYPE = 1u<<1, + su_IENC_MODE_SIGNED_PLUS = 1u<<2, + su_IENC_MODE_SIGNED_SPACE = 1u<<3, + su_IENC_MODE_NO_PREFIX = 1u<<4, + su_IENC_MODE_LOWERCASE = 1u<<5, + su__IENC_MODE_SHIFT = 6u, + su__IENC_MODE_MASK = (1u< +#endif /* su_ICODEC_H */ +/* s-it-mode */ diff --git a/include/su/mem-bag.h b/include/su/mem-bag.h index 76949f4c..22a916fa 100644 --- a/include/su/mem-bag.h +++ b/include/su/mem-bag.h @@ -19,86 +19,28 @@ */ #ifndef su_MEM_BAG_H #define su_MEM_BAG_H - -/*! - * \file - * \ingroup MEM - * \brief \r{MEM_BAG}: objects to pool allocations - */ - #include - #if defined su_HAVE_MEM_BAG_AUTO || defined su_HAVE_MEM_BAG_LOFI - /*! - * \ingroup MEM_BAG - * Defined if memory bags are available. - * They are if just any memory allocation type is supported. - */ # define su_HAVE_MEM_BAG #endif #ifdef su_HAVE_MEM_BAG - #define su_HEADER #include C_DECL_BEGIN - struct su_mem_bag; - -/*! - * \defgroup MEM_BAG Memory bags - * \ingroup MEM - * \brief \r{MEM} objects to pool allocations (\r{su/mem-bag.h}) - * - * Memory bags introduce possibilities to bundle heap memory with a job, - * and to throw away the bag(s) as such after the job is done. - * They are a more generalized successor of the string allocator that - * Kurt Shoens developed for BSD Mail in the 70s. - * As such, neither constructors nor destructors are supported. - * - * Dependent upon compile-time options bags offer the auto-reclaimed string - * memory allocator (with \r{su_HAVE_MEM_BAG_AUTO}), - * and/or a replacement for \c{alloca(3)} (\r{su_HAVE_MEM_BAG_LOFI}: a stack of - * last-out, first-in memory storage). - * In general the memory served is \r{su_Z_ALIGN()} aligned. - * Allocation requests larger than about \r{su_S32_MAX} result in - * \r{su_STATE_ERR_OVERFLOW} errors. - * - * The bag(s) form(s) a stack which can be \r{su_mem_bag_push()}ed and - * \r{su_mem_bag_pop()}ped. - * One only works with the outermost object, it will internally choose the - * \r{su_mem_bag_top()} automatically. - * - * By defining \c{su_MEM_BAG_SELF} a more convenient preprocessor based - * interface is available, just as for the \r{MEM_CACHE_ALLOC} interface. - * This is not furtherly documented, though. - * - * If any of \r{su_HAVE_DEBUG} or \r{su_HAVE_MEM_CANARIES_DISABLE} is defined - * then these objects only manage the chunks, the user chunk memory itself - * will be served by the normal \r{MEM_CACHE_ALLOC} allocator instead, to - * allow neatless integration within address sanitizers etc. - * @{ - */ - #ifdef su_USECASE_MX # define su_MEM_BAG_SELF (n_go_data->gdc_membag) #endif - -/*! Mirrors a subset of the \r{su_mem_alloc_flags}. *//* Equality CTAsserted */ +/* Equality CTAsserted */ enum su_mem_bag_alloc_flags{ - su_MEM_BAG_ALLOC_NONE, /*!< \_ */ - su_MEM_BAG_ALLOC_CLEAR = 1u<<1, /*!< Zero memory. */ - /*! An alias (i.e., same value) for \r{su_STATE_ERR_OVERFLOW}. */ + su_MEM_BAG_ALLOC_NONE, + su_MEM_BAG_ALLOC_CLEAR = 1u<<1, su_MEM_BAG_ALLOC_OVERFLOW_OK = su_STATE_ERR_OVERFLOW, - /*! An alias (i.e., same value) for \r{su_STATE_ERR_NOMEM}. */ su_MEM_BAG_ALLOC_NOMEM_OK = su_STATE_ERR_NOMEM, - /*! An alias (i.e., same value) for \r{su_STATE_ERR_PASS}. */ su_MEM_BAG_ALLOC_MAYFAIL = su_STATE_ERR_PASS, - /*! An alias (i.e., same value) for \r{su_STATE_ERR_NOPASS}. */ su_MEM_BAG_ALLOC_MUSTFAIL = su_STATE_ERR_NOPASS, su__MEM_BAG_ALLOC_USER_MASK = 0xFF | su_STATE_ERR_MASK }; - -/*! \_ */ struct su_mem_bag{ struct su_mem_bag *mb_top; /* Stacktop (outermost object only) */ struct su_mem_bag *mb_outer; /* Outer object in stack */ @@ -116,59 +58,14 @@ struct su_mem_bag{ struct su__mem_bag_lofi_chunk *mb_lofi_top; #endif }; - -/*! \a{bsz} is a buffer size hint used to space memory chunk pool buffers, - * which thus also defines the maximum size of chunks which are served (less - * some internal management overhead). - * If \a{bsz} is 0 then two pages (\r{su_PAGE_SIZE}) are used (to accommodate - * the use case of page allocations), otherwise it is cramped to some internal - * limits (currently 1 KB / 10 MB). - * - * Memory bags can serve chunks larger than what pools can handle, but these - * need special treatment, and thus counteract the idea of a pool: their - * occurrence is logged with \r{su_HAVE_DEBUG}. */ EXPORT struct su_mem_bag *su_mem_bag_create(struct su_mem_bag *self, uz bsz); - -/*! If \SELF owns a stack of bags as created via \r{su_mem_bag_push()}, all - * entries of the stack will be forcefully popped and destructed; - * presence of a stack is a \r{su_HAVE_DEBUG} log condition. */ EXPORT void su_mem_bag_gut(struct su_mem_bag *self); - -/*! Fixate the current snapshot of auto-reclaimed and flux storage of \SELF: - * earlier allocations will be persistent, only later ones will be covered by - * \r{su_mem_bag_reset()}. - * \remarks{Only to be called once per object.} - * \remarks{Only applies to \SELF or its current \r{su_mem_bag_top()}, if there - * is one, does not propagate through the stack.} */ EXPORT struct su_mem_bag *su_mem_bag_fixate(struct su_mem_bag *self); - -/*! To be called from the (main)loops upon tick and break-off time to perform - * debug checking and memory cleanup. - * If \SELF owns a stack of \r{su_mem_bag_push()}ed objects, these will be - * forcefully destructed. - * The cleanup will release all LOFI memory, drop all the relaxation created by - * \r{su_mem_bag_auto_relax_create()} and all auto-reclaimed and flux storage - * that is not covered by r{su_mem_bag_fixate()}. - * \remarks{Possible \r{su_HAVE_DEBUG} logs via \r{su_LOG_DEBUG}.} */ EXPORT struct su_mem_bag *su_mem_bag_reset(struct su_mem_bag *self); - -/*! Push the initialized bag \a{that_one} onto the bag stack layer of \SELF. - * \a{that_one} will be used to serve memory until \r{su_mem_bag_pop()} is - * called, which implicitly happens during \r{su_mem_bag_reset()}. - * It is possible to push and thus pop a bag twice: this is sometimes - * handy to store memory persistantly in some outer stack level. */ EXPORT struct su_mem_bag *su_mem_bag_push(struct su_mem_bag *self, struct su_mem_bag *that_one); - -/*! Pop the \r{su_mem_bag_push()}ed bag \a{that_one} off the stack. - * If \a{that_one} is not top of the stack, all bags from top down to - * \a{that_one} will be popped in one go. - * Popping a stack does not reset its allocations. */ EXPORT struct su_mem_bag *su_mem_bag_pop(struct su_mem_bag *self, struct su_mem_bag *that_one); - -/*! Get the bag that currently serves on the stack top. - * Returns \SELF if there is no stack. */ INLINE struct su_mem_bag *su_mem_bag_top(struct su_mem_bag *self){ ASSERT_RET(self != NIL, NIL); #if ASSERT_INJOR(1, 0) @@ -181,50 +78,26 @@ INLINE struct su_mem_bag *su_mem_bag_top(struct su_mem_bag *self){ #endif return (self->mb_top != NIL) ? self->mb_top : self; } - /* * Allocation interface: auto */ - #ifdef su_HAVE_MEM_BAG_AUTO -/*! Lower memory pressure on auto-reclaimed storage for code which has - * a sinus-curve looking style of memory usage, i.e., peek followed by - * release, like, e.g., doing a task on all messages of a mailbox in order. - * Such code should call \c{relax_create()}, successively call - * \c{relax_unroll()} after a single job has been handled, concluded with - * a final \c{relax_gut()}. - * \remarks{Only applies to \SELF or its current \r{su_mem_bag_top()}, if there - * is one, does not propagate through the stack.} */ EXPORT struct su_mem_bag *su_mem_bag_auto_relax_create( struct su_mem_bag *self); - -/*! See \r{su_mem_bag_auto_relax_create()}. */ EXPORT struct su_mem_bag *su_mem_bag_auto_relax_gut(struct su_mem_bag *self); - -/*! See \r{su_mem_bag_auto_relax_create()}. */ EXPORT struct su_mem_bag *su_mem_bag_auto_relax_unroll( struct su_mem_bag *self); - -/*! This is rather internal, but due to the \r{su_mem_bag_alloc_flags} - * \a{mbaf} maybe handy sometimes. - * Normally to be used through the macro interface. - * Attempts to allocate \r{su_S32_MAX} or more bytes result in overflow errors, - * see \r{su_MEM_BAG_ALLOC_OVERFLOW_OK} and \r{su_MEM_BAG_ALLOC_NOMEM_OK}. */ EXPORT void *su_mem_bag_auto_allocate(struct su_mem_bag *self, uz size, uz no, u32 mbaf su_DBG_LOC_ARGS_DECL); - -/*! \_ */ # define su_MEM_BAG_AUTO_ALLOCATE(BAGP,SZ,NO,F) \ su_mem_bag_auto_allocate(BAGP, SZ, NO, F su_DBG_LOC_ARGS_INJ) # ifdef su_HAVE_DBG_LOC_ARGS # define su_MEM_BAG_AUTO_ALLOCATE_LOC(BAGP,SZ,NO,F,FNAME,LNNO) \ su_mem_bag_auto_allocate(BAGP, SZ, NO, F, FNAME, LNNO) # else - /*! \_ */ # define su_MEM_BAG_AUTO_ALLOCATE_LOC(BAGP,SZ,NO,F,FNAME,LNNO) \ su_mem_bag_auto_allocate(BAGP, SZ, NO, F) # endif - /* The "normal" interface, slim, but su_USECASE_ specific: use _ALLOCATE_ for * other use cases. These set MUSTFAIL and always return a valid pointer. */ # ifdef su_MEM_BAG_SELF @@ -234,40 +107,34 @@ EXPORT void *su_mem_bag_auto_allocate(struct su_mem_bag *self, uz size, uz no, # define su_MEM_BAG_SELF_AUTO_ALLOC_LOC(SZ,FNAME,LNNO) \ su_MEM_BAG_AUTO_ALLOCATE_LOC(su_MEM_BAG_SELF, SZ, 1,\ su_MEM_BAG_ALLOC_MUSTFAIL, FNAME, LNNO) - # define su_MEM_BAG_SELF_AUTO_ALLOC_N(SZ,NO) \ su_MEM_BAG_AUTO_ALLOCATE(su_MEM_BAG_SELF, SZ, NO,\ su_MEM_BAG_ALLOC_MUSTFAIL) # define su_MEM_BAG_SELF_AUTO_ALLOC_N_LOC(SZ,NO,FNAME,LNNO) \ su_MEM_BAG_AUTO_ALLOCATE_LOC(su_MEM_BAG_SELF, SZ, NO,\ su_MEM_BAG_ALLOC_MUSTFAIL, FNAME, LNNO) - # define su_MEM_BAG_SELF_AUTO_CALLOC(SZ) \ su_MEM_BAG_AUTO_ALLOCATE(su_MEM_BAG_SELF, SZ, 1,\ su_MEM_BAG_ALLOC_CLEAR | su_MEM_BAG_ALLOC_MUSTFAIL) # define su_MEM_BAG_SELF_AUTO_CALLOC_LOC(SZ,FNAME,LNNO) \ su_MEM_BAG_AUTO_ALLOCATE_LOC(su_MEM_BAG_SELF, SZ, 1,\ su_MEM_BAG_ALLOC_CLEAR | su_MEM_BAG_ALLOC_MUSTFAIL, FNAME, LNNO) - # define su_MEM_BAG_SELF_AUTO_CALLOC_N(SZ,NO) \ su_MEM_BAG_AUTO_ALLOCATE(su_MEM_BAG_SELF, SZ, NO,\ su_MEM_BAG_ALLOC_CLEAR | su_MEM_BAG_ALLOC_MUSTFAIL) # define su_MEM_BAG_SELF_AUTO_CALLOC_N_LOC(SZ,NO,FNAME,LNNO) \ su_MEM_BAG_AUTO_ALLOCATE_LOC(su_MEM_BAG_SELF, SZ, NO,\ su_MEM_BAG_ALLOC_CLEAR | su_MEM_BAG_ALLOC_MUSTFAIL, FNAME, LNNO) - # define su_MEM_BAG_SELF_AUTO_TALLOC(T,NO) \ su_S(T *,su_MEM_BAG_SELF_AUTO_ALLOC_N(sizeof(T), su_S(su_uz,NO))) # define su_MEM_BAG_SELF_AUTO_TALLOC_LOC(T,NO,FNAME,LNNO) \ su_S(T *,su_MEM_BAG_SELF_AUTO_ALLOC_N_LOC(sizeof(T), su_S(su_uz,NO),\ FNAME, LNNO)) - # define su_MEM_BAG_SELF_AUTO_TCALLOC(T,NO) \ su_S(T *,su_MEM_BAG_SELF_AUTO_CALLOC_N(sizeof(T), su_S(su_uz,NO))) # define su_MEM_BAG_SELF_AUTO_TCALLOC_LOC(T,NO,FNAME,LNNO) \ su_S(T *,su_MEM_BAG_SELF_AUTO_CALLOC_N_LOC(sizeof(T), su_S(su_uz,NO),\ FNAME, LNNO)) - /* (The painful _LOCOR series) */ # ifdef su_HAVE_DBG_LOC_ARGS # define su_MEM_BAG_SELF_AUTO_ALLOC_LOCOR(SZ,ORARGS) \ @@ -298,60 +165,35 @@ EXPORT void *su_mem_bag_auto_allocate(struct su_mem_bag *self, uz size, uz no, # endif /* !su_HAVE_DBG_LOC_ARGS */ # endif /* su_MEM_BAG_SELF */ #endif /* su_HAVE_MEM_BAG_AUTO */ - /* * Allocation interface: lofi */ - #ifdef su_HAVE_MEM_BAG_LOFI -/*! The snapshot can be used in a local context: if taken, many allocations - * can be freed in one go by calling \c{lofi_snap_unroll()}. - * \remarks{Only applies to \SELF or its current \r{su_mem_bag_top()}, if there - * is one, does not propagate through the stack.} */ EXPORT void *su_mem_bag_lofi_snap_create(struct su_mem_bag *self); - -/*! Unroll a taken LOFI snapshot by freeing all its allocations. - * The \a{cookie} is no longer valid after this operation. - * This can only be called on the stack level where the snap has been taken. */ EXPORT struct su_mem_bag *su_mem_bag_lofi_snap_unroll(struct su_mem_bag *self, void *cookie); - -/*! This is rather internal, but due to the \r{su_mem_bag_alloc_flags} - * \a{mbaf} maybe handy sometimes. - * Normally to be used through the macro interface. - * Attempts to allocate \r{su_S32_MAX} or more bytes result in overflow errors, - * see \r{su_MEM_BAG_ALLOC_OVERFLOW_OK} and \r{su_MEM_BAG_ALLOC_NOMEM_OK}. */ EXPORT void *su_mem_bag_lofi_allocate(struct su_mem_bag *self, uz size, uz no, u32 mbaf su_DBG_LOC_ARGS_DECL); - -/*! Free \a{ovp}; \r{su_HAVE_DEBUG} will log if it is not stack top. */ EXPORT struct su_mem_bag *su_mem_bag_lofi_free(struct su_mem_bag *self, void *ovp su_DBG_LOC_ARGS_DECL); - -/*! \_ */ # define su_MEM_BAG_LOFI_ALLOCATE(BAGP,SZ,NO,F) \ su_mem_bag_lofi_allocate(BAGP, SZ, NO, F su_DBG_LOC_ARGS_INJ) # ifdef su_HAVE_DBG_LOC_ARGS # define su_MEM_BAG_LOFI_ALLOCATE_LOC(BAGP,SZ,NO,F,FNAME,LNNO) \ su_mem_bag_lofi_allocate(BAGP, SZ, NO, F, FNAME, LNNO) # else - /*! \_ */ # define su_MEM_BAG_LOFI_ALLOCATE_LOC(BAGP,SZ,NO,F,FNAME,LNNO) \ su_mem_bag_lofi_allocate(BAGP, SZ, NO, F) # endif - -/*! \_ */ # define su_MEM_BAG_LOFI_FREE(BAGP,OVP) \ su_mem_bag_lofi_free(BAGP, OVP su_DBG_LOC_ARGS_INJ) # ifdef su_HAVE_DBG_LOC_ARGS # define su_MEM_BAG_LOFI_FREE_LOC(BAGP,OVP,FNAME,LNNO) \ su_mem_bag_lofi_free(BAGP, OVP, FNAME, LNNO) # else - /*! \_ */ # define su_MEM_BAG_LOFI_FREE_LOC(BAGP,OVP,FNAME,LNNO) \ su_mem_bag_lofi_free(BAGP, OVP) # endif - /* The "normal" interface, slim, but su_USECASE_ specific: use _ALLOCATE_ for * other use cases. These set MUSTFAIL and always return a valid pointer. */ # ifdef su_MEM_BAG_SELF @@ -361,45 +203,38 @@ EXPORT struct su_mem_bag *su_mem_bag_lofi_free(struct su_mem_bag *self, # define su_MEM_BAG_SELF_LOFI_ALLOC_LOC(SZ,FNAME,LNNO) \ su_MEM_BAG_LOFI_ALLOCATE_LOC(su_MEM_BAG_SELF, SZ, 1,\ su_MEM_BAG_ALLOC_MUSTFAIL, FNAME, LNNO) - # define su_MEM_BAG_SELF_LOFI_ALLOC_N(SZ,NO) \ su_MEM_BAG_LOFI_ALLOCATE(su_MEM_BAG_SELF, SZ, NO,\ su_MEM_BAG_ALLOC_MUSTFAIL) # define su_MEM_BAG_SELF_LOFI_ALLOC_N_LOC(SZ,NO,FNAME,LNNO) \ su_MEM_BAG_LOFI_ALLOCATE_LOC(su_MEM_BAG_SELF, SZ, NO,\ su_MEM_BAG_ALLOC_MUSTFAIL, FNAME, LNNO) - # define su_MEM_BAG_SELF_LOFI_CALLOC(SZ) \ su_MEM_BAG_LOFI_ALLOCATE(su_MEM_BAG_SELF, SZ, 1,\ su_MEM_BAG_ALLOC_CLEAR | su_MEM_BAG_ALLOC_MUSTFAIL) # define su_MEM_BAG_SELF_LOFI_CALLOC_LOC(SZ,FNAME,LNNO) \ su_MEM_BAG_LOFI_SELF_ALLOCATE_LOC(su_MEM_BAG_SELF, SZ, 1,\ su_MEM_BAG_ALLOC_CLEAR | su_MEM_BAG_ALLOC_MUSTFAIL, FNAME, LNNO) - # define su_MEM_BAG_SELF_LOFI_CALLOC_N(SZ,NO) \ su_MEM_BAG_LOFI_ALLOCATE(su_MEM_BAG_SELF, SZ, NO,\ su_MEM_BAG_ALLOC_CLEAR | su_MEM_BAG_ALLOC_MUSTFAIL) # define su_MEM_BAG_SELF_LOFI_CALLOC_N_LOC(SZ,NO,FNAME,LNNO) \ su_MEM_BAG_LOFI_ALLOCATE_LOC(su_MEM_BAG_SELF, SZ, NO,\ su_MEM_BAG_ALLOC_CLEAR | su_MEM_BAG_ALLOC_MUSTFAIL, FNAME, LNNO) - # define su_MEM_BAG_SELF_LOFI_TALLOC(T,NO) \ su_S(T *,su_MEM_BAG_SELF_LOFI_ALLOC_N(sizeof(T), su_S(su_uz,NO))) # define su_MEM_BAG_SELF_LOFI_TALLOC_LOC(T,NO,FNAME,LNNO) \ su_S(T *,su_MEM_BAG_SELF_LOFI_ALLOC_N_LOC(sizeof(T), su_S(su_uz,NO),\ FNAME, LNNO)) - # define su_MEM_BAG_SELF_LOFI_TCALLOC(T,NO) \ su_S(T *,su_MEM_BAG_SELF_LOFI_CALLOC_N(sizeof(T), su_S(su_uz,NO)) # define su_MEM_BAG_SELF_LOFI_TCALLOC_LOC(T,NO,FNAME,LNNO) \ su_S(T *,su_MEM_BAG_SELF_LOFI_CALLOC_N_LOC(sizeof(T), su_S(su_uz,NO),\ FNAME, LNNO)) - # define su_MEM_BAG_SELF_LOFI_FREE(OVP) \ su_MEM_BAG_LOFI_FREE(su_MEM_BAG_SELF, OVP) # define su_MEM_BAG_SELF_LOFI_FREE_LOC(OVP,FNAME,LNNO) \ su_MEM_BAG_LOFI_FREE_LOC(su_MEM_BAG_SELF, OVP, FNAME, LNNO) - /* (The painful _LOCOR series) */ # ifdef su_HAVE_DBG_LOC_ARGS # define su_MEM_BAG_SELF_LOFI_ALLOC_LOCOR(SZ,ORARGS) \ @@ -434,113 +269,8 @@ EXPORT struct su_mem_bag *su_mem_bag_lofi_free(struct su_mem_bag *self, # endif /* !su_HAVE_DBG_LOC_ARGS */ # endif /* su_MEM_BAG_SELF */ #endif /* su_HAVE_MEM_BAG_LOFI */ - -/*! @} */ C_DECL_END #include -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class mem_bag; - -/*! - * \ingroup MEM_BAG - * C++ variant of \r{MEM_BAG} (\r{su/mem-bag.h}) - */ -class EXPORT mem_bag : private su_mem_bag{ - su_CLASS_NO_COPY(mem_bag) -public: - /*! \copydoc{su_mem_bag_alloc_flags} */ - enum alloc_flags{ - /*! \copydoc{su_MEM_BAG_ALLOC_NONE} */ - alloc_none = su_MEM_BAG_ALLOC_NONE, - /*! \copydoc{su_MEM_BAG_ALLOC_CLEAR} */ - alloc_clear = su_MEM_BAG_ALLOC_CLEAR, - /*! \copydoc{su_MEM_BAG_ALLOC_OVERFLOW_OK} */ - alloc_overflow_ok = su_MEM_BAG_ALLOC_OVERFLOW_OK, - /*! \copydoc{su_MEM_BAG_ALLOC_NOMEM_OK} */ - alloc_nomem_ok = su_MEM_BAG_ALLOC_NOMEM_OK, - /*! \copydoc{su_MEM_BAG_ALLOC_MAYFAIL} */ - alloc_mayfail = su_MEM_BAG_ALLOC_MAYFAIL, - /*! \copydoc{su_MEM_BAG_ALLOC_MUSTFAIL} */ - alloc_mustfail = su_MEM_BAG_ALLOC_MUSTFAIL - }; - - /*! \copydoc{su_mem_bag_create()} */ - mem_bag(uz bsz=0) {su_mem_bag_create(this, bsz);} - - /*! \copydoc{su_mem_bag_gut()} */ - ~mem_bag(void) {su_mem_bag_gut(this);} - - /*! \copydoc{su_mem_bag_fixate()} */ - mem_bag &fixate(void) {SELFTHIS_RET(su_mem_bag_fixate(this));} - - /*! \copydoc{su_mem_bag_reset()} */ - mem_bag &reset(void) {SELFTHIS_RET(su_mem_bag_reset(this));} - - /*! \copydoc{su_mem_bag_push()} */ - mem_bag &push(mem_bag &that_one){ - SELFTHIS_RET(su_mem_bag_push(this, &that_one)); - } - - /*! \copydoc{su_mem_bag_pop()} */ - mem_bag &pop(mem_bag &that_one){ - SELFTHIS_RET(su_mem_bag_pop(this, &that_one)); - } - - /*! \copydoc{su_mem_bag_top()} */ - mem_bag &top(void){ - return (mb_top != NIL) ? *S(mem_bag*,mb_top) : *this; - } - -#ifdef su_HAVE_MEM_BAG_AUTO - /*! \copydoc{su_mem_bag_auto_relax_create()} */ - mem_bag &auto_relax_create(void){ - SELFTHIS_RET(su_mem_bag_auto_relax_create(this)); - } - - /*! \copydoc{su_mem_bag_auto_relax_gut()} */ - mem_bag &auto_relax_gut(void){ - SELFTHIS_RET(su_mem_bag_auto_relax_gut(this)); - } - - /*! \copydoc{su_mem_bag_auto_relax_unroll()} */ - mem_bag &auto_relax_unroll(void){ - SELFTHIS_RET(su_mem_bag_auto_relax_unroll(this)); - } - - /*! \copydoc{su_mem_bag_auto_allocate()} */ - void *auto_allocate(uz size, uz no=1, u32 af=alloc_none){ - return su_mem_bag_auto_allocate(this, size, no, af su_DBG_LOC_ARGS_INJ); - } -#endif /* su_HAVE_MEM_BAG_AUTO */ - -#ifdef su_HAVE_MEM_BAG_LOFI - /*! \copydoc{su_mem_bag_lofi_snap_create()} */ - void *lofi_snap_create(void) {return su_mem_bag_lofi_snap_create(this);} - - /*! \copydoc{su_mem_bag_lofi_snap_unroll()} */ - mem_bag &lofi_snap_unroll(void *cookie){ - SELFTHIS_RET(su_mem_bag_lofi_snap_unroll(this, cookie)); - } - - /*! \copydoc{su_mem_bag_lofi_allocate()} */ - void *lofi_allocate(uz size, uz no=1, u32 af=alloc_none){ - return su_mem_bag_lofi_allocate(this, size, no, af su_DBG_LOC_ARGS_INJ); - } - - /*! \copydoc{su_mem_bag_lofi_free()} */ - mem_bag &lofi_free(void *ovp){ - SELFTHIS_RET(su_mem_bag_lofi_free(this, ovp su_DBG_LOC_ARGS_INJ)); - } -#endif /* su_HAVE_MEM_BAG_LOFI */ -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ #endif /* su_HAVE_MEM_BAG */ #endif /* !su_MEM_BAG_H */ /* s-it-mode */ diff --git a/include/su/mem.h b/include/su/mem.h index 18c3d0d2..04257679 100644 --- a/include/su/mem.h +++ b/include/su/mem.h @@ -17,115 +17,39 @@ */ #ifndef su_MEM_H #define su_MEM_H - -/*! - * \file - * \ingroup MEM - * \brief \r{MEM} tools and heap - */ - #include - #define su_HEADER #include C_DECL_BEGIN - -/*! - * \defgroup MEM_TOOLS Memory tools - * \ingroup MEM - * \brief \r{MEM} tools like copy (\r{su/mem.h}) - * - * In general argument pointers may be given as \NIL if a length argument - * which covers them is given as 0. - * @{ - */ - /* A memset that is not optimized away */ EXPORT_DATA void * (* volatile su_mem_set_volatile)(void*, int, uz); - -/*! \_ */ EXPORT sz su_mem_cmp(void const *vpa, void const *vpb, uz len); - -/*! \_ */ EXPORT void *su_mem_copy(void *vp, void const *src, uz len); - -/*! \_ */ EXPORT void *su_mem_find(void const *vp, s32 what, uz len); - -/*! \_ */ EXPORT void *su_mem_rfind(void const *vp, s32 what, uz len); - -/*! \_ */ EXPORT void *su_mem_move(void *vp, void const *src, uz len); - -/*! \_ */ EXPORT void *su_mem_set(void *vp, s32 what, uz len); - -/*! @} */ -/*! - * \defgroup MEM_CACHE_ALLOC Heap memory - * \ingroup MEM - * \brief Allocating heap memory (\r{su/mem.h}) - * - * It interacts with \r{su_STATE_ERR_NOMEM} and \r{su_STATE_ERR_OVERFLOW}, - * but also allows per-call failure ignorance. - * - * The \r{su_MEM_ALLOC_DEBUG}-enabled cache surrounds served chunks with - * canaries which will detect write bound violations. - * Also, the enum \r{su_mem_alloc_flags} allows flagging allocation requests - * with three (or four when including "0") different flag marks; - * these will show up in error messages, like allocation check and cache dump - * output, which are also available, then. - * Finally served memory chunks will be initialized with a (non-0) pattern - * when debugging is enabled. - * @{ - */ - #if (defined su_HAVE_DEBUG && !defined su_HAVE_MEM_CANARIES_DISABLE) ||\ defined DOXYGEN - /*! Whether the cache is debug-enabled. - * It is if \r{su_HAVE_DEBUG} is, and \r{su_HAVE_MEM_CANARIES_DISABLE} - * is not defined. */ # define su_MEM_ALLOC_DEBUG #endif - -/*! \_ */ enum su_mem_alloc_flags{ - su_MEM_ALLOC_NONE, /*!< \_ */ - /*! Zero memory. - * \remarks{TODO: until the C++ memory cache is ported this flag will not be - * honoured by reallocation requests.} */ + su_MEM_ALLOC_NONE, su_MEM_ALLOC_CLEAR = 1u<<1, - /*! Perform overflow checks against 32-bit, not \r{su_UZ_MAX}. */ su_MEM_ALLOC_32BIT_OVERFLOW = 1u<<2, - /*! Perform overflow checks against 31-bit, not \r{su_UZ_MAX}. */ su_MEM_ALLOC_31BIT_OVERFLOW = 1u<<3, - /*! An alias (i.e., same value) for \r{su_STATE_ERR_OVERFLOW}. */ su_MEM_ALLOC_OVERFLOW_OK = su_STATE_ERR_OVERFLOW, - /*! An alias (i.e., same value) for \r{su_STATE_ERR_NOMEM}. */ su_MEM_ALLOC_NOMEM_OK = su_STATE_ERR_NOMEM, - /*! An alias (i.e., same value) for \r{su_STATE_ERR_PASS}. */ su_MEM_ALLOC_MAYFAIL = su_STATE_ERR_PASS, - /*! An alias (i.e., same value) for \r{su_STATE_ERR_NOPASS}. */ su_MEM_ALLOC_MUSTFAIL = su_STATE_ERR_NOPASS, - su__MEM_ALLOC_MARK_SHIFT = 16u, - /*! Debug (log etc.) flag mark "no mark", */ su_MEM_ALLOC_MARK_0 = 0u< -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class mem; - -/*! \_ */ -class mem{ -public: - /*! - * \defgroup CXX_MEM_TOOLS C++ memory tools - * \ingroup MEM_TOOLS - * \brief C++ variant of \r{MEM_TOOLS} (\r{su/mem.h}) - * - * In general argument pointers may be given as \NIL if a length argument - * which covers them is given as 0. - * @{ - */ - - /*! \copydoc{su_mem_cmp()} */ - static sz cmp(void const *vpa, void const *vpb, uz len){ - return su_mem_cmp(vpa, vpb, len); - } - - /*! \copydoc{su_mem_copy()} */ - static void *copy(void *vp, void const *src, uz len){ - return su_mem_copy(vp, src, len); - } - - /*! \copydoc{su_mem_find()} */ - static void *find(void const *vp, s32 what, uz len){ - return su_mem_find(vp, what, len); - } - - /*! \copydoc{su_mem_rfind()} */ - static void *rfind(void const *vp, s32 what, uz len){ - return su_mem_rfind(vp, what, len); - } - - /*! \copydoc{su_mem_move()} */ - static void *move(void *vp, void const *src, uz len){ - return su_mem_move(vp, src, len); - } - - /*! \copydoc{su_mem_set()} */ - static void *set(void *vp, s32 what, uz len){ - return su_mem_set(vp, what, len); - } - - /*! \copydoc{su_mem_set_volatile()} */ - static void *set_volatile(void *vp, s32 what, uz len){ - return (*su_mem_set_volatile)(vp, what, len); - } - -public: - /*! @} */ - /*! - * \defgroup CXX_MEM_CACHE_ALLOC C++ heap memory - * \ingroup MEM_CACHE_ALLOC - * \brief C++ variant of \r{MEM_CACHE_ALLOC} (\r{su/mem.h}) - * - * It interacts with \r{state::err_nomem} and \r{state::err_overflow}, - * but also allows per-call failure ignorance. - * \remarks{No mirrors of the C interface macros are available.} - * @{ - */ - - struct johnny; - struct mary; - - /*! \copydoc{su_mem_alloc_flags} */ - enum alloc_flags{ - alloc_none = su_MEM_ALLOC_NONE, /*!< \copydoc{su_MEM_ALLOC_NONE} */ - alloc_clear = su_MEM_ALLOC_CLEAR, /*!< \copydoc{su_MEM_ALLOC_CLEAR} */ - /*! \copydoc{su_MEM_ALLOC_32BIT_OVERFLOW} */ - alloc_32bit_overflow = su_MEM_ALLOC_32BIT_OVERFLOW, - /*! \copydoc{su_MEM_ALLOC_31BIT_OVERFLOW} */ - alloc_31bit_overflow = su_MEM_ALLOC_31BIT_OVERFLOW, - /*! \copydoc{su_MEM_ALLOC_OVERFLOW_OK} */ - alloc_overflow_ok = su_MEM_ALLOC_OVERFLOW_OK, - /*! \copydoc{su_MEM_ALLOC_NOMEM_OK} */ - alloc_nomem_ok = su_MEM_ALLOC_NOMEM_OK, - /*! \copydoc{su_MEM_ALLOC_MAYFAIL} */ - alloc_mayfail = su_MEM_ALLOC_MAYFAIL, - /*! \copydoc{su_MEM_ALLOC_MUSTFAIL} */ - alloc_mustfail = su_MEM_ALLOC_MUSTFAIL, - - alloc_mark_0 = su_MEM_ALLOC_MARK_0, /*!< \copydoc{su_MEM_ALLOC_MARK_0} */ - alloc_mark_1 = su_MEM_ALLOC_MARK_1, /*!< \copydoc{su_MEM_ALLOC_MARK_1} */ - alloc_mark_2 = su_MEM_ALLOC_MARK_2, /*!< \copydoc{su_MEM_ALLOC_MARK_2} */ - alloc_mark_3 = su_MEM_ALLOC_MARK_3 /*!< \copydoc{su_MEM_ALLOC_MARK_3} */ - }; - - enum{ - alloc_min = su_MEM_ALLOC_MIN /*!< \copydoc{su_MEM_ALLOC_MIN} */ - }; - - /*! \copydoc{su_mem_conf_option} */ - enum conf_option{ - conf_debug = su_MEM_CONF_DEBUG, /*!< \copydoc{su_MEM_CONF_DEBUG} */ - /*! \copydoc{su_MEM_CONF_ON_ERROR_EMERG} */ - conf_on_error_emerg = su_MEM_CONF_ON_ERROR_EMERG, - /*! \copydoc{su_MEM_CONF_LINGER_FREE} */ - conf_linger_free = su_MEM_CONF_LINGER_FREE, - /*! \copydoc{su_MEM_CONF_LINGER_FREE_RELEASE} */ - conf_linger_free_release = su_MEM_CONF_LINGER_FREE_RELEASE - }; - -/*! The base of \r{su_MEM_NEW()} etc. - * Be aware it does not even set \r{su_MEM_ALLOC_MUSTFAIL} automatically. */ -#define su_MEM_ALLOC_NEW(T,F) \ - new(su_MEM_ALLOCATE(sizeof(T), 1, F),\ - su_S(su_NSPC(su)mem::johnny const*,su_NIL)) T -/*! \r{su_MEM_ALLOC_NEW()} */ -#define su_MEM_ALLOC_NEW_LOC(T,F,FNAME,LNNO) \ - new(su_MEM_ALLOCATE_LOC(sizeof(T), 1, F, FNAME, LNNO),\ - su_S(su_NSPC(su)mem::johnny const*,su_NIL)) T - -/*! \_ */ -#define su_MEM_NEW(T) su_MEM_ALLOC_NEW(T, su_MEM_ALLOC_MUSTFAIL) -/*! \_ */ -#define su_MEM_NEW_LOC(T,FNAME,LNNO) \ - su_MEM_ALLOC_NEW_LOC(T, su_MEM_ALLOC_MUSTFAIL, FNAME, LNNO) - -/*! \_ */ -#define su_MEM_CNEW(T) \ - su_MEM_ALLOC_NEW(T, su_MEM_ALLOC_CLEAR | su_MEM_ALLOC_MUSTFAIL) -/*! \_ */ -#define su_MEM_CNEW_LOC(T,FNAME,LNNO) \ - su_MEM_ALLOC_NEW_LOC(T, su_MEM_ALLOC_CLEAR | su_MEM_ALLOC_MUSTFAIL,\ - FNAME, LNNO) - -/*! \_ */ -#define su_MEM_NEW_HEAP(T,VP) new(VP, su_S(su_NSPC(su)mem::johnny*,su_NIL)) T - -/*! \_ */ -#define su_MEM_DEL(TP) (su_NSPC(su)mem::del__heap(TP), su_MEM_FREE(TP)) -/*! \_ */ -#define su_MEM_DEL_LOC(TP,FNAME,LNNO) \ - (su_NSPC(su)mem::del__heap(TP), su_MEM_FREE_LOC(TP, FNAME, LNNO)) - -/*! \_ */ -#define su_MEM_DEL_HEAP(TP) su_NSPC(su)mem::del__heap(TP) -/*! \_ */ -#define su_MEM_DEL_HEAP_LOC(TP,FNAME,LNNO) su_NSPC(su)mem::del__heap(TP) - -/*! \_ */ -#define su_MEM_DEL_PRIVATE(T,TP) \ - (su_ASSERT((TP) != su_NIL), (TP)->~T(), su_MEM_FREE(TP)) -/*! \_ */ -#define su_MEM_DEL_PRIVATE_LOC(T,TP,FNAME,LNNO) \ - (su_ASSERT_LOC((TP) != su_NIL, FNAME, LNNO),\ - (TP)->~T(), su_MEM_FREE_LOC(TP, FNAME, LNNO)) - -/*! \_ */ -#define su_MEM_DEL_HEAP_PRIVATE(T,TP) (su_ASSERT((TP) != su_NIL), (TP)->~T()) -/*! \_ */ -#define su_MEM_DEL_HEAP_PRIVATE_LOC(T,TP,FNAME,LNNO) \ - (su_ASSERT((TP) != su_NIL), (TP)->~T()) - -/* (The painful _LOCOR series) */ -#ifdef su_HAVE_DBG_LOC_ARGS -# define su_MEM_NEW_LOCOR(T,ORARGS) su_MEM_NEW_LOC(T, ORARGS) -# define su_MEM_CNEW_LOCOR(T,ORARGS) su_MEM_CNEW_LOC(T, ORARGS) -# define su_MEM_NEW_HEAP_LOCOR(T,VP,ORARGS) su_MEM_NEW_HEAP_LOC(T, VP, ORARGS) -# define su_MEM_DEL_LOCOR(TP,ORARGS) su_MEM_DEL_LOC(TP, ORARGS) -# define su_MEM_DEL_HEAP_LOCOR(TP,ORARGS) su_MEM_DEL_HEAP_LOC(TP, ORARGS) -# define su_MEM_DEL_PRIVATE_LOCOR(T,TP,ORARGS) \ - su_MEM_DEL_PRIVATE_LOC(T, TP, ORARGS) -# define su_MEM_DEL_HEAP_PRIVATE_LOCOR(T,TP,ORARGS) \ - su_MEM_DEL_HEAP_PRIVATE_LOC(T, TP, ORARGS) -#else - /*! \_ */ -# define su_MEM_NEW_LOCOR(T,ORARGS) su_MEM_NEW(T) - /*! \_ */ -# define su_MEM_CNEW_LOCOR(T,ORARGS) su_MEM_CNEW(T) - /*! \_ */ -# define su_MEM_NEW_HEAP_LOCOR(T,VP,ORARGS) su_MEM_NEW_HEAP(T, VP) - /*! \_ */ -# define su_MEM_DEL_LOCOR(TP,ORARGS) su_MEM_DEL(TP) - /*! \_ */ -# define su_MEM_DEL_HEAP_LOCOR(TP,ORARGS) su_MEM_DEL_HEAP(TP) - /*! \_ */ -# define su_MEM_DEL_PRIVATE_LOCOR(T,TP,ORARGS) su_MEM_DEL_PRIVATE(T, TP) - /*! \_ */ -# define su_MEM_DEL_HEAP_PRIVATE_LOCOR(T,TP,ORARGS) \ - su_MEM_DEL_HEAP_PRIVATE(T, TP) -#endif /* !su_HAVE_DBG_LOC_ARGS */ - - /*! @} */ - /*! - * \defgroup CXX_MEM_CACHE_SUP C++ heap "support" - * \ingroup MEM_CACHE_SUP - * \brief \r{CXX_MEM_CACHE_ALLOC} support (\r{su/mem.h}) - * @{ - */ - - /*! \copydoc{su_mem_get_usable_size()} */ - static uz get_usable_size(uz size) {return su_mem_get_usable_size(size);} - - /*! \copydoc{su_mem_get_usable_size_32()} */ - static u32 get_usable_size_32(uz size){ - return su_mem_get_usable_size_32(size); - } - - /*! \copydoc{su_mem_conf_option()} */ - static void set_conf(u32 co, uz val) {su_mem_set_conf(co, val);} - - /*! \r{su_mem_check()} */ - static void check(void) {su_mem_check();} - - /*! \r{su_mem_trace()} */ - static void trace(void) {su_mem_trace();} - - template - static void del__heap(T *tptr){ - ASSERT_RET_VOID(tptr != NIL); - tptr->~T(); - } - - /*! @} */ -}; - -/*! - * \ingroup CXX_MEM_CACHE_ALLOC - * In order to be able, a global overwrite of \c{new()} is necessary. - */ -inline void *operator new(size_t sz, void *vp, NSPC(su)mem::johnny const *j){ - UNUSED(sz); - UNUSED(j); - return vp; -} - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ #endif /* !su_MEM_H */ /* s-it-mode */ diff --git a/include/su/prime.h b/include/su/prime.h index 1741b479..61f5f335 100644 --- a/include/su/prime.h +++ b/include/su/prime.h @@ -17,94 +17,18 @@ */ #ifndef su_PRIME_H #define su_PRIME_H - -/*! - * \file - * \ingroup PRIME - * \brief \r{PRIME} - */ - #include - #define su_HEADER #include C_DECL_BEGIN - -/*! - * \defgroup PRIME Prime numbers - * \ingroup MISC - * \brief Prime numbers (\r{su/prime.h}) - * @{ - */ - -/*! Minimum pre-calculated lookup prime (a \r{su_u32}). */ #define su_PRIME_LOOKUP_MIN 0x2u - -/*! Maximum pre-calculated lookup prime (a \r{su_u32}). */ #define su_PRIME_LOOKUP_MAX 0x18000005u - -/*! \_ - * \remarks{Very unacademical (brute force).} */ EXPORT boole su_prime_is_prime(u64 no, boole allowpseudo); - -/*! \_ */ EXPORT u64 su_prime_get_former(u64 no, boole allowpseudo); - -/*! \_ */ EXPORT u64 su_prime_get_next(u64 no, boole allowpseudo); - -/*! Former precalculated, minimum is \r{su_PRIME_LOOKUP_MIN}. */ EXPORT u32 su_prime_lookup_former(u32 no); - -/*! Next precalculated, maximum is \r{su_PRIME_LOOKUP_MAX}. */ EXPORT u32 su_prime_lookup_next(u32 no); - -/*! @} */ C_DECL_END #include -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class prime; - -/*! - * \ingroup PRIME - * C++ variant of \r{PRIME} (\r{su/prime.h}) - */ -class prime{ -public: - /*! \copydoc{su_PRIME_LOOKUP_MIN} */ - static u32 const lookup_min = su_PRIME_LOOKUP_MIN; - - /*! \copydoc{su_PRIME_LOOKUP_MAX} */ - static u32 const lookup_max = su_PRIME_LOOKUP_MAX; - - /*! \copydoc{su_prime_is_prime()} */ - static boole is_prime(u64 no, boole allowpseudo=TRU1){ - return su_prime_is_prime(no, allowpseudo); - } - - /*! \copydoc{su_prime_get_former()} */ - static u64 get_former(u64 no, boole allowpseudo=TRU1){ - return su_prime_get_former(no, allowpseudo); - } - - /*! \copydoc{su_prime_get_next()} */ - static u64 get_next(u64 no, boole allowpseudo=TRU1){ - return su_prime_get_next(no, allowpseudo); - } - - /*! \copydoc{su_prime_lookup_former()} */ - static u32 lookup_former(u32 no) {return su_prime_lookup_former(no);} - - /*! \copydoc{su_prime_lookup_next()} */ - static u32 lookup_next(u32 no) {return su_prime_lookup_next(no);} -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ #endif /* su_PRIME_H */ /* s-it-mode */ diff --git a/include/su/sort.h b/include/su/sort.h index 91cafbaf..2a2782c7 100644 --- a/include/su/sort.h +++ b/include/su/sort.h @@ -17,63 +17,13 @@ */ #ifndef su_SORT_H #define su_SORT_H - -/*! - * \file - * \ingroup SORT - * \brief \r{SORT} - */ - #include - #define su_HEADER #include C_DECL_BEGIN - -/*! - * \defgroup SORT Sorting of arrays - * \ingroup MISC - * \brief Sorting of arrays (\r{su/sort.h}) - * @{ - */ - -/*! Sort an array of pointers with Knuth's shell sort algorithm - * (Volume 3, page 84). - * \a{arr} may be \NIL if \a{entries} is 0. - * If \a{cmp_or_nil} is \NIL by-pointer comparison is performed. - * Otherwise, \a{cmp_or_nil} will not be called for \NIL array entries, - * which thus can result in false sorting. */ EXPORT void su_sort_shell_vpp(void const **arr, uz entries, su_compare_fun cmp_or_nil); - -/*! @} */ C_DECL_END #include -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class sort; - -/*! - * \ingroup SORT - * C++ variant of \r{SORT} (\r{su/sort.h}) - */ -class sort{ -public: - /*! \copydoc{su_sort_shell_vpp()} */ - template - static void shell(T const **arr, uz entries, - typename type_toolbox::compare_fun cmp_or_nil){ - ASSERT_RET_VOID(entries == 0 || arr != NIL); - su_sort_shell_vpp(R(void const**,arr), entries, - R(su_compare_fun,cmp_or_nil)); - } -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ #endif /* su_PRIME_H */ /* s-it-mode */ diff --git a/include/su/utf.h b/include/su/utf.h index df719459..fc4ff935 100644 --- a/include/su/utf.h +++ b/include/su/utf.h @@ -17,112 +17,19 @@ */ #ifndef su_UTF_H #define su_UTF_H - -/*! - * \file - * \ingroup UTF - * \brief \r{UTF} - */ - #include - #define su_HEADER #include C_DECL_BEGIN - -/*! - * \defgroup UTF Unicode Transformation Formats - * \ingroup TEXT - * \brief Convert in between UnicodeTranformationFormats (\r{su/utf.h}) - * @{ - */ - -/*! - * \defgroup UTF8 UTF-8 - * \ingroup UTF - * \brief UTF-8 (\r{su/utf.h}) - * @{ - */ - enum{ - /*! Maximum buffer size of an UTF-8 sequence including terminating NUL. */ su_UTF8_BUFFER_SIZE = 5u }; - -/*! The Unicode replacement character \c{0xFFFD} as an UTF-8 literal. */ #define su_UTF8_REPLACER "\xEF\xBF\xBD" - -/*! Compiled in version of \r{su_UTF8_REPLACER}. */ EXPORT_DATA char const su_utf8_replacer[sizeof su_UTF8_REPLACER]; - -/*! Convert, and update arguments to point after range. - * Returns \r{su_U32_MAX} on error, in which case the arguments will have been - * stepped one byte. */ EXPORT u32 su_utf8_to_32(char const **bdat, uz *blen); - -/*! @} */ -/*! - * \defgroup UTF32 UTF-32 - * \ingroup UTF - * \brief UTF-32 (\r{su/utf.h}) - * @{ - */ - -/*! The Unicode replacement character \c{0xFFFD} as an UTF-32 codepoint. */ #define su_UTF32_REPLACER 0xFFFDu - -/*! Convert an UTF-32 character to an UTF-8 sequence. - * \a{bp} must be large enough also for the terminating NUL (see - * \r{su_UTF8_BUFFER_SIZE}), its length will * be returned. */ EXPORT uz su_utf32_to_8(u32 c, char *bp); - -/*! @} */ -/*! @} */ C_DECL_END #include -#if !su_C_LANG || defined CXX_DOXYGEN -# define su_CXX_HEADER -# include -NSPC_BEGIN(su) - -class utf8; -class utf32; - -/*! - * \ingroup UTF8 - * C++ variant of \r{UTF8} (\r{su/utf.h}) - */ -class EXPORT utf8{ -public: - enum{ - /*! \copydoc{su_UTF8_BUFFER_SIZE} */ - buffer_size = su_UTF8_BUFFER_SIZE - }; - - /*! \copydoc{su_UTF8_REPLACER} */ - static char const replacer[sizeof su_UTF8_REPLACER]; - - /*! \copydoc{su_utf8_to_32()} */ - static u32 convert_to_32(char const **bdat, uz *blen){ - return su_utf8_to_32(bdat, blen); - } -}; - -/*! - * \ingroup UTF32 - * C++ variant of \r{UTF32} (\r{su/utf.h}) - */ -class utf32{ -public: - /*! \copydoc{su_UTF32_REPLACER} */ - static u32 const replacer = su_UTF32_REPLACER; - - /*! \copydoc{su_utf32_to_8()} */ - static uz convert_to_8(u32 c, char *bp) {return su_utf32_to_8(c, bp);} -}; - -NSPC_END(su) -# include -#endif /* !C_LANG || CXX_DOXYGEN */ #endif /* su_UTF_H */ /* s-it-mode */ diff --git a/include/su/view.h b/include/su/view.h index ccdf2e97..78d78c8a 100644 --- a/include/su/view.h +++ b/include/su/view.h @@ -18,25 +18,9 @@ */ #ifndef su_VIEW_H # define su_VIEW_H - -#ifdef CXX_DOXYGEN -/*! - * \file - * \ingroup VIEW - * \brief Generic view template(s) (super classes) - * - * Merely of interest when creating new C++ collection types. - */ -#endif - -#include -su_USECASE_MX_DISABLED -#if !su_C_LANG || defined CXX_DOXYGEN - #define su_CXX_HEADER #include NSPC_BEGIN(su) - template class view_traits; template class view__base; template class view_unidir; @@ -49,264 +33,60 @@ template class view_assoc_unidir; template class view_assoc_unidir_const; template class view_assoc_bidir; template class view_assoc_bidir_const; - -/*! - * \defgroup VIEW C++ View superclasses - * \ingroup COLL - * \brief Generic view template(s) (super classes) (\r{su/view.h}) - * - * Merely of interest when creating new C++ collection types. - * - * \head1{Superclass requirements} - * - * The minimum required interface that the typesafe C++ templates require, - * and its expected behaviour. - * In general there is a basic interface and several type-specific additions - * which stack upon each other. - * - * \head2{Base} - * - * \list{\li{ - * Copy constructor - * }\li{ - * Assignment operator (C: \fn{_assign()}) - * }\li{ - * \fn{self_class &setup(super_collection &tc)} - * Create a tie in between this view and its parental collection instance. - * This is superficial: the programmer is responsible to ensure that the parent - * remains accessible, remains unmodified, etc. - * }\li{ - * \fn{boole is_setup(void) const} - * }\li{ - * \fn{boole is_same_parent(self_class const &t) const}: - * Whether two views are tied to the same collection object. - * }\li{ - * \fn{boole is_valid(void) const}: - * A valid view points to an accessible slot of the collection instance. - * }\li{ - * \fn{self_class &reset(void)} - * Invalidate the position, but keep the parent collection tied. - * }\li{ - * \fn{void const *data(void) const}: - * \NIL is returned if \fn{is_valid()} assertion triggers. - * Also avaiable via \fn{operator*(void) const} - * and \fn{operator->(void) const}. - * }\li{ - * \fn{self_class &begin(void)}: - * Move the \fn{is_setup()} view to the first iteratable position, if any. - * }\li{ - * \fn{boole has_next(void) const}, \fn{self_class &next(void)}: - * Step the \c{is_valid()} view to the next position, if any. - * }\li{ - * \fn{sz cmp(self_class const &t) const}: - * This need not compare all possible cases, only those which make sense; - * Equality and inequality must always be provided. - * Neither \fn{is_setup()} nor \fn{is_valid()} are preconditions for - * comparison; a non-\fn{setup()}d view shall compare less-than an - * \fn{is_setup()} one, ditto \fn{is_valid()}. - * }} - * - * \head2{Additions for views with non-constant parent} - * - * \list{\li{ - * \fn{void *data(void)}: - * \NIL is returned if \fn{is_valid()} assertion triggers. - * Also avaiable via \fn{operator*(void)} and \fn{operator->(void)}. - * }\li{ - * \fn{s32 set_data(void *dat)}: - * Replace the value of an \fn{is_valid()} position. - * Returns \err{none} upon success, and \err{einval} if the \fn{is_setup()} - * assertion fails. - * }\li{ - * \fn{self_class &remove(void)}: - * Remove the current \c{is_valid()} entry, and move to the next position, - * if there is any. - * }} - * - * \head2{Additions for non-associative views, non-constant parent} - * - * \list{\li{ - * \fn{s32 insert(void *dat)}: - * Insert new element after current position if that \fn{is_valid()}, - * otherwise creates a new \fn{begin()}. - * Returns \err{none} and is positioned at the inserted element upon - * success, and \err{einval} if the \fn{is_setup()} assertion fails. - * }\li{ - * \fn{s32 insert_range(self_class &startpos, self_class &endpos)}: - * Insert new element(s) after current position if that \fn{is_valid()}, - * otherwise creates a new \fn{begin()} first. - * \a{startpos} must be \fn{is_valid()} and must not be \fn{is_same_parent()} - * as \THIS; if it is, it is asserted that ranges do not overlap. - * - * All positions accessible by iterating \a{startpos} will be inserted. - * If \a{endpos} is \fn{is_valid()} \c{startpos.is_same_parent(endpos)} must - * assert and the iteration does not include \a{endpos}. - * Returns \err{none} and is positioned at the last inserted element - * upon success, and \err{einval} if the \fn{is_setup()} or any of the - * argument assertions fail, among others. - * }\li{ - * \fn{self_class &remove_range(self_class &endpos)}: - * Remove all elements starting at the current \fn{is_valid()} entry unless - * \THIS becomes invalid, or a given \fn{is_valid()} \a{endpos}ition is - * reached, which is not removed. - * - * If \a{endpos} \fn{is_valid()} then it must be \fn{is_same_parent()} - * as this view; it may also become updated in this case in order to - * stay at the same effective position after the operation completed: - * for example, removing a range from an array requires \a{endpos} to be - * moved further to "the front". - * }} - * - * \head2{Additions for associative views} - * - * \list{\li{ - * \fn{void const *key(void) const}: - * \NIL is returned if the \fn{is_valid()} assertion triggers. - * }} - * - * \head2{Additions for associative views, non-constant parent} - * - * \list{\li{ - * \fn{s32 reset_insert(void const *key, void *dat)}: - * Insert a new \a{key} / \a{value} pair in the parent. - * If \a{key} already exists -1 is returned, but \fn{is_valid()} is true just - * as for a successful insertion. - * }\li{ - * \fn{s32 reset_replace(void const *key, void *dat)}: - * Insert a new, or update an existing \a{key} / \a{value} pair in the parent. - * If an existing \a{key} has been updated -1 is returned, but \fn{is_valid()} - * is true just as for insertion of a new \a{key}. - * }} - * - * \head2{Additions for non-associative unidirectional views} - * - * \list{\li{ - * \fn{self_class &go_to(uz off)}: - * Move the \fn{is_setup()} view to the absolute position \a{off}. - * }\li{ - * \fn{boole find(void const *dat, boole byptr)}: - * Search for \a{dat} in the \fn{is_setup()} view, either starting at the - * current position if \fn{is_valid()}, at \fn{begin()} otherwise. - * \a{byptr} states whether data shall be found by simple pointer comparison; - * if not, the \c{toolbox} of the \fn{is_setup()}d parent should be - * asserted (if used by the collection in question). - * }} - * - * \head2{Additions for associative unidirectional views} - * - * \list{\li{ - * \fn{boole find(void const *key)}: - * Search for \a{key} in the \fn{is_setup()} view. - * }} - * - * \head2{Additions for bidirectional views} - * - * \list{\li{ - * \fn{self_class &end(void)}: - * Move the \fn{is_setup()} view to the last position, if any. - * }\li{ - * \fn{boole has_last(void) const} - * }\li{ - * \fn{self_class &last(void)}: - * Move the \fn{is_valid()} view to the position before the current one, - * if any. - * }} - * - * \head2{Additions for non-associative bidirectional views} - * - * \list{\li{ - * \fn{boole rfind(void const *dat, boole byptr)}: - * Search for \a{dat} in the \fn{is_setup()} view, either starting at the - * current position if \fn{is_valid()}, at \fn{end()} otherwise. - * \a{byptr} states whether data shall be found by simple pointer comparison; - * if not, the \c{toolbox} of the \fn{setup()}d parent should be asserted. - * }} - * - * \head2{Additions for non-associative random-access views} - * - * This type extends the requirement of the \fn{cmp()} function in the - * base set, and requires the additional results less-than, - * less-than-or-equal, greater-than and greater-than-or-equal. - * - * \list{\li{ - * \fn{self_class &go_around(sz reloff)}: - * Move the \fn{is_valid()} view relative by \a{reloff} positions. - * }} - * @{ - */ - -/*! \_ */ enum view_category{ - view_category_non_assoc, /*!< \_ */ - view_category_assoc /*!< \_ */ + view_category_non_assoc, + view_category_assoc }; - -/*! \_ */ enum view_type{ - view_type_unidir, /*!< \_ */ - view_type_bidir, /*!< \_ */ - view_type_random, /*!< \_ */ - view_type_assoc_unidir, /*!< \_ */ - view_type_assoc_bidir /*!< \_ */ + view_type_unidir, + view_type_bidir, + view_type_random, + view_type_assoc_unidir, + view_type_assoc_bidir }; - -/*! \_ */ template class view_traits{ public: - typedef BASECOLLT base_coll_type; /*!< \_ */ - + typedef BASECOLLT base_coll_type; // Identical to normal traits except for view_category_assoc views - typedef NSPC(su)type_traits key_type_traits; /*!< \_ */ - typedef NSPC(su)type_traits type_traits; /*!< \_ */ + typedef NSPC(su)type_traits key_type_traits; + typedef NSPC(su)type_traits type_traits; }; - /* @} */ - // class view__base{{{ template class view__base{ protected: GBASEVIEWT m_view; - view__base(void) : m_view() {} view__base(view__base const &t) : m_view(t.m_view) {} - public: ~view__base(void) {} - protected: view__base &assign(view__base const &t){ m_view = t.m_view; return *this; } view__base &operator=(view__base const &t) {return assign(t);} - public: boole is_setup(void) const {return m_view.is_setup();} - boole is_same_parent(view__base const &t) const{ return m_view.is_same_parent(t.m_view); } - boole is_valid(void) const {return m_view.is_valid();} operator boole(void) const {return is_valid();} - protected: view__base &reset(void){ (void)m_view.reset(); return *this; } - sz cmp(view__base const &t) const {return m_view.cmp(t.m_view);} - public: boole is_equal(view__base const &t) const {return (cmp(t) == 0);} boole operator==(view__base const &t) const {return (cmp(t) == 0);} boole operator!=(view__base const &t) const {return (cmp(t) != 0);} }; // }}} - // Because of the various sorts of views we define helper macros. // Unfortunately GCC (up to and including 3.4.2) cannot access // base& _x ... _x.m_view @@ -315,7 +95,6 @@ public: // (and only so if we put a "using" directive, see su__VIEW_IMPL_START__BASE). // To be (hopefully..) absolutely safe use a C-style cast #define su__VIEW_DOWNCAST(X) ((su__VIEW_NAME&)X) - #define su__VIEW_IMPL_START /*{{{*/\ template\ class su__VIEW_NAME : public view__base{\ @@ -400,7 +179,6 @@ public:\ using base::operator==;\ using base::operator!=;\ /*}}} }*/ - #define su__VIEW_IMPL_NONCONST /*{{{*/\ tp data(void){\ ASSERT_RET(is_valid(), NIL);\ @@ -419,7 +197,6 @@ public:\ return *this;\ }\ /*}}}*/ - #define su__VIEW_IMPL_CONST /*{{{*/\ /* (We need to cast away the 'const', but it is preserved logically..) */\ template explicit su__VIEW_NAME(TCOLL const &tc){\ @@ -447,9 +224,7 @@ public:\ return *this;\ }\ /*}}}*/ - #define su__VIEW_IMPL_NONASSOC - #define su__VIEW_IMPL_NONASSOC_NONCONST /*{{{*/\ /* err::enone or error */\ s32 insert(tp dat){\ @@ -488,16 +263,13 @@ public:\ return *this;\ }\ /*}}}*/ - #define su__VIEW_IMPL_NONASSOC_CONST - #define su__VIEW_IMPL_ASSOC /*{{{*/\ key_tp_const key(void) const{\ ASSERT_RET(is_valid(), NIL);\ return key_type_traits::to_const_tp(m_view.key());\ }\ /*}}}*/ - #define su__VIEW_IMPL_ASSOC_NONCONST /*{{{*/\ /* err::enone or error */\ s32 reset_insert(key_tp_const key, tp dat){\ @@ -512,12 +284,9 @@ public:\ type_traits::to_vp(dat));\ }\ /*}}}*/ - #define su__VIEW_IMPL_ASSOC_CONST - #define su__VIEW_IMPL_UNIDIR #define su__VIEW_IMPL_UNIDIR_NONCONST - #define su__VIEW_IMPL_UNIDIR_CONST /*{{{*/\ /* (We need to cast away the 'const', but it is preserved logically..) */\ template su__VIEW_NAME &begin(TCOLL const &tc){\ @@ -525,7 +294,6 @@ public:\ return *this;\ }\ /*}}}*/ - #define su__VIEW_IMPL_UNIDIR_NONASSOC /*{{{*/\ /* is_valid() must be tested thereafter */\ su__VIEW_NAME &go_to(uz off){\ @@ -540,14 +308,12 @@ public:\ return m_view.find(type_traits::to_const_vp(dat), byptr);\ }\ /*}}}*/ - #define su__VIEW_IMPL_UNIDIR_ASSOC /*{{{*/\ boole find(key_tp_const key){\ ASSERT_RET(is_setup(), (reset(), FAL0));\ return m_view.find(key_type_traits::to_const_vp(key));\ }\ /*}}}*/ - #define su__VIEW_IMPL_BIDIR /*{{{*/\ su__VIEW_NAME &end(void){\ ASSERT_RET(is_setup(), *this);\ @@ -566,14 +332,12 @@ public:\ }\ su__VIEW_NAME &operator--(void) {return last();}\ /*}}}*/ - #define su__VIEW_IMPL_BIDIR_NONCONST /*{{{*/\ template su__VIEW_NAME &end(TCOLL &tc){\ (void)m_view.setup(S(base_coll_type&,tc)).end();\ return *this;\ }\ /*}}}*/ - #define su__VIEW_IMPL_BIDIR_CONST /*{{{*/\ /* (We need to cast away the 'const', but it is preserved logically..) */\ template su__VIEW_NAME &end(TCOLL const &tc){\ @@ -581,7 +345,6 @@ public:\ return *this;\ }\ /*}}}*/ - #define su__VIEW_IMPL_BIDIR_NONASSOC /*{{{*/\ boole rfind(tp_const dat, boole byptr=FAL0){\ ASSERT_RET(is_setup(), (reset(), FAL0));\ @@ -589,13 +352,10 @@ public:\ return m_view.rfind(type_traits::to_const_vp(dat), byptr);\ }\ /*}}}*/ - #define su__VIEW_IMPL_BIDIR_ASSOC - #define su__VIEW_IMPL_RANDOM #define su__VIEW_IMPL_RANDOM_NONCONST #define su__VIEW_IMPL_RANDOM_CONST - #define su__VIEW_IMPL_RANDOM_NONASSOC /*{{{*/\ /* is_valid() must be tested thereafter */\ su__VIEW_NAME &go_around(sz reloff){\ @@ -620,19 +380,13 @@ public:\ boole operator<=(base const &t) const {return (base::cmp(t) <= 0);}\ boole operator>=(base const &t) const {return (base::cmp(t) >= 0);}\ /*}}}*/ - #define su__VIEW_IMPL_RANDOM_ASSOC - #define su__VIEW_IMPL_END }; - // Puuuh. Let us go! {{{ - #undef su__VIEW_CATEGORY #define su__VIEW_CATEGORY view_category_non_assoc - #undef su__VIEW_TYPE #define su__VIEW_TYPE view_type_unidir - #undef su__VIEW_NAME #undef su__VIEW_NAME_NONCONST #define su__VIEW_NAME view_unidir @@ -645,7 +399,6 @@ su__VIEW_IMPL_START su__VIEW_IMPL_UNIDIR_NONCONST su__VIEW_IMPL_UNIDIR_NONASSOC su__VIEW_IMPL_END - #undef su__VIEW_NAME #define su__VIEW_NAME view_unidir_const su__VIEW_IMPL_START @@ -656,10 +409,8 @@ su__VIEW_IMPL_START su__VIEW_IMPL_UNIDIR_CONST su__VIEW_IMPL_UNIDIR_NONASSOC su__VIEW_IMPL_END - #undef su__VIEW_TYPE #define su__VIEW_TYPE view_type_bidir - #undef su__VIEW_NAME #undef su__VIEW_NAME_NONCONST #define su__VIEW_NAME view_bidir @@ -675,7 +426,6 @@ su__VIEW_IMPL_START su__VIEW_IMPL_BIDIR_NONCONST su__VIEW_IMPL_BIDIR_NONASSOC su__VIEW_IMPL_END - #undef su__VIEW_NAME #define su__VIEW_NAME view_bidir_const su__VIEW_IMPL_START @@ -689,10 +439,8 @@ su__VIEW_IMPL_START su__VIEW_IMPL_BIDIR_CONST su__VIEW_IMPL_BIDIR_NONASSOC su__VIEW_IMPL_END - #undef su__VIEW_TYPE #define su__VIEW_TYPE view_type_random - #undef su__VIEW_NAME #undef su__VIEW_NAME_NONCONST #define su__VIEW_NAME view_random @@ -711,7 +459,6 @@ su__VIEW_IMPL_START su__VIEW_IMPL_RANDOM_NONCONST su__VIEW_IMPL_RANDOM_NONASSOC su__VIEW_IMPL_END - #undef su__VIEW_NAME #define su__VIEW_NAME view_random_const su__VIEW_IMPL_START @@ -728,13 +475,10 @@ su__VIEW_IMPL_START su__VIEW_IMPL_RANDOM_CONST su__VIEW_IMPL_RANDOM_NONASSOC su__VIEW_IMPL_END - #undef su__VIEW_CATEGORY #define su__VIEW_CATEGORY view_category_assoc - #undef su__VIEW_TYPE #define su__VIEW_TYPE view_type_assoc_unidir - #undef su__VIEW_NAME #undef su__VIEW_NAME_NONCONST #define su__VIEW_NAME view_assoc_unidir @@ -747,7 +491,6 @@ su__VIEW_IMPL_START su__VIEW_IMPL_UNIDIR_NONCONST su__VIEW_IMPL_UNIDIR_ASSOC su__VIEW_IMPL_END - #undef su__VIEW_NAME #define su__VIEW_NAME view_assoc_unidir_const su__VIEW_IMPL_START @@ -758,10 +501,8 @@ su__VIEW_IMPL_START su__VIEW_IMPL_UNIDIR_CONST su__VIEW_IMPL_UNIDIR_ASSOC su__VIEW_IMPL_END - #undef su__VIEW_TYPE #define su__VIEW_TYPE view_type_assoc_bidir - #undef su__VIEW_NAME #undef su__VIEW_NAME_NONCONST #define su__VIEW_NAME view_assoc_bidir @@ -777,7 +518,6 @@ su__VIEW_IMPL_START su__VIEW_IMPL_BIDIR_NONCONST su__VIEW_IMPL_BIDIR_ASSOC su__VIEW_IMPL_END - #undef su__VIEW_NAME #define su__VIEW_NAME view_assoc_bidir_const su__VIEW_IMPL_START @@ -794,13 +534,9 @@ su__VIEW_IMPL_START su__VIEW_IMPL_RANDOM_CONST su__VIEW_IMPL_RANDOM_ASSOC su__VIEW_IMPL_END - // }}} - // Cleanup {{{ - #undef su__VIEW_DOWNCAST - #undef su__VIEW_IMPL_START #undef su__VIEW_IMPL_NONCONST #undef su__VIEW_IMPL_CONST @@ -826,16 +562,10 @@ su__VIEW_IMPL_END #undef su__VIEW_IMPL_RANDOM_NONASSOC #undef su__VIEW_IMPL_RANDOM_ASSOC #undef su__VIEW_IMPL_END - #undef su__VIEW_CATEGORY #undef su__VIEW_TYPE #undef su__VIEW_NAME #undef su__VIEW_NAME_NONCONST - // }}} - NSPC_END(su) #include -#endif /* !su_C_LANG || defined CXX_DOXYGEN */ -#endif /* su_VIEW_H */ -/* s-it-mode */ diff --git a/mk/make-news-anchors.sh b/mk/make-news-anchors.sh deleted file mode 100644 index 0375c0e6..00000000 --- a/mk/make-news-anchors.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh - -#@ make-news-anchors.sh -#@ Expand *XY*# / $XY# / -XY# / `XY'# / `~XY'# / "XY"# style anchors -#@ so that the anchor matches the number given in ANCHORFILE. -#@ The number sign may be followed by space, question-mark ? or a number. -#@ We always expand STDIN to STDOUT, but only in the range -#@ ChangeLog .. ^(Appendix|git\(1\) shortlog) (or EOF, of course) -#@ The ANCHORFILE can be produced by -#@ $ < manual.mdoc mdocmx.sh | -#@ MDOCMX_ENABLE=1 s-roff -U -mdoc -dmx-anchor-dump=/tmp/anchors \ -#@ -dmx-toc-force=tree >/dev/null -# Public Domain - -: ${awk:=awk} - -syno() { - if [ ${#} -gt 0 ]; then - echo >&2 "ERROR: ${*}" - echo >&2 - fi - echo >&2 'Synopsis: make-news-anchors.sh ANCHORFILE' - exit 1 -} - -[ ${#} -eq 1 ] || syno -[ -f "${1}" ] || syno 'the given anchorfile does not exist' - -APO=\' -${awk} -v anchorfile="${1}" ' -BEGIN{hot = 0} -/^(NOTES|ChangeLog)/{ - hot = 1 - print - next -} -/^(Appendix|git\(1\) shortlog)/{ - hot = -1 - print - next -} -{ - if(hot <= 0){ - print - next - } - any = 0 - res = "" - s = $0 - while(match(s, - /(^|\(|[[:space:]]+)("[^"]+"|\*[^\*]+\*|`[^'${APO}']+'${APO}'|[-~][-#\/:_.[:alnum:]]+|\$[_[:alnum:]]+)#(\?|[0-9]+)?/)) - { - any = 1 - pre = (RSTART > 1) ? substr(s, 1, RSTART - 1) : "" - mat = substr(s, RSTART, RLENGTH) - s = substr(s, RSTART + RLENGTH) - - # Unfortunately groups are not supported - if(match(mat, /^(\(|[[:space:]]+)/) != 0 && RLENGTH > 0){ - pre = pre substr(mat, 1, RLENGTH) - mat = substr(mat, RSTART + RLENGTH) - } - - match(mat, /#(\?|[0-9]+)?$/) - mat = substr(mat, 1, RSTART - 1) - res = res pre mat "#" - - if(mat ~ /^`/){ # Cm, Ic - mat = substr(mat, 2, length(mat) - 2) - t = 1 - }else if(mat ~ /^\*/){ # Va - mat = substr(mat, 2, length(mat) - 2) - t = 2 - }else if(mat ~ /^\$/){ # Ev, Dv - mat = substr(mat, 2, length(mat) - 1) - t = 3 - }else if(mat ~ /^-/){ # Fl - mat = substr(mat, 2, length(mat) - 1) - t = 4 - }else if(mat ~ /^"/){ # Sh, Ss. But: "catch-all" - mat = substr(mat, 2, length(mat) - 2) - t = 5 - }else - t = 0 - - # Insufficient, of course - gsub("\\\\", "\\e", mat) - - ano = got = 0 - while((getline < anchorfile) > 0){ - if(t == 1){ - if($2 != "Cm" && $2 != "Ic") - continue - }else if(t == 2){ - if($2 != "Va") - continue - }else if(t == 3){ - if($2 != "Ev" && $2 != "Dv") - continue - }else if(t == 4){ - if($2 != "Fl") - continue - }else if(t == 0){ - if($2 == "Cm" || $2 == "Ic" || - $2 == "Va" || - $2 == "Ev" || $2 == "Dv" || - $2 == "Fl") - continue - } - - if(!got) - ano = $1 - $1 = $2 = "" - match($0, /^[[:space:]]*/) - $0 = substr($0, RLENGTH + 1) - - if($0 == mat){ - if(got) - print "WARN: ambiguous: \"" mat "\"" > "/dev/stderr" - got = 1 - } - } - close(anchorfile) - if(!got){ - print "ERROR: no anchor for \"" mat "\"" > "/dev/stderr" - res = res "?" - }else - res = res ano - } - if(any && length(s)) - res = res s - print any ? res : s -} -' - -# s-sh-mode diff --git a/mk/make-release.inc b/mk/make-release.inc deleted file mode 100644 index 6f4a6bae..00000000 --- a/mk/make-release.inc +++ /dev/null @@ -1,529 +0,0 @@ -#@ Include file for the make-release.sh generic release builder. -#@ It also needs three hooks: update_stable_hook() and update_release_hook(), -#@ which need to "git add" what they have modified, and test_release_hook(), -#@ (non-"grappa") called with the release tag name as an argument after the -#@ release commit: if it returns a non-0 status the release process is aborted. -#@ The "grappa" mode needs a current_version() hook, which has to set $VERSION -#@ to the current program version, expected as MAJOR.MINOR.UPDATE[-whatever] - -# Program stuff -: ${awk:=awk} -: ${cat:=cat} -: ${cmp:=cmp} -: ${date:=date} -: ${git:=git} -: ${grep:=grep} -: ${make:=make} -: ${mv:=mv} -: ${SHELL:=sh} -: ${sed:=sed} - -# Non-"grappa" only -: ${gzip:=gzip} -: ${openssl:=openssl} -: ${gpg:=gpg} -: ${rm:=rm} -: ${roff:=s-roff} # optional (command(1) tested) -: ${sftp:=sftp} -: ${tar:=tar} -: ${xz:=xz} - -## -- >8 -- 8< -- ## - -: ${PROGRAM:?"Need \$PROGRAM"} -: ${UPROGRAM:?"Need \$UPROGRAM"} -# For announcement only. -: ${MANUAL:?"May need \$MANUAL for announcement references"} - -# When we upload balls only. -: ${UPLOAD:?"Need \$UPLOAD URL for scp(1)"} - -# For announcement mail only. -: ${MAILX:=mailx} -: ${ACCOUNT:?"May need mailx(1) -A \$ACCOUNT"} -: ${MAILTO:?"May need \$MAILTO for announcement"} -: ${MAILBCC:?"May need \$MAILBCC for announcement"} - -## -- >8 -- 8< -- ## - -ORIG_LC_ALL=${LC_ALL} LC_ALL=C -export LC_ALL - -DATE_MAN=`${date} -u +'%B %d, %Y'` -DATE_ISO=`${date} -u +%Y-%m-%d` - -yesno() { - while [ 1 ]; do - [ ${#} -gt 0 ] && printf '%s ' "${@}" - printf '[y/n] ' - read i - case ${i} in - [Yy]*) return 0;; - [Nn]*) return 1;; - *) ;; - esac - done -} - -ref_status() { - headref="`${git} rev-parse --verify HEAD`" - brref= - for i in `${git} rev-parse --branches=stable master^{commit} \ - 2>/dev/null`; do - if [ ${headref} = ${i} ]; then - brref=${headref} - break - fi - done - if [ -z "${brref}" ]; then - echo >&2 'Not on the [master] or a [stable/*] branch' - [ -z "${grappa}" ] && exit 1 - if yesno 'Are you sure you want grappa from '${headref}'?'; then :; else - echo >&2 'Bailing out' - exit 3 - fi - fi - if [ "`${git} status --porcelain --ignored | - ${awk} 'BEGIN{no=0}{++no}END{print no}'`" -ne 0 ]; then - echo >&2 'Directory not clean, see git status --ignored' - exit 2 - fi - #brname="`git branch | sed -e '/^* /b X' -e d -e :X -e 's/^* //'`" - brname=`${git} symbolic-ref --short HEAD` -} - -release_version() { - vmaj=`{ echo ${VERSION}; } | ${sed} -e 's/^\([^.]\{1,\}\).*/\1/'` - vmin=`{ echo ${VERSION}; } | - ${sed} -e 's/^[^.]\{1,\}\.\([^.]\{1,\}\).*/\1/'` - [ ${vmin} = ${VERSION} ] && VERSION=${VERSION}.0 vmin=0 - vupd=`{ echo ${VERSION}; } | - ${sed} -e 's/^[^.]\{1,\}\.[^.]\{1,\}\.\([^.-]\{1,\}\).*/\1/'` - [ ${vupd} = ${VERSION} ] && VERSION=${VERSION}.0 vupd=0 - REL=${VERSION} - export VERSION - if yesno 'Is '${PROGRAM}' correct?'; then :; else - echo >&2 'Bailing out' - exit 3 - fi -} - -release_brcheck() { - stblbrname=stable/v${vmaj}.${vmin} need_stblbrname= - brref=`${git} rev-parse --verify ${stblbrname} 2>/dev/null` - if [ -z "${brref}" ]; then - if yesno 'Create new branch '"${stblbrname}"' after release tag'; then - need_stblbrname=1 - fi - elif [ ${brref} != ${headref} ] || [ ${brname} != ${stblbrname} ]; then - echo >&2 "For ${REL} we should be on ${stblbrname}, not ${brname}" - echo >&2 'Bailing out' - exit 4 - fi - - relbrname=release/v${VERSION} - brref=`${git} rev-parse --verify ${relbrname} 2>/dev/null` - if [ -z "${brref}" ]; then :; else - echo >&2 "The ${relbrname} already exists" - echo >&2 'Bailing out' - exit 5 - fi -} - -release_symname() { - RELSYM= - stblmsg= relmsg= - if yesno 'Shall '${PROGRAM}' v'${REL}' have a symbolic name?'; then - printf ' ..and it shall be known as: ' - read RELSYM - if yesno 'Is '"${RELSYM}"' correct?'; then :; else - echo >&2 'Bailing out' - exit 3 - fi - stblmsg="Bump ${UPROGRAM} v${REL} (\"${RELSYM}\"), ${DATE_ISO}" - relmsg="Bump ${UPROGRAM} v${REL}.ar (\"${RELSYM}\"), ${DATE_ISO}" - RELSYM=" (\"${RELSYM}\")" - else - stblmsg="Bump ${UPROGRAM} v${REL}, ${DATE_ISO}" - relmsg="Bump ${UPROGRAM} v${REL}.ar, ${DATE_ISO}" - fi -} - -update_stable_branch() { - LC_ALL=${ORIG_LC_ALL} ${git} commit -S -n -m "${stblmsg}" - LC_ALL=${ORIG_LC_ALL} ${git} tag -s -f -m "${stblmsg}" v${REL} - - if [ -n "${need_stblbrname}" ]; then - ${git} checkout -b ${stblbrname} - fi - # Normally done in post-commit hook, but not once initially created - if yesno 'Shall i update stable/latest "symlink"?'; then - ${git} update-ref refs/heads/stable/latest ${stblbrname} - fi - if yesno 'Shall i update stable/stable "symlink"?'; then - ${git} update-ref refs/heads/stable/stable ${stblbrname} - fi -} - -create_release_branch() { - if yesno 'Create release/ branch?'; then - ${git} checkout -b ${relbrname} - - echo 'Updating files: calling update_release_hook' - update_release_hook - - LC_ALL=${ORIG_LC_ALL} ${git} commit -S -n -m "${relmsg}" - LC_ALL=${ORIG_LC_ALL} ${git} tag -s -f -m "${relmsg}" v${REL}.ar - - if yesno 'Shall i update release/latest "symlink"?'; then - ${git} update-ref refs/heads/release/latest ${relbrname} - fi - if yesno 'Shall i update release/stable "symlink"?'; then - ${git} update-ref refs/heads/release/stable ${relbrname} - fi - else - relbrname=${stblbrname} - fi -} - -check_timeline_branch() { - if [ ${relbrname} != ${stblbrname} ] && - `${git} rev-parse --verify timeline^{commit} >/dev/null 2>&1` && - yesno 'Shall i update [timeline]?'; then - ${git} checkout timeline - ${git} rm -rf '*' - ${git} archive --format=tar "v${REL}.ar" | ${tar} -x -f - - ${git} add . - LC_ALL=${ORIG_LC_ALL} ${git} commit -S -n -m "${relmsg}" - fi -} - -repo_push() { - [ ${relbrname} != ${stblbrname} ] && ${git} checkout ${stblbrname} - ${git} log --no-walk --decorate --oneline --branches --remotes - yesno 'Push git(1) repo?' && ${git} push -} - -big_balls() { - if [ ${relbrname} != ${stblbrname} ] && yesno 'Create tarballs?'; then - bigballs=y - ( - umask 0022 - - # Repack with standard tar(1) to avoid new-style headers - ${git} archive --format=tar --prefix="${PROGRAM}-${REL}/" v${REL}.ar | - ( cd "${TMPDIR}" && ${tar} -x -f - ) - cd "${TMPDIR}" - - # And use a portable format by default; ustar from 1988 is ok for us, - # but pax/posix from 2001 is even more forgiving and future aware - fmt= - ${tar} --format=pax --version >/dev/null 2>&1 && fmt=--format=pax - ${tar} -c ${fmt} -f "${PROGRAM}-${REL}.tar" "${PROGRAM}-${REL}" - < "${PROGRAM}-${REL}.tar" ${xz} -e -C sha256 > "${PROGRAM}-${REL}.tar.xz" - < "${PROGRAM}-${REL}.tar" ${gzip} -9 > "${PROGRAM}-${REL}.tar.gz" - ${rm} "${PROGRAM}-${REL}.tar" - - printf '' > "${PROGRAM}-${REL}.cksum" - ${openssl} sha1 "${PROGRAM}-${REL}.tar.xz" >> "${PROGRAM}-${REL}.cksum" - ${openssl} sha256 "${PROGRAM}-${REL}.tar.xz" >> "${PROGRAM}-${REL}.cksum" - ${openssl} sha512 "${PROGRAM}-${REL}.tar.xz" >> "${PROGRAM}-${REL}.cksum" - ${openssl} sha1 "${PROGRAM}-${REL}.tar.gz" >> "${PROGRAM}-${REL}.cksum" - ${openssl} sha256 "${PROGRAM}-${REL}.tar.gz" >> "${PROGRAM}-${REL}.cksum" - ${openssl} sha512 "${PROGRAM}-${REL}.tar.gz" >> "${PROGRAM}-${REL}.cksum" - - echo >> "${PROGRAM}-${REL}.cksum" - ${gpg} --detach-sign --armor "${PROGRAM}-${REL}.tar.xz" - ${cat} "${PROGRAM}-${REL}.tar.xz.asc" >> "${PROGRAM}-${REL}.cksum" - ${gpg} --detach-sign --armor "${PROGRAM}-${REL}.tar.gz" - ${cat} "${PROGRAM}-${REL}.tar.gz.asc" >> "${PROGRAM}-${REL}.cksum" - - [ -f "${PROGRAM}".cat1 ] && - < "${PROGRAM}".cat1 ${xz} -e -C sha256 > "${PROGRAM}-${REL}.cat1.xz" - [ -f "${PROGRAM}".xcat1 ] && - < "${PROGRAM}".xcat1 ${xz} -e -C sha256 > "${PROGRAM}-${REL}.xcat1.xz" - ) - else - bigballs= - fi -} - -announcement_prepare() { - anntxt= - if yesno 'Prepare announcement?'; then :; else - return - fi - anntxt=y - - if `${git} cat-file -e ${relbrname}:NEWS 2>/dev/null`; then - ${git} show ${relbrname}:NEWS > "${TMPDIR}/.${PROGRAM}-${REL}.news" - else - printf '' > "${TMPDIR}/.${PROGRAM}-${REL}.news" - fi - - { echo "${relmsg}"; echo; } > "${TMPDIR}/${PROGRAM}-${REL}.txt" - if [ -f .git/make-release.txt ]; then - # For the checksums - if [ -n "${bigballs}" ] && [ -f "${TMPDIR}/${PROGRAM}-${REL}.cksum" ] - then - cks=`< "${TMPDIR}/${PROGRAM}-${REL}.cksum" \ - ${sed} -e 's/ //' -e '/^$/,$d'` - < "${TMPDIR}/${PROGRAM}-${REL}.cksum" ${sed} '1,/^$/d' \ - > "${TMPDIR}/.${PROGRAM}-${REL}.sigs" - < .git/make-release.txt ${awk} \ - -v INS="${cks}" -v SIGS="${TMPDIR}/.${PROGRAM}-${REL}.sigs" \ - -v NEWS="${TMPDIR}/.${PROGRAM}-${REL}.news" ' - /-----CHECKSUMS-----/{ - atop = split(INS, a) - fn = "" - for(i = 1; i <= atop; ++i){ - match(a[i], /(\(.+\))/) - tfn = substr(a[i], RSTART + 1, RLENGTH - 2) - tpre = substr(a[i], 1, RSTART - 1) - tsuf = substr(a[i], RSTART + RLENGTH + 1) - if(fn == "" || fn != tfn) - printf "%s:\n", (fn = tfn) - printf " %6s %s\n", tpre, tsuf - } - next - } - /-----SIGNATURES-----/{ - while((getline sl < SIGS) > 0) - print sl - next - } - /-----NEWS-----/{ - while((getline sl < NEWS) > 0) - print sl - next - } - {print} - ' >> "${TMPDIR}/${PROGRAM}-${REL}.txt" - ${rm} -f "${TMPDIR}/.${PROGRAM}-${REL}.sigs" - else - < .git/make-release.txt ${awk} \ - -v NEWS="${TMPDIR}/.${PROGRAM}-${REL}.news" ' - /-----NEWS-----/{ - while((getline sl < NEWS) > 0) - print sl - next - } - {print} - ' >> "${TMPDIR}/${PROGRAM}-${REL}.txt" - fi - elif [ -f "${TMPDIR}/.${PROGRAM}-${REL}.news" ]; then - ${cat} "${TMPDIR}/.${PROGRAM}-${REL}.news" >> \ - "${TMPDIR}/${PROGRAM}-${REL}.txt" - fi - - ${rm} -f "${TMPDIR}/.${PROGRAM}-${REL}.news" - - LC_ALL=${ORIG_LC_ALL} ${EDITOR} "${TMPDIR}/${PROGRAM}-${REL}.txt" - - # HTML convert ready for S-Web42 - APO=\' - < "${TMPDIR}/${PROGRAM}-${REL}.txt" ${awk} -v manual="${MANUAL}" ' - BEGIN{ - hot = 0 - print "
"
-   }
-   function strips(){
-      gsub("&", "\\&")
-      gsub("<", "\\<")
-      gsub(">", "\\>")
-   }
-   function urls(){
-      any = 0
-      res = ""
-      s = $0
-
-      while(match(s, /(\\?https?\??:\/\/[^ ]*)/)){
-         pre = substr(s, 1, RSTART - 1)
-         mat = substr(s, RSTART, RLENGTH)
-         s = substr(s, RSTART + RLENGTH)
-         if("\\" == substr(mat, 1, 1))
-            mat = substr(mat, 2)
-         else{
-            xt = 0
-            if(match(mat, /^https\?/))
-               mat = "https" substr(xt = mat, RSTART + 6)
-            if(match(mat, /sdaoden\.eu/))
-               mat = "" xt : "") "?>"
-            else
-               mat = "" xt : "") "?>"
-         }
-         res = res pre mat
-         any = 1
-      }
-      if(any && length(s))
-         res = res s
-      $0 = any ? res : s
-   }
-   /^[ 	]*s-.*-mode[ 	]*$/{
-      exit 0
-   }
-   /^(NOTES|ChangeLog)/{
-      hot = 1
-      strips()
-      print
-      next
-   }
-   /^(Appendix|git\(1\) shortlog)/{
-      hot = -1
-      strips()
-      print
-      next
-   }
-   {
-      strips()
-      urls()
-      if(hot <= 0){
-         print
-         next
-      }
-      any = 0
-      res = ""
-      s = $0
-      # Create S-Web42 local references for the possible anchors:
-      #     *XY*# / $XY# / -XY# / `XY${APO}# / `~XY${APO}# / "XY"#
-      # (where the mdocmx(7) anchor follows the number sign).
-      # Ideally the anchors have been automatically expanded by
-      # make-news-anchors.sh before.
-      while(match(s,
-            /(^|\(|[ 	]+)("[^"]+"|\*[^\*]+\*|`[^'${APO}']+'${APO}'|[-~][-#\/:_.0-9a-zA-Z]+|\$[_0-9a-zA-Z]+)#[0-9]+/))
-      {
-         pre = (RSTART > 1) ? substr(s, 1, RSTART - 1) : ""
-         mat = substr(s, RSTART, RLENGTH)
-         s = substr(s, RSTART + RLENGTH)
-
-         # Unfortunately groups are not supported
-         if(match(mat, /^(\(|[ 	]+)/) != 0 && RLENGTH > 0){
-            pre = pre substr(mat, 1, RLENGTH)
-            mat = substr(mat, RSTART + RLENGTH)
-         }
-
-         match(mat, /#[0-9]+/)
-         targ = substr(mat, RSTART + 1, RLENGTH)
-         mat = substr(mat, 1, RSTART - 1)
-         res = res pre "" mat "?>"
-         any = 1
-      }
-      if(any && length(s))
-         res = res s
-      print any ? res : s
-   }
-   END{
-      print "
" - } - ' > "${TMPDIR}/.${PROGRAM}-ann.html" -} - -upload() ( - if [ -n "${bigballs}" ] && yesno 'Upload archives'; then :; else - return - fi - cd "${TMPDIR}" - - { - echo "-put ${PROGRAM}-${REL}.tar.xz" - echo "-rm ${PROGRAM}-latest.tar.xz" - echo "-ln -s ${PROGRAM}-${REL}.tar.xz ${PROGRAM}-latest.tar.xz" - - echo "-put ${PROGRAM}-${REL}.tar.xz.asc" - echo "-rm ${PROGRAM}-latest.tar.xz.asc" - echo "-ln -s ${PROGRAM}-${REL}.tar.xz.asc ${PROGRAM}-latest.tar.xz.asc" - - echo "-put ${PROGRAM}-${REL}.tar.gz" - echo "-rm ${PROGRAM}-latest.tar.gz" - echo "-ln -s ${PROGRAM}-${REL}.tar.gz ${PROGRAM}-latest.tar.gz" - - echo "-put ${PROGRAM}-${REL}.tar.gz.asc" - echo "-rm ${PROGRAM}-latest.tar.gz.asc" - echo "-ln -s ${PROGRAM}-${REL}.tar.gz.asc ${PROGRAM}-latest.tar.gz.asc" - - if [ -n "${anntxt}" ]; then - echo "-put ${PROGRAM}-${REL}.txt" - echo "-rm ${PROGRAM}-latest.txt" - echo "-ln -s ${PROGRAM}-${REL}.txt ${PROGRAM}-latest.txt" - fi - - echo "-chmod 0644 ${PROGRAM}-${REL}.*" - } | - ${sftp} -b - ${UPLOAD} -) - -announcement_send() { - if [ -n "${anntxt}" ] && yesno 'Send announcement mail?'; then - LC_ALL=${ORIG_LC_ALL} ${MAILX} -A ${ACCOUNT} \ - -s "[ANN]ounce of ${UPROGRAM} v${REL}${RELSYM}" \ - -q "${TMPDIR}/${PROGRAM}-${REL}.txt" \ - -b ${MAILBCC} ${MAILTO} - fi -} - -create_grappa_env() { - echo 'Updating files: calling update_release_hook' - update_release_hook - echo 'E allora io quasi quasi prendo il treno' -} - -grappa= -if [ ${#} -ne 0 ]; then - if [ ${#} != 2 ] || [ "${1}" != grappa ] || [ -z "${2}" ]; then - echo >&2 'You have a hell of a lot to learn about Rock'"'"'n Roll' - exit 55 - fi - grappa=${2} -fi - -ref_status -echo 'Preparing a release on commit '"${headref}" -if [ -z "${grappa}" ]; then - printf ' The HEAD is %s\nName of release tag: ' "${brname}" - read REL - VERSION=${REL} - release_version - release_brcheck - release_symname -else - echo 'Grappa to be brought from '"${brname}"' to '"${grappa}" - current_version - printf 'Program version is %s, packager release addition shall be: ' \ - "${VERSION}" - read REL - VERSION="${VERSION}-${REL}" - release_version - - i= - if ${git} rev-parse --verify ${grappa} >/dev/null 2>/dev/null; then :; else - i=-B - fi - ${git} checkout ${i} ${grappa} - ${git} rm -f '*' - ${git} archive --format=tar ${headref} | ${tar} -x -f - - ${git} add . -fi - -echo 'Updating files: calling update_stable_hook' -update_stable_hook - -if [ -z "${grappa}" ]; then - update_stable_branch - create_release_branch - test_release_hook v${REL}.ar || exit 1 - check_timeline_branch - repo_push - big_balls - announcement_prepare - upload - announcement_send -else - create_grappa_env -fi - - -# Finally remove the temporary instances than ran this -${rm} -f .git/make-release.* -echo 'Done' -exit -# s-sh-mode diff --git a/mk/make-release.sh b/mk/make-release.sh deleted file mode 100644 index 27a19afa..00000000 --- a/mk/make-release.sh +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/sh - -#@ make-release.sh: simple somewhat generic release builder - -# In order to be able to remove the release scripts from the release tarball, -# we must delete them, which some shells may not like while they are running. -# So be safe and move instances temporarily to .git/, the .inc will remove them -if [ "`basename \`pwd\``" != .git ]; then - [ -d mk ] || exit 84 - - cp mk/make-release.* .git/ - cd .git - exec sh ./make-release.sh "${@}" -fi -cd .. - -## Variables - -: ${PROGRAM:=s-nail} -: ${UPROGRAM:=S-nail} -: ${MANUAL:=code-nail.html} - -: ${UPLOAD:=steffen@vpn.sdaoden.eu:/var/www/localhost/downloads} - -: ${MAILX:='s-nail -Snofollowup-to -Sreply-to=mailx -Ssmime-sign'} -: ${ACCOUNT:=ich} -: ${MAILBCC:=mailx-announce-bcc} -: ${MAILTO:=mailx-announce} - -have_perl= -if command -v perl >/dev/null 2>&1; then - have_perl=1 -fi - -if command -v s-nail >/dev/null 2>&1; then :; else - echo >&2 'We need s-nail in the path in order to update errors etc.!' - echo >&2 '(To create hashtables of those, to be exact.)' - exit 1 -fi - -## Hooks - -current_version() { - VERSION=`VERSION= TOPDIR= \ - awk=${awk} grep=${grep} sed=${sed} cmp=${cmp} mv=${mv} \ - ${SHELL} mk/make-version.sh create` -} - -update_stable_hook() { - [ -n "${grappa}${have_perl}" ] || exit 86 - - # - echo 'gen-version.h: update' - TOPDIR= awk=${awk} grep=${grep} sed=${sed} cmp=${cmp} mv=${mv} \ - ${SHELL} mk/make-version.sh create - ${git} add -f include/mx/gen-version.h - - # - echo 'nail.1: expanding MKREL' - < nail.1 > nail.1x ${awk} ' - BEGIN { written = 0 } - /\.\\"--MKREL-START--/, /\.\\"--MKREL-END--/ { - if (written++ != 0) - next - print ".\\\"--MKREL-START--" - print ".\\\"@ '"${UPROGRAM}"' v'"${REL}"' / '"${DATE_ISO}"'" - print ".Dd '"${DATE_MAN}"'" - print ".ds VV \\\\%v'"${REL}"'" - print ".\\\"--MKREL-END--" - next - } - {print} - ' && - ${mv} -f nail.1x nail.1 - ${git} add nail.1 - - # - if [ -z "${grappa}" ] && command -v ${roff} >/dev/null 2>&1; then - echo 'NEWS: updating anchors' - < nail.1 ${SHELL} mk/mdocmx.sh | - MDOCMX_ENABLE=1 ${roff} -U -Tutf8 -mdoc \ - -dmx-anchor-dump=/tmp/anchors -dmx-toc-force=tree >/dev/null - ${SHELL} mk/make-news-anchors.sh /tmp/anchors < NEWS > NEWSx - ${mv} -f NEWSx NEWS - ${git} add NEWS - fi - - # - echo 'nail.rc: expanding MKREL' - < nail.rc > nail.rcx ${awk} ' - BEGIN { written = 0 } - /^#--MKREL-START--/, /^#--MKREL-END--/ { - if (written++ != 0) - next - print "#--MKREL-START--" - print "#@ '"${UPROGRAM}"' v'"${REL}"' / '"${DATE_ISO}"'" - print "#--MKREL-END--" - next - } - {print} - ' && - ${mv} -f nail.rcx nail.rc - ${git} add nail.rc - - # - ${make} d-cmd-tab && ${git} add -f src/mx/gen-cmd-tab.h - ${make} d-cs-ctype && ${git} add -f src/su/gen-cs-ctype.h - if [ -n "${have_perl}" ]; then - ${make} d-okeys && ${git} add -f src/mx/gen-okeys.h - ${make} d-tcaps && ${git} add -f src/mx/gen-tcaps.h - ${make} d-errors && ${git} add -f src/su/gen-errors.h - fi -} - -update_release_hook() { - # - echo 'nail.1: stripping MKREL etc.' - ${sed} -e '/^\.\\"--MKREL-START--/d' \ - -e '/^\.\\"--MKREL-END--/d' \ - -e '/--BEGINSTRIP--/,$ {' \ - -e '/^\.[ ]*$/d' -e '/^\.[ ]*\\"/d' \ - -e '}' \ - -e '/^\.$/d' \ - < nail.1 > nail.1x - ${mv} -f nail.1x nail.1 - ${SHELL} mk/mdocmx.sh < nail.1 > nail.1x - ${mv} -f nail.1x nail.1 - # And generate the HTML manual, while here - if [ -z "${grappa}" ] && command -v ${roff} >/dev/null 2>&1; then - echo 'nail.1: creating HTML manual' - < nail.1 MDOCMX_ENABLE=1 ${roff} -Thtml -mdoc > /tmp/nail-manual.html - fi - ${git} add nail.1 - - # - echo 'nail.rc: stripping MKREL etc.' - ${sed} -e '/^#--MKREL-START--/d' -e '/^#--MKREL-END--/d' \ - < nail.rc > nail.rcx - ${mv} -f nail.rcx nail.rc - ${git} add nail.rc - - echo 'include/su/*.h: stripping C++ code' - ( - cd include/su - ${sed} -i'' -e '/CXX_DOXYGEN/,/CXX_DOXYGEN/d' *.h - ${git} add . - ) - - ${make} d-cmd-tab-nv && ${git} add -f src/mx/gen-cmd-tab.h - ${make} d-cs-ctype-nv && ${git} add -f src/su/gen-cs-ctype.h - if [ -n "${have_perl}" ]; then - ${make} d-okeys-nv && ${git} add -f src/mx/gen-okeys.h - ${make} d-tcaps-nv && ${git} add -f src/mx/gen-tcaps.h - ${make} d-errors-nv && ${git} add -f src/su/gen-errors.h - perl mk/su-doc-strip.pl include/su/*.h && ${git} add include/su - fi - - # Solaris /bin/sh may expand ^ things - fs=`${git} grep -l '^su_USECASE_MX_DISABLED'` - ${git} rm -f .gitignore .mailmap TODO \ - \ - mk/make-news-anchors.sh mk/make-release.* \ - \ - mk/mdocmx.sh \ - \ - mk/su-doc-strip.pl mk/su-doxygen.rc mk/su-make-cs-ctype.sh \ - \ - ${fs} -} - -test_release_hook() { - ${git} archive --format=tar --prefix=.xxx/ ${1} | - ( - cd "${TMPDIR}" || exit 1 - trap "${rm} -rf \"${TMPDIR}\"/.xxx" EXIT - ${tar} -x -f - || exit 2 - cd .xxx || exit 3 - echo '!!! Test build !!!' - make tangerine DESTDIR=.yyy || exit 4 - ) - return ${?} -} - -. .git/make-release.inc - -# s-sh-mode diff --git a/mk/make-release.txt b/mk/make-release.txt deleted file mode 100644 index 087da876..00000000 --- a/mk/make-release.txt +++ /dev/null @@ -1,41 +0,0 @@ -Hello list, - -hereby i announce S-nail vXX.X.X, "". -It is . - -Credits, in order of commit appearance: - -We welcome in THANKS. - -Number games -^^^^^^^^^^^^ - -The release commit is [v...ar] on [release/v..] - , and it has also been stored on the [timeline]. -The [master/stable/v14.9] branch was tagged [v..]. - -The git(1) release commits and tags, as well as the release balls -have been signed with the OpenPGP signing subkey EEC8C2FF of key - - steffen@sdaoden.eu / 1883A0DD - (EE19 E1C1 F2F7 054F 8D39 54D8 3089 64B5 1883 A0DD) - -available on some OpenPGP key servers, my website (also WKD), -and download area (\https://ftp.sdaoden.eu/steffen.asc; -there is also \https://ftp.sdaoden.eu/steffen.asc.asc ..). -Inline copies of the signatures are at the end of this message. - ------CHECKSUMS----- - -These files and this announcement text are available as "-latest" -symbolic links, for example s-nail-latest.txt. - - Announcement : https?://www.sdaoden.eu/code-nail-ann.html - Manual : https?://www.sdaoden.eu/code-nail.html - Web : https?://www.sdaoden.eu/code.html#s-mailx - git(1) clone : \https?://git.sdaoden.eu/scm/s-nail.git - git(1) browse: https?://git.sdaoden.eu/browse/s-nail.git - ------NEWS----- - ------SIGNATURES----- diff --git a/mk/mdocmx.sh b/mk/mdocmx.sh deleted file mode 100644 index 41d28296..00000000 --- a/mk/mdocmx.sh +++ /dev/null @@ -1,771 +0,0 @@ -#!/bin/sh - -#@ mdocmx.sh - mdocmx(7) preprocessor for single-pass troff. -#@ mdocmx(7) extends the mdoc(7) semantic markup language by references, -#@ allowing mdoc(7) to create anchors and table of contents. -#@ Synopsis: mdocmx[.sh] [:-v:] [-t | -T Sh|sh|Ss|ss [-c]] [FILE] -#@ -v: increase verbosity -#@ -t: whether -toc lines shall be expanded to a flat .Sh TOC -#@ -T: whether -toc lines shall be expanded as specified: only .Sh / .Sh + .Ss -#@ -c: only with -t or -T: whether compact TOC display shall be generated -#@ Set $AWK environment to force a special awk(1) interpreter. -# -# Written 2014 - 2020 Steffen (Daode) Nurpmeso . -# Public Domain - -: ${TMPDIR:=/tmp} -: ${ENV_TMP="${TMPDIR}:${TMP}:${TEMP}"} - -# -- >8 -- 8< -- # - -# For heaven's sake add special treatment for SunOS/Solaris -if [ -d /usr/xpg4/bin ]; then - PATH=/usr/xpg4/bin:$PATH - export PATH -fi - -#AWK= -EX_OK=0 -EX_USAGE=64 -EX_DATAERR=65 -EX_TEMPFAIL=75 - -V=0 T= TT= F= - -( set -o noglob ) >/dev/null 2>&1 && set -o noglob - -find_awk() { - [ -n "${AWK}" ] && return 0 - i=${IFS} - IFS=: - set -- ${PATH}:/bin - IFS=${i} - # for i; do -- new in POSIX Issue 7 + TC1 - for i - do - if [ -z "${i}" ] || [ "${i}" = . ]; then - if [ -d "${PWD}" ]; then - i=${PWD} - else - i=. - fi - fi - for j in n m '' g; do - AWK="${i}/${j}awk" - [ -f "${AWK}" ] && [ -x "${AWK}" ] && return 0 - done - done - return 1 -} - -synopsis() { - ex=${1} msg=${2} - [ -n "${msg}" ] && echo >&2 ${msg} - [ ${ex} -eq 0 ] && f=1 || f=2 - ( echo "${0##*/}" ) >/dev/null 2>&1 && eval 'p="${0##*/}"' || p="${0}" - echo >&${f} "Synopsis: ${p} [-h]" - echo >&${f} " ${p} [:-v:] [-t | -T Sh|sh|Ss|ss [-c]] [FILE]" - exit ${ex} -} - -## - -if ( set -C ) >/dev/null 2>&1; then - set +C -else - # For heaven's sake auto-redirect on SunOS/Solaris - if [ -f /usr/xpg4/bin/sh ] && [ -x /usr/xpg4/bin/sh ]; then - exec /usr/xpg4/bin/sh "${0}" "${@}" - else - synopsis 1 'sh(1)ell without "set -C" (for safe temporary file creation)' - fi -fi - -find_awk || synopsis 1 'Cannot find a usable awk(1) implementation' - -while getopts hvtT:c i; do - case ${i} in - h) - synopsis ${EX_OK};; - v) - V=`expr ${V} + 1`;; - t) - [ x != x"${T}" ] && synopsis ${EX_USAGE} '-toc line expansion yet defined' - T=Sh;; - T) - [ x != x"${T}" ] && synopsis ${EX_USAGE} '-toc line expansion yet defined' - case "${OPTARG}" in - [Ss]h) T=Sh;; - [Ss]s) T=Ss;; - *) synopsis ${EX_USAGE} "Invalid -T argument: -- ${OPTARG}";; - esac;; - c) - TT=-compact;; - ?) - synopsis ${EX_USAGE} '';; - esac -done -[ -n "${TT}" ] && [ -z "${T}" ] && synopsis ${EX_USAGE} '-c requires -t or -T' -i=`expr ${OPTIND} - 1` -[ ${i} -gt 0 ] && shift ${i} - -[ ${#} -gt 1 ] && synopsis ${EX_USAGE} 'Excess arguments given' -[ ${#} -eq 0 ] && F=- || F=${1} - -## - -# awk(1) doesn't support signal handlers, which means that, when we're part of -# a pipe which the user terminates, we are not capable to deal with the broken -# pipe case that our END{} handler will generate when we had to perform any -# preprocessing, and that in turn would result in a dangling temporary file! -# Thus the only sane option seems to be to always create the temporary file, -# whether we need it or not, not to exec(1) awk(1) but keep on running shell -# in order to remove the temporary after awk(1) has finished, whichever way. - -find_tmpdir() { - i=${IFS} - IFS=: - set -- ${ENV_TMP} - IFS=${i} - # for i; do -- new in POSIX Issue 7 + TC1 - for tmpdir - do - [ -d "${tmpdir}" ] && return 0 - done - tmpdir=${TMPDIR} - [ -d "${tmpdir}" ] && return 0 - echo >&2 'Cannot find a usable temporary directory, please set $TMPDIR' - exit ${EX_TEMPFAIL} -} -find_tmpdir - -max=421 -[ ${V} -gt 1 ] && max=3 -i=1 -# RW by user only, avoid overwriting of existing files -old_umask=`umask` -umask 077 -while [ 1 ]; do - tmpfile="${tmpdir}/mdocmx-${i}.mx" - ( - set -C - : > "${tmpfile}" - ) >/dev/null 2>&1 && break - i=`expr ${i} + 1` - if [ ${i} -gt ${max} ]; then - echo >&2 'Cannot create a temporary file within '"${tmpdir}" - exit ${EX_TEMPFAIL} - fi -done -trap "exit ${EX_TEMPFAIL}" HUP INT QUIT PIPE TERM -trap "trap \"\" HUP INT QUIT PIPE TERM EXIT; rm -f ${tmpfile}" EXIT -umask ${old_umask} - -# Let's go awk(1) {{{ -APOSTROPHE=\' -${AWK} -v VERBOSE=${V} -v TOC="${T}" -v TOCTYPE="${TT}" -v MX_FO="${tmpfile}" \ - -v EX_USAGE="${EX_USAGE}" -v EX_DATAERR="${EX_DATAERR}" \ -'BEGIN{ - # The mdoc macros that support referenceable anchors. - # .Sh and .Ss also create anchors, but since they do not require .Mx they are - # treated special and handled directly -- update manual on change! - UMACS = "Ar Cd Cm Dv Er Ev Fl Fn Fo Ic In Pa Va Vt" - - # Some of those impose special rules for their arguments; mdocmx(1) solves - # this by outsourcing such desires in argument parse preparation hooks - UMACS_KEYHOOKS = "Fl Fn" - - # A list of all mdoc commands; taken from mdocml, "mdoc.c,v 1.226 2014/10/16" - UCOMMS = \ - "%A %B %C %D %I %J %N %O %P %Q %R %T %U %V " \ - "Ac Ad An Ao Ap Aq Ar At Bc Bd " \ - "Bf Bk Bl Bo Bq Brc Bro Brq Bsx Bt Bx " \ - "Cd Cm D1 Db Dc Dd Dl Do Dq Dt Dv Dx " \ - "Ec Ed Ef Ek El Em En Eo Er Es Ev Ex Fa Fc Fd Fl Fn Fo Fr Ft Fx " \ - "Hf " \ - "Ic In It " \ - "Lb Li Lk Lp " \ - "Ms Mt Nd Nm No Ns Nx " \ - "Oc Oo Op Os Ot Ox Pa Pc Pf Po Pp Pq " \ - "Qc Ql Qo Qq Re Rs Rv " \ - "Sc Sh Sm So Sq Ss St Sx Sy Ta Tn " \ - "Ud Ux Va Vt Xc Xo Xr " \ - "br ll sp" - - # Punctuation to be ignored (without changing current mode) - UPUNCTS = ". , : ; ( ) [ ] ? !" - - # -- >8 -- 8< -- # - - i = split(UMACS, savea) - for(j = 1; j <= i; ++j){ - k = savea[j] - MACS[k] = k - } - - i = split(UMACS_KEYHOOKS, savea) - for(j = 1; j <= i; ++j){ - k = savea[j] - MACS_KEYHOOKS[k] = k - } - - i = split(UCOMMS, savea) - for(j = 1; j <= i; ++j){ - k = savea[j] - COMMS[k] = k - } - - i = split(UPUNCTS, savea) - for(j = 1; j <= i; ++j){ - k = savea[j] - PUNCTS[k] = k - } - - mx_bypass = 0 # No work if parsing already preprocessed file! - - mx_nlcont = "" # Line continuation in progress? (Then: data so far) - mx_nlcontfun = 0 # Which function to call once line complete - NLCONT_SH_SS_COMM = 1 - NLCONT_MX_COMM = 2 - NLCONT_MX_CHECK_LINE = 3 - - #mx_sh[] # Arrays which store headlines, and their sizes - #mx_sh_cnt - #mx_sh_toc # Special avoidance of multiple TOC anchors needed, ++ - #mx_ss[] - #mx_ss_cnt - #mx_sh_ss[] # With TOC we need relation of .Ss with its .Sh - #mx_fo = "" # Our temporary output fork (cleaned of .Mx) - #mx_macros[] # Readily prepared anchors: macros.. - #mx_keys[] # ..: keys - #mx_anchors_cnt # ..number of anchors - #mx_stack[] # Stack of future anchors to be parsed off.. - #mx_stack_cnt # ..number thereof - #mx_keystack[] # User specified ".Mx MACRO KEY": store KEY somewhere - #ARG, [..] # Next parsed argument (from arg_parse() helper) -} - -END{ - # If we were forced to create referenceable anchors, dump the temporary file - # after writing our table-of-anchors (TAO :) - if(mx_fo){ - close(mx_fo) - - if(mx_stack_cnt > 0) - warn("At end of file: \".Mx\" stack not empty (" mx_stack_cnt " levels)") - - for(i = 1; i <= mx_sh_cnt; ++i){ - printf ".Mx -anchor-spass Sh \"%s\" %d\n", arg_quote(mx_sh[i]), i - for(j = 1; j <= mx_ss_cnt; ++j) - if(mx_sh_ss[j] == i) - printf ".Mx -anchor-spass Ss \"%s\" %d\n", - arg_quote(mx_ss[j]), mx_sh_ss[j] - } - - for(i = 1; i <= mx_anchors_cnt; ++i) - printf ".Mx -anchor-spass %s \"%s\"\n", - mx_macros[i], arg_quote(mx_keys[i]) - - # If we are about to produce a TOC, intercept ".Mx -toc" lines and replace - # them with the desired TOC content - if(!TOC){ - while((getline < mx_fo) > 0) - print - }else{ - while((getline < mx_fo) > 0){ - if($0 ~ /^[[:space:]]*\.[[:space:]]*Mx[[:space:]]+-toc[[:space:]]*/){ - print ".Sh \"\\*[mx-toc-name]\"" - if(mx_sh_cnt > 0){ - print ".Bl -inset", TOCTYPE - for(i = 1; i <= mx_sh_cnt; ++i){ - printf ".It Sx \"%s\"\n", arg_quote(mx_sh[i]) - if(TOC == "Ss") - toc_print_ss(i) - } - print ".El" - } - # Rather illegal, but maybe we have seen .Ss yet no .Sh: go! - else if(TOC == "Ss" && mx_ss_cnt > 0){ - print ".Bl -tag -compact" - for(i = 1; i <= mx_ss_cnt; ++i) - print ".It Sx \"%s\"\n", arg_quote(mx_ss[i]) - print ".El" - } - }else - print - } - } - } -} - -function f_a_l(){ - if(!fal){ - fal = FILENAME - if(!fal || fal == "-") - fal = "" - } - return fal ":" NR -} - -function dbg(s){ - if(VERBOSE > 1) - print "DBG@" f_a_l() ": " s > "/dev/stderr" -} - -function warn(s){ - if(VERBOSE > 0) - print "WARN@" f_a_l() ": mdocmx(7): " s "." > "/dev/stderr" -} - -function fatal(e, s){ - print "FATAL@" f_a_l() ": mdocmx(7): " s "." > "/dev/stderr" - exit e -} - -# Dump all .Ss which belong to the .Sh with the index sh_idx, if any -function toc_print_ss(sh_idx){ - tps_any = 0 - for(tps_i = 1; tps_i <= mx_ss_cnt; ++tps_i){ - tps_j = mx_sh_ss[tps_i] - if(tps_j < sh_idx) - continue - if(tps_j > sh_idx) - break - - if(!tps_any){ - tps_any = 1 - print ".Bl -tag -offset indent -compact" - } - printf ".It Sx \"%s\"\n", arg_quote(mx_ss[tps_i]) - } - if(tps_any) - print ".El" -} - -# Parse the next _roff_ argument from the awk(1) line (in $0). -# If "no" < 0, reset the parser and return whether the former state would -# have parsed another argument from the line. -# If "no" is >0 we start at $(no); if it is 0, iterate to the next argument. -# Returns ARG. Only used when "hot" -function arg_pushback(arg){ ap_pushback = arg } -function arg_parse(no){ - if(no < 0){ - no = ap_no - ap_no = 0 - ap_pushback = "" - return no < NF - } - if(no == 0){ - if(ap_pushback){ - ARG = ap_pushback - ap_pushback = "" - return ARG - } - no = ap_no + 1 - } - ap_pushback = "" - - ARG = "" - for(ap_i = 0; no <= NF; ++no){ - ap_j = $(no) - - # The good news about quotation mode is that entering it requires - # a preceeding space: we get it almost for free with awk(1)! - if(!ap_i){ - if(ap_j ~ /^"/){ - ap_i = 1 - ap_j = substr(ap_j, 2) - }else{ - ARG = ap_j - break - } - }else - ARG = ARG " " - - if((ap_k = index(ap_j, "\"")) != 0){ - do{ - # The bad news on quotation mode are: - # - "" inside it resolves to a single " - # - " need not mark EOS, but any " that is not followed by " - # ends quotation mode and marks the beginning of the next arg - # - awk(1) has no goto; - if(ap_k == length(ap_j)){ - ARG = ARG substr(ap_j, 1, ap_k - 1) - ap_no = no - ap_i = 0 - return ARG - }else if(substr(ap_j, ap_k + 1, 1) == "\""){ - ARG = ARG substr(ap_j, 1, ap_k) - ap_j = substr(ap_j, ap_k + 2) - }else{ - ARG = ARG substr(ap_j, 1, ap_k) - ap_j = substr(ap_j, ap_k + 1) - $(no) = ap_j - ap_no = no - ap_i = 0 - return ARG - } - }while((ap_k = index(ap_j, "\"")) > 0) - }else - ARG = ARG ap_j - } - ap_no = no - return ARG -} - -function arg_cleanup(arg){ - # Deal with common special glyphs etc. - # Note: must be in sync with mdocmx(7) macros (mx:cleanup-string)! - ac_i = match(arg, /([ \t]|\\&|\\%|\\\/|\\c)+$/) - if(ac_i) - arg = substr(arg, 1, ac_i - 1) - while(arg ~ /^[ \t]/) - arg = substr(arg, 1) - while(arg ~ /^(\\&|\\%)/ && arg !~ /^\\&\\&/) - arg = substr(arg, 3) - return arg -} - -function arg_quote(arg){ - aq_a = arg - gsub("\"", "\"\"", aq_a) - return aq_a -} - -# ".Mx -enable" seen -function mx_enable(){ - # However, are we running on an already preprocessed document? Bypass! - if(NF > 2){ - if($3 == "-preprocessed"){ - print - mx_bypass = 1 - return - } - } - - # If we generate the TOC ourselfs better ensure the string mx-toc-name! - # mdocml.bsd.lv (mandoc(1)) does not offer any ".if !d NAME" way, so.. - # But even otherwise we need it, since mandoc(1) complains about unknown - # \*[] strings in quoted strings, and we *may* have a ".Mx -toc" anyway! - if(!TOC) - printf ".\\\" Uncomment for mandoc(1) compat.:\n.\\\"" - print ".ds mx-toc-name TABLE OF CONTENTS" - mx_fo = MX_FO - $1 = $2 = "" - $0 = substr($0, 2) - print ".Mx -enable -preprocessed" $0 -} - -# Deal with a non-"-enable" ".Mx" request -function mx_comm(){ - # No argument: plain push - if(NF == 1){ - ++mx_stack_cnt - dbg(".Mx: [noarg] -> +1, stack size=" mx_stack_cnt) - return - } - - # ".Mx -disable" - if($2 == "-disable"){ - # Nothing to do here (and do not check device arguments) - return - } - - # ".Mx -ix" / ".Mx -sx" freely definable anchors - if($2 == "-sx") - # Nothing to do here (xxx check argument content validity?) - return - else if($2 == "-ix"){ - mxc_macro = arg_parse(3) - if(!mxc_macro) - fatal(EX_USAGE, "\".Mx -ix\": synopsis: \".Mx -ix [category] key\"") - if(!(mxc_key = arg_parse(0))){ - mxc_key = mxc_macro - mxc_macro = "ixsx" - }else if(arg_parse(-1)) - fatal(EX_DATAERR, "\".Mx -ix\": data after USER KEY is faulty syntax") - mxc_key = arg_cleanup(mxc_key) - dbg(".Mx -ix mac<" mxc_macro "> key <" mxc_key ">") - anchor_add(mxc_macro, mxc_key) - return - } - - # ".Mx -toc" - if($2 == "-toc"){ - # With TOC creation we surely want the TOC to have an anchor, too! - if(!mx_sh_toc++) - mx_sh[++mx_sh_cnt] = "\\*[mx-toc-name]" - else - warn("\".Mx -toc\": multiple TOCs? Duplicate anchor avoided") - return - } - - # This explicitly specifies the macro to create an anchor for next - mxc_i = $2 - if(mxc_i ~ /^\./){ - warn("\".Mx\": stripping dot prefix from \"" mxc_i "\"") - mxc_i = substr(mxc_i, 2) - } - - mxc_j = MACS[mxc_i] - if(!mxc_j) - fatal(EX_DATAERR, "\".Mx\": macro \"" mxc_i "\" not supported") - mx_stack[++mx_stack_cnt] = mxc_i - dbg(".Mx: for next \"." mxc_i "\", stack size=" mx_stack_cnt) - - # Do we also have a fixed key? - if(NF == 2) - return - mx_keystack[mx_stack_cnt] = arg_parse(3) - dbg(" ... USER KEY given: <" ARG ">") - if(arg_parse(-1)) - fatal(EX_DATAERR, "\".Mx\": data after USER KEY is faulty syntax") -} - -# mx_stack_cnt is >0, check whether this line will pop the stack -function mx_check_line(){ - # May be line continuation in the middle of nowhere - if(!mx_stack_cnt) - return - # Must be a non-comment, non-escaped macro line - if($0 !~ /^[[:space:]]*[.'${APOSTROPHE}'][[:space:]]*[^"#]/) - return - - # Iterate over all arguments and try to classify them, comparing them against - # stack content as applicable - mcl_mac = "" - mcl_cont = 0 - mcl_firstmac = 1 - for(arg_parse(-1); arg_parse(0);){ - # Solely ignore punctuation (xxx are we too stupid here?) - if(PUNCTS[ARG]) - continue - - # (xxx Do this at the end of the loop instead, after decrement?) - if(mx_stack_cnt == 0){ - dbg("stack empty, stopping arg processing before <" ARG ">") - break - } - - mcl_j = mx_stack[mx_stack_cnt] - - # Is this something we consider a macro? For convenience and documentation - # of roff stuff do auto-ignore a leading dot of the name in question - mcl_cont = 0 - if(mcl_firstmac && ARG ~ /^\./) - ARG = substr(ARG, 2) - mcl_firstmac = 0 - mcl_i = MACS[ARG] - if(mcl_i) - mcl_mac = mcl_i - else{ - if(!mcl_mac) - continue - # It may be some mdoc command nonetheless, ensure it does not fool our - # simpleminded processing, and end possible mcl_mac savings - if(COMMS[ARG]){ - if(mcl_j) - dbg("NO POP due macro (got<" ARG "> want<" mcl_j ">)") - mcl_mac = "" - continue - } - mcl_i = mcl_mac - mcl_cont = 1 - } - - # Current command matches the one on the stack, if there is any - if(mcl_j){ - if(mcl_i != mcl_j){ - dbg("NO POP due macro (got<" mcl_i "> want<" mcl_j ">)") - mcl_mac = "" - continue - } - } - - # We need the KEY - if(!mcl_cont && !arg_parse(0)) - fatal(EX_DATAERR, "\".Mx\": expected KEY after \"" mcl_mac "\"") - ARG = arg_cleanup(ARG) - if(ARG ~ /^\\&\\&/) - warn("\".Mx\": KEY starting with \"\\&\\&\" will never match: " ARG) - if(MACS_KEYHOOKS[mcl_mac]) - _mx_check_line_keyhook() - - if(mx_keystack[mx_stack_cnt]){ - mcl_i = mx_keystack[mx_stack_cnt] - if(mcl_i != ARG){ - dbg("NO POP mac<" mcl_mac "> due key (got<" ARG "> want <" mcl_i ">)") - continue - } - delete mx_keystack[mx_stack_cnt] - mcl_i = "STACK" - }else - mcl_i = "USER" - - delete mx_stack[mx_stack_cnt--] - dbg("POP mac<" mcl_mac "> " mcl_i " key <" ARG \ - "> stack size=" mx_stack_cnt) - - anchor_add(mcl_mac, ARG) - } -} - -function _mx_check_line_keyhook(){ - # .Fl: arguments may be continued via |, as in ".Fl a | b | c" - if(mcl_mac == "Fl"){ - mclpkh_i = ARG - for(mclpkh_j = 0;; ++mclpkh_j){ - if(!arg_parse(0)) - break - if(ARG != "|"){ - arg_pushback(ARG) - break - } - if(!arg_parse(0)){ - warn("Premature end of \".Fl\" continuation via \"|\"") - break - } - # Be aware that this argument may indeed be a macro - # XXX However, only support another Fl as in - # XXX .Op Fl T | Fl t Ar \&Sh | sh | \&Ss | ss - # XXX We are too stupid to recursively process any possible thing, - # XXX more complicated recursions are simply not supported - if(ARG == "Fl"){ - arg_pushback(ARG) - break - } - ARG = arg_cleanup(ARG) - mclpkh_i = mclpkh_i " | " ARG - } - ARG = mclpkh_i - } - # .Fn: in ".Fn const char *funcname" all we want is "funcname" - else if(mcl_mac == "Fn"){ - if(ARG ~ /[*&[:space:]]/){ - mclpkh_i = match(ARG, /[^*&[:space:]]+$/) - ARG = arg_cleanup(substr(ARG, mclpkh_i)) - } - } -} - -# Add one -anchor-spass macro/key pair -function anchor_add(macro, key){ - for(aa_i = 1; aa_i <= mx_anchors_cnt; ++aa_i) - if(mx_macros[aa_i] == macro && mx_keys[aa_i] == key){ - warn("\".Mx\": mac<" macro ">: duplicate anchor avoided: " key) - return - } - ++mx_anchors_cnt - mx_macros[mx_anchors_cnt] = macro - mx_keys[mx_anchors_cnt] = key -} - -# Handle a .Sh or .Ss -function sh_ss_comm(){ - ssc_s = "" - ssc_i = 0 - for(arg_parse(-1); arg_parse(0); ++ssc_i){ - if(ssc_i < 1) - continue - if(ssc_i > 1) - ssc_s = ssc_s " " - ssc_s = ssc_s ARG - } - ssc_s = arg_cleanup(ssc_s) - if($1 ~ /Sh/) - mx_sh[++mx_sh_cnt] = ssc_s - else{ - if(mx_sh_cnt == 0) - fatal(EX_DATAERR, ".Ss at beginning of document not allowed by mdoc(7)") - mx_ss[++mx_ss_cnt] = ssc_s - mx_sh_ss[mx_ss_cnt] = mx_sh_cnt - } -} - -# This is our *very* primitive way of dealing with line continuation -function line_nlcont_add(fun){ - mx_nlcont = mx_nlcont $0 - mx_nlcont = substr(mx_nlcont, 1, length(mx_nlcont) - 1) - if(!mx_nlcontfun) - mx_nlcontfun = fun -} - -function line_nlcont_done(){ - lnd_save = $0 - $0 = mx_nlcont $0 - mx_nlcont = "" - if(mx_nlcontfun == NLCONT_SH_SS_COMM) - sh_ss_comm() - else if(mx_nlcontfun == NLCONT_MX_COMM) - mx_comm() - else if(mx_nlcontfun == NLCONT_MX_CHECK_LINE) - mx_check_line() - else - fatal(EX_DATAERR, "mdocmx(1) implementation error: line_nlcont_done()") - mx_nlcontfun = 0 - $0 = lnd_save # simplify callees life -} - -# .Mx is a line that we care about -/^[[:space:]]*[.'${APOSTROPHE}'][[:space:]]*M[Xx][[:space:]]*/{ - if(mx_bypass) - print - else if(mx_fo){ - if(NF > 1 && $2 == "-enable") - fatal(EX_USAGE, "\".Mx -enable\" may be used only once") - if(mx_nlcont) - fatal(EX_DATAERR, "Line continuation too complicated for mdocmx(1)") - if($0 ~ /\\$/) - line_nlcont_add(NLCONT_MX_COMM) - else - mx_comm() - print >> mx_fo - }else if(NF < 2 || $2 != "-enable") - fatal(EX_USAGE, "\".Mx -enable\" must be the first \".Mx\" command") - else - mx_enable() - next -} - -# .Sh and .Ss are also lines we care about, but always store the data in -# main memory, since those commands occur in each mdoc file -/^[[:space:]]*[.'${APOSTROPHE}'][[:space:]]*S[hs][[:space:]]+/{ - if(mx_fo){ - if(mx_nlcont) - fatal(EX_DATAERR, "Line continuation too complicated for mdocmx(1)") - if($0 ~ /\\$/) - line_nlcont_add(NLCONT_SH_SS_COMM) - else - sh_ss_comm() - print >> mx_fo - next - } -} - -# All other lines are uninteresting unless mdocmx is -enabled and we have -# pending anchor creation requests on the stack -{ - if(!mx_fo) - print - else{ - # TODO No support for any macro END but .. - if(/^[[:space:]]*[.'${APOSTROPHE}'][[:space:]]*dei?1?[[:space:]]+/){ - if(mx_nlcont) - fatal(EX_DATAERR, "Line continuation too complicated for mdocmx(1)") - print >> mx_fo - while(getline > 0 && $0 !~ /^\.\.$/) - print >> mx_fo - }else if($0 ~ /\\$/) - line_nlcont_add(NLCONT_MX_CHECK_LINE) - else if(mx_nlcont) - line_nlcont_done() - else if(mx_stack_cnt) - mx_check_line() - else if(/^[[:space:]]*\.(\\"|[[:space:]]*$)/) - next - print >> mx_fo - } -}' "${F}" -# }}} - -exit -# s-it2-mode diff --git a/mk/su-doc-strip.pl b/mk/su-doc-strip.pl deleted file mode 100644 index 1a66e71b..00000000 --- a/mk/su-doc-strip.pl +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env perl -require 5.008_001; -#@ Strip *! style documents from C/C++ code. -#@ Assumes that such lines are exclusive, and that /*!< */ lines -#@ are followed by no other such comment. -#@ Synopsis: su-doc-strip.pl :FILE: -# Public Domain - -## -- >8 -- 8< -- ## - -use diagnostics -verbose; -use strict; -use warnings; - -sub main_fun{ - die 'False usage' if @ARGV == 0; - - while(@ARGV > 0){ - my ($f, $i, $fd, @lines) = (shift @ARGV, 0); - - # Read it, stripping the comments - die "Cannot open $f for reading: $^E" - unless open $fd, '<:raw', $f; - while(<$fd>){ - chomp; - if($i){ - if($_ =~ /^(.*?)\*\/[[:space:]]*(.*)$/){ - $i = 0; - push @lines, $2 if length $2 - } - }elsif($_ =~ /^(.*?)[[:space:]]*\/\*!(.*)$/){ - my ($m1, $m2) = ($1, $2); - if($m2 =~ /^(.*?)\*\/[[:space:]]*(.*)$/){ - my $l = $m1 . $2; - push @lines, $l if length($l) - }else{ - $i = 1; - push @lines, $m1 if length $m1 - } - }else{ - push @lines, $_ if length $_ - } - } - die "Cannot close $f after reading: $^E" - unless close $fd; - - die "Cannot open $f for writing: $^E" - unless open $fd, '>:raw', $f; - while(@lines){ - $i = shift @lines; - die "Cannot write to $f: $^E" - unless print $fd $i, "\n" - } - die "Cannot close $f after writing: $^E" - unless close $fd - } - exit 0 -} - -{package main; main_fun()} - -# s-it-mode diff --git a/mk/su-doxygen.rc b/mk/su-doxygen.rc deleted file mode 100644 index fc3bba71..00000000 --- a/mk/su-doxygen.rc +++ /dev/null @@ -1,80 +0,0 @@ -#@ SU: doxygen(1) configuration - -PROJECT_NAME = S-nail -PROJECT_NUMBER = 14.9.12 -PROJECT_BRIEF = "Send and receive Internet mail" -INPUT = include/su -EXCLUDE_PATTERNS = gen-*.* -OUTPUT_DIRECTORY = .doc -#OPTIMIZE_OUTPUT_FOR_C = YES -HIDE_UNDOC_MEMBERS = YES -SHOW_INCLUDE_FILES = NO -MAX_INITIALIZER_LINES = 0 -MACRO_EXPANSION = YES -#SKIP_FUNCTION_MACROS = NO -# Grrr: cannot include code-in.h, need to defined ALL the stuff again??! -# Define CXX_DOXYGEN to include C++ docu -PREDEFINED = DOXYGEN CXX_DOXYGEN \ - \ - su_HAVE_DEBUG \ - su_HAVE_DEVEL \ - su_HAVE_MEM_BAG_AUTO \ - su_HAVE_MEM_BAG_LOFI \ - su_HAVE_MEM_CANARIES_DISABLE \ - \ - __STDC_VERSION__=999912L C_LANG \ - C_DECL_BEGIN C_DECL_END NSPC_BEGIN NSPC_END \ - EXPORT EXPORT_DATA SINLINE INLINE \ - su_DBG_LOC_ARGS_DECL= su_DBG_LOC_ARGS_DECL_SOLE= \ - CTA(X)= MCTA(X)= NSPC(X)= \ - u8:=su_u8 s8:=su_s8 u16:=su_u16 s16:=su_s16 \ - u32:=su_u32 s32:=su_s32 u64:=su_u64 s64:=su_s64 \ - uz:=su_uz sz:=su_sz up:=su_up sp:=su_sp \ - boole:=su_boole \ - -#EXPAND_ONLY_PREDEF = YES -#-> EXPAND_AS_DEFINED = C_DECL_BEGIN EXPORT EXPORT_DATA -#RECURSIVE = YES -INLINE_GROUPED_CLASSES = YES -INLINE_SIMPLE_STRUCTS = YES -GROUP_NESTED_COMPOUNDS = YES -REPEAT_BRIEF = YES -SHORT_NAMES = YES -#GENERATE_HTML = YES -HTML_DYNAMIC_MENUS = NO -HTML_DYNAMIC_SECTIONS = YES -GENERATE_LATEX = NO -#GENERATE_MAN = yes -## -#ALIASES += test{1}="\ref \1" -#-> \test{ARG} -#ALIASES += test{2}="\ref \1 \"\2\"" -#-> \test{ARG,some text} [this overloads \test!] -#ALIASES += title{1}= -# NOTE: we need the HTML tags since doxygen will merge "\r{BLA}." to -# "\ref BLA.", i.e., we need to somehow inject a separator! -ALIASES += SU="\em SU" -ALIASES += SELF="\em self" -ALIASES += THIS="\em this" -ALIASES += NIL="\r{su_NIL}" -ALIASES += FAL0="\r{su_FAL0}" -ALIASES += TRU1="\r{su_TRU1}" -ALIASES += TRUM1="\r{su_TRUM1}" -ALIASES += ASSERT{2}="Debug-assertion: returns \1 if \2." -ALIASES += a{1}="\a \1" -ALIASES += c{1}="\c \1" -ALIASES += cb{1}="
\code \1\endcode
" -ALIASES += copydoc{1}="\r{\1}:  \copydoc \1  " -ALIASES += ERR{1}="\c{su_ERR_\1} (\r{su_err_number})" -ALIASES += err{1}="\c{err::\1} (\r{err})" -ALIASES += fn{1}="\c{\1}" -ALIASES += head1{1}="\par \1^^" -ALIASES += head2{1}="\par \1^^" -ALIASES += li{1}="\li \pb{\1}" -ALIASES += list{1}="
\1
" -ALIASES += ln{1}="\link \1\endlink" -ALIASES += pb{1}="
\parblock \1\endparblock
" -ALIASES += r{1}="\ref \1" -ALIASES += remarks{1}="\remarks
\parblock \1\endparblock
" -ALIASES += vr{1}="\c{\1}" -ALIASES += xln{1}="\c{\1}" diff --git a/mk/su-make-cs-ctype.sh b/mk/su-make-cs-ctype.sh deleted file mode 100644 index 2a20c4c4..00000000 --- a/mk/su-make-cs-ctype.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh - -#@ Create src/su/gen-cs-ctype.h. -# Public Domain - -OUT=src/su/gen-cs-ctype.h - -# Generate a more verbose output. Not for shipout versions. -VERB=1 - -## - -LC_ALL=C -export LC_ALL OUT - -create() { - # Note this may be ISO C89, so we cannot - cat <<__EOT__ - #include - #include - #include - #include - #define su_S(T,I) ((T)(I)) - #define u8 uint8_t - #define S8_MAX INT8_MAX - static void - a_csc_init(FILE *fp){ - u8 i, any; - char const *xpre, *pre; - - fprintf(fp, "CTAV(su_CS_CTYPE_NONE == 0);\n" - "#undef a_X\n" - "#define a_X(X) su_CONCAT(su_CS_CTYPE_,X)\n" - "u16 const su__cs_ctype[S8_MAX + 1] = {\n"); - xpre = $VERB ? " | " : "|"; - i = 0; - do{ - any = 0, pre = ""; - if($VERB) - fprintf(fp, " /* 0x%02X=%c */ ", - (unsigned)i, (isprint(i) ? (char)i : '?')); - if(isalnum(i)) - fprintf(fp, "%sa_X(ALNUM)", pre), any = 1, pre = xpre; - if(isalpha(i)) - fprintf(fp, "%sa_X(ALPHA)", pre), any = 1, pre = xpre; - if(isblank(i)) - fprintf(fp, "%sa_X(BLANK)", pre), any = 1, pre = xpre; - if(iscntrl(i)) - fprintf(fp, "%sa_X(CNTRL)", pre), any = 1, pre = xpre; - if(isdigit(i)) - fprintf(fp, "%sa_X(DIGIT)", pre), any = 1, pre = xpre; - if(isgraph(i)) - fprintf(fp, "%sa_X(GRAPH)", pre), any = 1, pre = xpre; - if(islower(i)) - fprintf(fp, "%sa_X(LOWER)", pre), any = 1, pre = xpre; - if(isprint(i)) - fprintf(fp, "%sa_X(PRINT)", pre), any = 1, pre = xpre; - if(ispunct(i)) - fprintf(fp, "%sa_X(PUNCT)", pre), any = 1, pre = xpre; - if(isspace(i)) - fprintf(fp, "%sa_X(SPACE)", pre), any = 1, pre = xpre; - if(isupper(i)) - fprintf(fp, "%sa_X(UPPER)", pre), any = 1, pre = xpre; - if(isblank(i) || i == '\n') - fprintf(fp, "%sa_X(WHITE)", pre), any = 1, pre = xpre; - if(isxdigit(i)) - fprintf(fp, "%sa_X(XDIGIT)", pre), any = 1, pre = xpre; - if(!any) - fprintf(fp, "a_X(NONE)"); - fprintf(fp, ",\n"); - }while(i++ != S8_MAX); - fprintf(fp, "};\n#undef a_X\n"); - if($VERB) - fprintf(fp, "\n"); - - fprintf(fp, "u8 const su__cs_tolower[S8_MAX + 1] = {\n"); - i = any = 0; - do{ - if(any + 7 >= 78){ - fprintf(fp, "\n"); - any = 0; - } - if(any == 0 && $VERB) - fprintf(fp, " "), any = 3; - fprintf(fp, "'\\\x%02X',", (u8)tolower((char)i)); - any += 7; - }while(i++ != S8_MAX); - fprintf(fp, "\n};\n"); - if($VERB) - fprintf(fp, "\n"); - - fprintf(fp, "u8 const su__cs_toupper[S8_MAX + 1] = {\n"); - i = any = 0; - do{ - if(any + 7 >= 78){ - fprintf(fp, "\n"); - any = 0; - } - if(any == 0 && $VERB) - fprintf(fp, " "), any = 3; - fprintf(fp, "'\\\x%02X',", (u8)toupper((char)i)); - any += 7; - }while(i++ != S8_MAX); - fprintf(fp, "\n};\n"); - if($VERB) - fprintf(fp, "\n"); - } - int main(void){ - FILE *ofp = fopen("${OUT}", "a"); - if(ofp == NULL){ - fprintf(stderr, "ERROR: cannot open output\n"); - return 1; - } - fprintf(ofp, "/*@ ${OUT}, generated by su-make-cs-ctype.sh.\n" - " *@ See cs-ctype.c for more */\n\n"); - a_csc_init(ofp); - fclose(ofp); - return 0; - } -__EOT__ -} - -if [ ${#} -ne 0 ]; then - if [ "${1}" = noverbose ]; then - shift - VERB=0 - export VERB - fi -fi - -if [ ${#} -eq 0 ]; then - create > "${TMPDIR}"/su-mk-cs-ctype.c || exit 2 - ${CC} -o "${TMPDIR}"/su-mk-cs-ctype "${TMPDIR}"/su-mk-cs-ctype.c || exit 3 - rm -f src/su/gen-cs-ctype.h - "${TMPDIR}"/su-mk-cs-ctype || exit 4 - rm -f "${TMPDIR}"/su-mk-cs-ctype "${TMPDIR}"/su-mk-cs-ctype.c || exit 5 - exit 0 -fi -echo >&2 'Invalid usage' -exit 1 - -# s-it-mode diff --git a/nail.1 b/nail.1 index b7363fe2..a4238459 100644 --- a/nail.1 +++ b/nail.1 @@ -15,11 +15,9 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.\"--MKREL-START-- .\"@ S-nail v14.9.25 / 2024-06-27 .Dd June 27, 2024 .ds VV \\%v14.9.25 -.\"--MKREL-END-- .\"--MKMAN-START-- .ds UU \\%S-NAIL .ds UA \\%S-nail @@ -33,8 +31,6 @@ .ds vS /etc/mime.types .ds vU ~/.mime.types .\"--MKMAN-END-- -.\" --BEGINSTRIP-- -.\" .ds BO (Boolean) .ds CM (Compose mode) .ds ID [v15 behaviour may differ] @@ -45,24 +41,689 @@ .ds OU [no v15-compat] .ds RO (Read-only) .ds SM (Send mode) -.\" .if !d str-Lb-libterminfo \ .ds str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo) -. .Dt "\*(UU" 1 .Os -.Mx -enable -. -. +.\" Uncomment for mandoc(1) compat.: +.\".ds mx-toc-name TABLE OF CONTENTS +.Mx -enable -preprocessed +.Mx -anchor-spass Sh "NAME" 1 +.Mx -anchor-spass Sh "SYNOPSIS" 2 +.Mx -anchor-spass Sh "\*[mx-toc-name]" 3 +.Mx -anchor-spass Sh "DESCRIPTION" 4 +.Mx -anchor-spass Ss "Options" 4 +.Mx -anchor-spass Ss "A starter" 4 +.Mx -anchor-spass Ss "On sending mail, and non-interactive mode" 4 +.Mx -anchor-spass Ss "Compose mode" 4 +.Mx -anchor-spass Ss "On reading mail, and more on interactive mode" 4 +.Mx -anchor-spass Ss "HTML mail and MIME attachments" 4 +.Mx -anchor-spass Ss "Mailing lists" 4 +.Mx -anchor-spass Ss "Signed and encrypted messages with S/MIME" 4 +.Mx -anchor-spass Ss "On URL syntax and credential lookup" 4 +.Mx -anchor-spass Ss "Encrypted network communication" 4 +.Mx -anchor-spass Ss "Character sets" 4 +.Mx -anchor-spass Ss "Message states" 4 +.Mx -anchor-spass Ss "Specifying messages" 4 +.Mx -anchor-spass Ss "On terminal control and line editor" 4 +.Mx -anchor-spass Ss "Coloured display" 4 +.Mx -anchor-spass Ss "Handling spam" 4 +.Mx -anchor-spass Sh "COMMANDS" 5 +.Mx -anchor-spass Ss "Command modifiers" 5 +.Mx -anchor-spass Ss "Old-style argument quoting" 5 +.Mx -anchor-spass Ss "Shell-style argument quoting" 5 +.Mx -anchor-spass Ss "Message list arguments" 5 +.Mx -anchor-spass Ss "Raw data arguments for codec commands" 5 +.Mx -anchor-spass Ss "Filename transformations" 5 +.Mx -anchor-spass Ss "Commands" 5 +.Mx -anchor-spass Sh "COMMAND ESCAPES" 6 +.Mx -anchor-spass Sh "INTERNAL VARIABLES" 7 +.Mx -anchor-spass Ss "Initial settings" 7 +.Mx -anchor-spass Ss "Variables" 7 +.Mx -anchor-spass Sh "ENVIRONMENT" 8 +.Mx -anchor-spass Sh "FILES" 9 +.Mx -anchor-spass Ss "Resource files" 9 +.Mx -anchor-spass Ss "The mime.types files" 9 +.Mx -anchor-spass Ss "The Mailcap files" 9 +.Mx -anchor-spass Ss "The .netrc file" 9 +.Mx -anchor-spass Sh "EXAMPLES" 10 +.Mx -anchor-spass Ss "An example configuration" 10 +.Mx -anchor-spass Ss "S/MIME step by step" 10 +.Mx -anchor-spass Ss "Using CRLs with S/MIME or TLS" 10 +.Mx -anchor-spass Sh "FAQ" 11 +.Mx -anchor-spass Ss "\*(UA shortly hangs on startup" 11 +.Mx -anchor-spass Ss "I cannot login to Google mail \&(via OAuth\&)" 11 +.Mx -anchor-spass Ss "But, how about XOAUTH2 / OAUTHBEARER?" 11 +.Mx -anchor-spass Ss "Not \(dqdefunctional\(dq, but the editor key does not work" 11 +.Mx -anchor-spass Ss "Can \*(UA git-send-email?" 11 +.Mx -anchor-spass Ss "Howto handle stale dotlock files" 11 +.Mx -anchor-spass Sh "IMAP CLIENT" 12 +.Mx -anchor-spass Sh "SEE ALSO" 13 +.Mx -anchor-spass Sh "HISTORY" 14 +.Mx -anchor-spass Sh "AUTHORS" 15 +.Mx -anchor-spass Sh "CAVEATS" 16 +.Mx -anchor-spass Sh "BUGS" 17 +.Mx -anchor-spass Fl ":" +.Mx -anchor-spass Fl "A" +.Mx -anchor-spass Fl "a" +.Mx -anchor-spass ixsx "character set specification" +.Mx -anchor-spass Fl "b" +.Mx -anchor-spass Fl "C" +.Mx -anchor-spass Fl "c" +.Mx -anchor-spass Fl "D" +.Mx -anchor-spass Fl "d" +.Mx -anchor-spass Fl "E" +.Mx -anchor-spass Fl "e" +.Mx -anchor-spass Fl "F" +.Mx -anchor-spass Fl "f" +.Mx -anchor-spass Fl "H" +.Mx -anchor-spass Fl "h" +.Mx -anchor-spass Fl "i" +.Mx -anchor-spass Fl "L" +.Mx -anchor-spass Fl "M" +.Mx -anchor-spass Fl "m" +.Mx -anchor-spass Fl "N" +.Mx -anchor-spass Fl "n" +.Mx -anchor-spass Fl "q" +.Mx -anchor-spass Fl "R" +.Mx -anchor-spass Fl "r" +.Mx -anchor-spass Fl "S" +.Mx -anchor-spass Fl "s" +.Mx -anchor-spass Fl "T" +.Mx -anchor-spass Fl "t" +.Mx -anchor-spass Fl "u" +.Mx -anchor-spass Fl "V" +.Mx -anchor-spass Fl "v" +.Mx -anchor-spass Fl "X" +.Mx -anchor-spass Fl "Y" +.Mx -anchor-spass Fl "~" +.Mx -anchor-spass Fl "#" +.Mx -anchor-spass Fl "." +.Mx -anchor-spass ixsx "magic regular expression characters" +.Mx -anchor-spass Cd "mle-go-home" +.Mx -anchor-spass Cd "mle-go-bwd" +.Mx -anchor-spass Cd "mle-raise-int" +.Mx -anchor-spass Cd "mle-del-fwd" +.Mx -anchor-spass Cd "mle-go-end" +.Mx -anchor-spass Cd "mle-go-fwd" +.Mx -anchor-spass Cd "mle-reset" +.Mx -anchor-spass Cd "mle-del-bwd" +.Mx -anchor-spass Cd "mle-complete" +.Mx -anchor-spass Cd "mle-commit" +.Mx -anchor-spass Cd "mle-snarf-end" +.Mx -anchor-spass Cd "mle-repaint" +.Mx -anchor-spass Cd "mle-hist-fwd" +.Mx -anchor-spass Cd "mle-hist-bwd" +.Mx -anchor-spass Cd "mle-quote-rndtrip" +.Mx -anchor-spass Cd "mle-hist-srch-bwd" +.Mx -anchor-spass Cd "mle-hist-srch-fwd" +.Mx -anchor-spass Cd "mle-paste" +.Mx -anchor-spass Cd "mle-snarf-line" +.Mx -anchor-spass Cd "mle-prompt-char" +.Mx -anchor-spass Cd "mle-snarf-word-bwd" +.Mx -anchor-spass Cd "mle-go-word-fwd" +.Mx -anchor-spass Cd "mle-go-word-bwd" +.Mx -anchor-spass Cd "mle-raise-tstp" +.Mx -anchor-spass Cd "mle-cancel" +.Mx -anchor-spass Cd "mle-snarf-word-fwd" +.Mx -anchor-spass Cd "mle-bell" +.Mx -anchor-spass Cd "mle-clear-screen" +.Mx -anchor-spass Cd "mle-fullreset" +.Mx -anchor-spass Cd "mle-go-screen-bwd" +.Mx -anchor-spass Cd "mle-go-screen-fwd" +.Mx -anchor-spass Cd "mle-raise-quit:" +.Mx -anchor-spass Cm "\e" +.Mx -anchor-spass Cm "ignerr" +.Mx -anchor-spass Cm "local" +.Mx -anchor-spass Cm "scope" +.Mx -anchor-spass Cm "u" +.Mx -anchor-spass Cm "vput" +.Mx -anchor-spass Cm "wysh" +.Mx -anchor-spass ixsx "primary system mailbox" +.Mx -anchor-spass ixsx "secondary mailbox" +.Mx -anchor-spass Ic "!" +.Mx -anchor-spass Ic "#" +.Mx -anchor-spass Ic "+" +.Mx -anchor-spass Ic "-" +.Mx -anchor-spass Ic "=" +.Mx -anchor-spass Ic "?" +.Mx -anchor-spass Ic "|" +.Mx -anchor-spass Ic "account" +.Mx -anchor-spass Ic "unaccount" +.Mx -anchor-spass Ic "addrcodec" +.Mx -anchor-spass Ic "alias" +.Mx -anchor-spass Ic "unalias" +.Mx -anchor-spass Ic "alternates" +.Mx -anchor-spass Ic "unalternates" +.Mx -anchor-spass Ic "answered" +.Mx -anchor-spass Ic "unanswered" +.Mx -anchor-spass Ic "bind" +.Mx -anchor-spass Ic "unbind" +.Mx -anchor-spass Ic "call" +.Mx -anchor-spass Ic "call_if" +.Mx -anchor-spass Ic "cd" +.Mx -anchor-spass Ic "certsave" +.Mx -anchor-spass Ic "charsetalias" +.Mx -anchor-spass Ic "uncharsetalias" +.Mx -anchor-spass Ic "chdir" +.Mx -anchor-spass Ic "collapse" +.Mx -anchor-spass Ic "uncollapse" +.Mx -anchor-spass Ic "colour" +.Mx -anchor-spass Ic "uncolour" +.Mx -anchor-spass Ic "commandalias" +.Mx -anchor-spass Ic "uncommandalias" +.Mx -anchor-spass Ic "Copy" +.Mx -anchor-spass Ic "copy" +.Mx -anchor-spass Ic "csop" +.Mx -anchor-spass Ic "cwd" +.Mx -anchor-spass Ic "Decrypt" +.Mx -anchor-spass Ic "decrypt" +.Mx -anchor-spass Ic "define" +.Mx -anchor-spass Ic "undefine" +.Mx -anchor-spass Ic "delete" +.Mx -anchor-spass Ic "undelete" +.Mx -anchor-spass Ic "digmsg" +.Mx -anchor-spass Ic "discard" +.Mx -anchor-spass Ic "dp" +.Mx -anchor-spass Ic "dt" +.Mx -anchor-spass Ic "dotmove" +.Mx -anchor-spass Ic "draft" +.Mx -anchor-spass Ic "undraft" +.Mx -anchor-spass Ic "echo" +.Mx -anchor-spass Ic "echoerr" +.Mx -anchor-spass Ic "echon" +.Mx -anchor-spass Ic "echoerrn" +.Mx -anchor-spass Ic "edit" +.Mx -anchor-spass Ic "elif" +.Mx -anchor-spass Ic "else" +.Mx -anchor-spass Ic "endif" +.Mx -anchor-spass Ic "environ" +.Mx -anchor-spass Ic "errors" +.Mx -anchor-spass Ic "eval" +.Mx -anchor-spass Ic "exit" +.Mx -anchor-spass Ic "File" +.Mx -anchor-spass Ic "file" +.Mx -anchor-spass Ic "filetype" +.Mx -anchor-spass Ic "unfiletype" +.Mx -anchor-spass Ic "flag" +.Mx -anchor-spass Ic "unflag" +.Mx -anchor-spass Ic "Folder" +.Mx -anchor-spass Ic "folder" +.Mx -anchor-spass ixsx "dotlock files" +.Mx -anchor-spass Ic "folders" +.Mx -anchor-spass Ic "Followup" +.Mx -anchor-spass Ic "followup" +.Mx -anchor-spass Ic "Forward" +.Mx -anchor-spass Ic "forward" +.Mx -anchor-spass Ic "from" +.Mx -anchor-spass Ic "headerpick" +.Mx -anchor-spass Ic "unheaderpick" +.Mx -anchor-spass Ic "headers" +.Mx -anchor-spass Ic "help" +.Mx -anchor-spass Ic "history" +.Mx -anchor-spass Ic "hold" +.Mx -anchor-spass Ic "if" +.Mx -anchor-spass Ic "ignore" +.Mx -anchor-spass Ic "list" +.Mx -anchor-spass Ic "localopts" +.Mx -anchor-spass Ic "Lfollowup" +.Mx -anchor-spass Ic "Lreply" +.Mx -anchor-spass Ic "Mail" +.Mx -anchor-spass Ic "mail" +.Mx -anchor-spass Ic "mailcap" +.Mx -anchor-spass Ic "mbox" +.Mx -anchor-spass Ic "mimetype" +.Mx -anchor-spass Ic "unmimetype" +.Mx -anchor-spass Ic "mimeview" +.Mx -anchor-spass Ic "mlist" +.Mx -anchor-spass Ic "unmlist" +.Mx -anchor-spass Ic "mlsubscribe" +.Mx -anchor-spass Ic "unmlsubscribe" +.Mx -anchor-spass Ic "Move" +.Mx -anchor-spass Ic "move" +.Mx -anchor-spass Ic "More" +.Mx -anchor-spass Ic "more" +.Mx -anchor-spass Ic "mtaaliases" +.Mx -anchor-spass Ic "netrc" +.Mx -anchor-spass Ic "newmail" +.Mx -anchor-spass Ic "next" +.Mx -anchor-spass Ic "New" +.Mx -anchor-spass Ic "new" +.Mx -anchor-spass Ic "noop" +.Mx -anchor-spass Ic "Page" +.Mx -anchor-spass Ic "page" +.Mx -anchor-spass Ic "Pipe" +.Mx -anchor-spass Ic "pipe" +.Mx -anchor-spass Ic "preserve" +.Mx -anchor-spass Ic "Print" +.Mx -anchor-spass Ic "print" +.Mx -anchor-spass Ic "quit" +.Mx -anchor-spass Ic "read" +.Mx -anchor-spass Ic "readsh" +.Mx -anchor-spass Ic "readall" +.Mx -anchor-spass Ic "readctl" +.Mx -anchor-spass Ic "remove" +.Mx -anchor-spass Ic "rename" +.Mx -anchor-spass Ic "Reply" +.Mx -anchor-spass Ic "Respond" +.Mx -anchor-spass Ic "reply" +.Mx -anchor-spass Ic "respond" +.Mx -anchor-spass Ic "Resend" +.Mx -anchor-spass Ic "resend" +.Mx -anchor-spass Ic "retain" +.Mx -anchor-spass Ic "return" +.Mx -anchor-spass Ic "Save" +.Mx -anchor-spass Ic "save" +.Mx -anchor-spass Ic "search" +.Mx -anchor-spass Ic "seen" +.Mx -anchor-spass Ic "set" +.Mx -anchor-spass Ic "unset" +.Mx -anchor-spass Ic "shcodec" +.Mx -anchor-spass Ic "shell" +.Mx -anchor-spass Ic "shortcut" +.Mx -anchor-spass Ic "unshortcut" +.Mx -anchor-spass Ic "shift" +.Mx -anchor-spass Ic "show" +.Mx -anchor-spass Ic "size" +.Mx -anchor-spass Ic "sleep" +.Mx -anchor-spass Ic "sort" +.Mx -anchor-spass Ic "unsort" +.Mx -anchor-spass Ic "source" +.Mx -anchor-spass Ic "source_if" +.Mx -anchor-spass Ic "spamclear" +.Mx -anchor-spass Ic "spamforget" +.Mx -anchor-spass Ic "spamham" +.Mx -anchor-spass Ic "spamrate" +.Mx -anchor-spass Ic "spamset" +.Mx -anchor-spass Ic "spamspam" +.Mx -anchor-spass Ic "tls" +.Mx -anchor-spass Ic "Top" +.Mx -anchor-spass Ic "top" +.Mx -anchor-spass Ic "touch" +.Mx -anchor-spass Ic "Type" +.Mx -anchor-spass Ic "type" +.Mx -anchor-spass Ic "unignore" +.Mx -anchor-spass Ic "Unread" +.Mx -anchor-spass Ic "unread" +.Mx -anchor-spass Ic "unretain" +.Mx -anchor-spass Ic "urlcodec" +.Mx -anchor-spass Ic "varshow" +.Mx -anchor-spass Ic "verify" +.Mx -anchor-spass Ic "version" +.Mx -anchor-spass Ic "vexpr" +.Mx -anchor-spass Ic "vpospar" +.Mx -anchor-spass Ic "visual" +.Mx -anchor-spass Ic "write" +.Mx -anchor-spass Ic "xcall" +.Mx -anchor-spass Ic "xit" +.Mx -anchor-spass Ic "z" +.Mx -anchor-spass Ic "Z" +.Mx -anchor-spass Ic "~~" +.Mx -anchor-spass Ic "~!" +.Mx -anchor-spass Ic "~." +.Mx -anchor-spass Ic "~:" +.Mx -anchor-spass Ic "~<" +.Mx -anchor-spass Ic "~' -Xx .Ed -.\" }}} -. -.\" .Ss "A starter" {{{ review .Ss "A starter" -. \*(UA is a direct descendant of .Bx Mail, itself a successor to the Research @@ -856,7 +1459,6 @@ is included in the .Va features of \*(UA then the system side is not a mandatory precondition for mail delivery. -. .Pp \*(UA strives for compliance with the POSIX .Xr mailx 1 @@ -878,7 +1480,6 @@ The builtin as well as the (default) global .Pa \*(UR .Sx "Resource files" already bend the standard imposed settings a bit. -. .Pp For example, .Va hold @@ -898,7 +1499,6 @@ to not remove empty system MBOX mailbox files (or all empty such files in .Va posix mode) to avoid mangling of file permissions when files eventually get recreated. -. .Pp To enter interactive mode even if the initial mailbox is empty .Va emptystart @@ -922,7 +1522,6 @@ It sets and .Va reply-to-honour to comply with reply address desires. -. .Pp Credentials and other settings are easily addressable by grouping them via .Ic account . @@ -942,11 +1541,7 @@ or .Va debug (as via .Fl v , d ) . -.\" }}} -. -.\" .Ss "On sending mail, and non-interactive mode" {{{ .Ss "On sending mail, and non-interactive mode" -. To send a message to one or more people, using a local or built-in .Va mta (Mail-Transfer-Agent) transport to actually deliver the generated mail @@ -956,7 +1551,6 @@ people to whom the mail will be sent, and the command line options and .Fl c can be used to add (blind) carbon copy receivers: -. .Bd -literal -offset indent # Via test MTA $ echo Hello, world | \*(uA -:/ -Smta=test -s test $LOGNAME @@ -977,7 +1571,6 @@ $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Sttycharset=utf8 \e -a /etc/mail.rc --end-options \e eric@exam.ple < /tmp/letter.txt .Ed -. .Pp Email addresses and plain user names are subject to .Ic alternates @@ -992,8 +1585,6 @@ will be converted to a fully qualified address if either is not set, or set to a non-empty value; if set to the empty value the conversion is left up to the .Va mta . -.\" When changing any of the following adjust any RECIPIENTADDRSPEC; -.\" grep the latter for the complete picture By setting .Va expandaddr fine-grained control of recipient address types other than user names @@ -1029,7 +1620,6 @@ This classification can be avoided by using a .Ql Fcc: header, see .Sx "Compose mode" . -. .Bd -literal -offset indent $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox' @@ -1039,7 +1629,6 @@ $ echo safe | LC_ALL=C \e -S expandaddr=fail,-all,+addr,failinvaddr -s test \e --end-options 'Imagine John ' .Ed -. .Pp Before messages are sent they undergo editing in .Sx "Compose mode" . @@ -1068,7 +1657,6 @@ mailbox may be desirable \(en as for most mailbox targets .Sx "Filename transformations" will be performed. -. .Pp For the purpose of arranging a complete environment of settings that can be switched to with a single command or command line option there are @@ -1090,7 +1678,6 @@ For more please see .Sx "On URL syntax and credential lookup" and .Sx "INTERNAL VARIABLES" . -. .Pp To avoid environmental noise scripts should create a script-local environment, ideally with the command line options @@ -1098,7 +1685,6 @@ environment, ideally with the command line options to disable configuration files in conjunction with repetitions of .Fl S to specify variables: -. .Bd -literal -offset indent $ env LC_ALL=C \*(uA -:/ \e -Sv15-compat \e @@ -1111,7 +1697,6 @@ $ env LC_ALL=C \*(uA -:/ \e 'Recipient 1 ' rec2@exam.ple \e < content_file .Ed -. .Pp As shown, scripts producing messages can .Dq fake @@ -1136,12 +1721,10 @@ handler for .Ql application/octet-stream , or possibly automatically through .Va mime-counter-evidence ) . -. .Pp In interactive mode, introduced soon, messages can be sent by calling the .Ic mail command with a list of recipient addresses: -. .Bd -literal -offset indent $ \*(uA -:/ -Squiet -Semptystart -Sfullnames -Smta=test "/var/spool/mail/user": 0 messages @@ -1150,11 +1733,7 @@ $ \*(uA -:/ -Squiet -Semptystart -Sfullnames -Smta=test ? # Will do the right thing (tm) ? m rec1@exam.ple rec2@exam.ple .Ed -.\" }}} -. -.\" .Ss "Compose mode" {{{ .Ss "Compose mode" -. If standard input is a terminal rather than the message to be sent, the user is expected to type in the message contents. In compose mode lines beginning with the character @@ -1184,7 +1763,6 @@ and \*(OPally .Ic ~? gives an overview of most other available command escapes. -. .Pp To create file-carbon-copies the special recipient header .Ql Fcc: @@ -1203,7 +1781,6 @@ is subject to the checks of .Va expandaddr . Any local file and pipe command addressee honours the setting of .Va mbox-fcc-and-pcc . -. .Pp Once finished with editing the command escape .Ic ~. @@ -1230,7 +1807,6 @@ at the beginning of an empty line, and is always reachable by typing end-of-text (ETX) twice via .Ql control-C .Pf ( Ql ^C ) . -. .Pp The compose mode hooks .Va on-compose-enter , on-compose-splice , on-compose-leave @@ -1260,11 +1836,7 @@ only provide the hooks and .Va on-resend-cleanup , which are pretty restricted due to the nature of the operation.) -.\" }}} -. -.\" .Ss "On reading mail, and more on interactive mode" {{{ .Ss "On reading mail, and more on interactive mode" -. When invoked without addressees \*(UA enters interactive mode in which mails may be read. When used like that the user's system @@ -1291,7 +1863,6 @@ If the initially opened mailbox is empty \*(UA will instead exit immediately (after displaying a message) unless the variable .Va emptystart is set. -. .Pp At the .Va prompt @@ -1315,7 +1886,6 @@ however possible to define overwrites with These commands can also produce a more .Va verbose output. -. .Pp Messages are given numbers (starting at 1) which uniquely identify messages; the current message \(en the @@ -1334,7 +1904,6 @@ whereas .Ic from will display only the summaries of the given messages, defaulting to the .Dq dot . -. .Pp Message content can be displayed with the command .Ic type @@ -1362,7 +1931,6 @@ Message display experience may improve by setting and adjusting .Va mime-counter-evidence , and also see .Sx "HTML mail and MIME attachments" . -. .Pp By default the current message .Pf ( Dq dot ) @@ -1389,10 +1957,8 @@ The command .Ic from ) will display a header summary of the given message specification list instead of their content; the following will search for subjects: -. .Pp .Dl ? from "'@Some subject to search for'" -. .Pp In the default setup all header fields of a message will be .Ic type Ns @@ -1416,7 +1982,6 @@ not only adjusts the list of displayed headers, but also sets (\*(ID A yet somewhat restricted) Reliable scriptable message inspection is available via .Ic digmsg . -. .Pp Dependent upon the configuration a line editor (see the section .Sx "On terminal control and line editor" ) @@ -1453,7 +2018,6 @@ d to other mailboxes, whereas keeps the original message. .Ic write can be used to write out data content of specific parts of messages. -. .Pp After examining a message the user can .Ic reply Ql r @@ -1501,7 +2065,6 @@ When sending, replying or forwarding messages comments and full names will be stripped from recipient addresses unless the internal variable .Va fullnames is set. -. .Pp Of course messages can be .Ic delete Ql d , @@ -1527,11 +2090,7 @@ line editor By the way, whenever the main event loop is about to look out for the next input line it will trigger the hook .Va on-main-loop-tick . -.\" }}} -. -.\" .Ss "HTML mail and MIME attachments" {{{ review .Ss "HTML mail and MIME attachments" -. HTML-only messages become more and more common, and many messages come bundled with a bouquet of MIME (Multipurpose Internet Mail Extensions) parts and attachments. @@ -1551,7 +2110,6 @@ Note plain text parts will always be preferred in MIME messages unless .Va mime-alternative-favour-rich is set. -. .Pp Whereas a simple HTML-to-text filter for displaying HTML messages is \*(OPally supported (indicated by @@ -1566,7 +2124,6 @@ versions of their input (a mode which is called or display the content externally, for example in a graphical window: the latter type is only considered by and for the command .Ic mimeview . -. .Pp To install a handler program for a MIME type an according .Va pipe-TYPE/SUBTYPE @@ -1579,7 +2136,6 @@ and will be queried for display or quote handlers after the former ones. Type-markers registered via .Ic mimetype are the last possible source for information how to handle a MIME type. -. .Pp For example, to display HTML messages integrated via the text browsers .Xr lynx 1 @@ -1588,7 +2144,6 @@ or register a MathML MIME type and enable its plain text display, and to open PDF attachments in an external PDF viewer, asynchronously and with some other magic attached: -. .Bd -literal -offset indent ? if "$features" !% ,+filter-html-tagsoup, ? #set pipe-text/html='?* elinks -force-html -dump 1' @@ -1611,11 +2166,7 @@ some other magic attached: ? } ? \ecommandalias html \e\ecall showhtml .Ed -.\" }}} -. -.\" .Ss "Mailing lists" {{{ .Ss "Mailing lists" -. Known or subscribed-to mailing lists may be flagged in the summary of .Ic headers .Pf ( Va headline @@ -1648,7 +2199,6 @@ or is used and the messages .Ql Mail-Followup-To: is honoured etc. -. .Pp The commands .Ic mlist @@ -1670,14 +2220,12 @@ It is not possible to escape the in order to match special characters as-is, bracket expressions must be used, for example .Ql Ic search Li @subject@'[[]open bracket' . -. .Bd -literal -offset indent ? set followup-to followup-to-honour=ask-yes \e reply-to-honour=ask-yes ? mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$' ? mlsubscribe a4@b4.c4 exact@lists.c3 .Ed -. .Pp Known and subscribed lists differ in that for the latter the .Va user Ns @@ -1697,7 +2245,6 @@ is used instead (if it is a single address on the same domain as .Ql List-Post: ) in order to accept a list administrator's wish that is supposed to have been manifested like that. -. .Pp For convenience and compatibility with mail programs that do not honour the non-standard M-F-T, an automatic user entry in the carbon-copy @@ -1710,11 +2257,7 @@ list, and is not a regular addressee already. .Va reply-to-swap-in tries to deal with the address rewriting that many mailing-lists nowadays perform to work around DKIM / DMARC etc. standard imposed problems. -.\" }}} -. -.\" .Ss "Signed and encrypted messages with S/MIME" {{{ .Ss "Signed and encrypted messages with S/MIME" -. \*(OP S/MIME provides two central mechanisms: message signing and message encryption. A signed message contains some data in addition to the regular text. @@ -1725,7 +2268,6 @@ Signing a message does not change its regular text; it can be read regardless of whether the recipients software is able to handle S/MIME. It is thus usually possible to sign all outgoing messages if so desired. -. .Pp Encryption, in contrast, makes the message text invisible for all people except those who have access to the secret decryption key. @@ -1736,7 +2278,6 @@ key has been retrieved from either previous communication or public key directories. Because signing is performed with private keys, and encryption with public keys, messages should always be signed before being encrypted. -. .Pp A central concept to S/MIME is that of the certification authority (CA). A CA is a trusted institution that issues certificates. @@ -1757,7 +2298,6 @@ and/or should be pointed to a trusted pool of certificates. A certificate cannot be more secure than the method its CA certificate has been retrieved with. -. .Pp This trusted pool of certificates is used by the command .Ic verify @@ -1766,13 +2306,11 @@ If so, verified sender certificates that were embedded in signed messages can be saved locally with the command .Ic certsave , and used by \*(UA to encrypt further communication with these senders: -. .Bd -literal -offset indent ? certsave FILENAME ? set smime-encrypt-USER@HOST=FILENAME \e smime-cipher-USER@HOST=AES256 .Ed -. .Pp To sign outgoing messages, in order to allow receivers to verify the origin of these messages, a personal S/MIME certificate is required. @@ -1786,13 +2324,11 @@ shows examplarily how a private S/MIME certificate can be obtained. In general, if such a private key plus certificate .Dq pair is available, all that needs to be done is to set some variables: -. .Bd -literal -offset indent ? set smime-sign-cert=ME@exam.ple.paired \e smime-sign-digest=SHA512 \e smime-sign from=myname@my.host .Ed -. .Pp Variables of interest for S/MIME in general are .Va smime-ca-dir , @@ -1819,7 +2355,6 @@ S/MIME is available if .Ql ,+smime, is included in .Va features . -. .Pp \*(ID Note that neither S/MIME signing nor encryption applies to message subjects or other header fields yet. @@ -1828,11 +2363,7 @@ and cannot be trusted even if the message content has been verified. When sending signed messages, it is recommended to repeat any important header information in the message text. -.\" }}} -. -.\" .Ss "On URL syntax and credential lookup" {{{ review .Ss "On URL syntax and credential lookup" -. For accessing protocol-specific resources Uniform Resource Locators (URL, RFC 3986) have become omnipresent. Here they are expected in a @@ -1855,10 +2386,8 @@ and are included in an URL server specification, URL percent encoded (RFC 3986) forms are needed, generable with .Ic urlcodec . -. .Pp .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path] -. .Pp Often .Sx "INTERNAL VARIABLES" @@ -1890,12 +2419,10 @@ first is looked up, then .Ql tls-\:config-pairs\-\:a.dove , before finally looking up the plain variable. -. .Pp The logic to collect (an .Ic account Ns s) credential information is as follows: -. .Bl -bullet .It A user is always required. @@ -1923,12 +2450,10 @@ If there is still no then the verified .Ev LOGNAME , known to be a valid user on the current host, is used. -. .It Authentication: unless otherwise noted the chain .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth is checked, falling back to a protocol-specific default as necessary. -. .It If no .Ql PASSWORD @@ -1953,7 +2478,6 @@ If at that point there is still no password available, but the (protocols') chosen authentication type requires a password, then in interactive mode the user will be prompted on the terminal. .El -. .Pp .Sy Note: S/MIME verification works relative to the values found in the @@ -1979,22 +2503,16 @@ and combinations may therefore be involved \(en on the other hand those unusual cases become possible. The usual case is as short as: -. .Bd -literal -offset indent set mta=smtp://USER:PASS@HOST smtp-use-starttls \e smime-sign smime-sign-cert=+smime.pair \e from=myname@my.host .Ed -. .Pp The section .Sx EXAMPLES contains complete example configurations. -.\" }}} -. -.\" .Ss "Encrypted network communication" {{{ review .Ss "Encrypted network communication" -. \*(OP SSL (Secure Sockets Layer) aka its successor TLS (Transport Layer Security) are protocols which aid in securing communication by providing a safely initiated and encrypted network connection. @@ -2006,7 +2524,6 @@ to allow servers fine-grained control over the certificates being used. A locally installed pool of trusted certificates will then be inspected, and verification will succeed if it contains a(n in)direct signer of the presented certificate(s). -. .Pp The local pool of trusted so-called CA (Certification Authority) certificates is usually delivered with and used along the TLS library. @@ -2025,11 +2542,9 @@ when connecting to it) can be fetched with the command (port can usually be the protocol name, too, and .Va tls-verify is taken into account here): -. .Bd -literal -offset indent $ \*(uA -vX 'tls certchain SERVER-URL[:PORT]; x' .Ed -. .Pp A local pool of CA certificates is not strictly necessary, however, server certificates can also be verified via their fingerprint. @@ -2041,11 +2556,9 @@ The message digest (algorithm) can be configured via the variable chain .Va tls-fingerprint-digest ; .Ic tls can again be used: -. .Bd -literal -offset indent $ \*(uA -X 'wysh set verbose; tls fingerprint SERVER-URL[:PORT]; x' .Ed -. .Pp It depends on the used protocol whether encrypted communication is possible, and which configuration steps have to be taken to enable it. @@ -2057,7 +2570,6 @@ that POP3 offers (a member of) the variable (chain) .Va pop3-use-starttls needs to be set, with convenience via .Ic shortcut : -. .Bd -literal -offset indent shortcut encpop1 pop3s://pop1.exam.ple @@ -2067,7 +2579,6 @@ set pop3-use-starttls-pop2.exam.ple set mta=smtps://smtp.exam.ple:465 set mta=smtp://smtp.exam.ple smtp-use-starttls .Ed -. .Pp Normally that is all there is to do, given that TLS libraries try to provide safe defaults, plenty of knobs however exist to adjust settings. @@ -2084,14 +2595,12 @@ to connect to some servers; the following example allows connecting to a that uses OpenSSL 0.9.8za from June 2014 (refer to .Sx "INTERNAL VARIABLES" for more on variable chains): -. .Bd -literal -offset indent wysh set tls-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e CipherString=TLSv1.2:!aNULL:!eNULL:\e ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e DHE-RSA-AES256-SHA:@STRENGTH' .Ed -. .Pp The OpenSSL program .Xr ciphers 1 @@ -2115,11 +2624,7 @@ TLS is available if .Ql +tls is included in .Va features . -.\" }}} -. -.\" .Ss "Character sets" review {{{ .Ss "Character sets" -. \*(OP The user's locale environment is detected by looking at the .Ev LC_ALL environment variable. @@ -2132,7 +2637,6 @@ and .Ic varshow . This character set will be targeted when trying to display data, and user input data is expected to be in this character set, too. -. .Pp When creating messages their character input data is classified. 7-bit clean text data and attachments will be classified as @@ -2161,7 +2665,6 @@ misses .Va ttycharset is the only supported character set for non 7-bit clean data, and it is simply assumed it can be used to exchange 8-bit messages. -. .Pp .Va ttycharset may also be given an explicit value to send mail in a completely @@ -2179,7 +2682,6 @@ might be addressable, any output will be made safely printable, as via .Cm makeprint , according to the actual locale environment, which is not affected by .Va ttycharset. -. .Pp Classifying 7-bit clean data as .Va charset-7bit @@ -2196,7 +2698,6 @@ To achieve this, the variable can be set to ISO-2022-JP. (Today a better approach regarding email is the usage of UTF-8, which uses 8-bit bytes for non-US-ASCII data.) -. .Pp When replying to a message and the variable .Va reply-in-same-charset @@ -2210,7 +2711,6 @@ to reflect the user's locale environment automatically, it will treat .Va ttycharset as an implied member of (an unset) .Va sendcharsets . -. .Pp \*(OP When reading messages, their text data is converted into .Va ttycharset @@ -2226,7 +2726,6 @@ mapping), or to enforce treatment of one character set as another one Also see .Va charset-unknown-8bit to deal with another hairy aspect of message interpretation. -. .Pp In general, if a message saying .Dq cannot convert from a to b @@ -2243,7 +2742,6 @@ spectrum of characters is available. In this setup characters from various countries can be displayed, while it is still possible to use more simple character sets for sending to retain maximum compatibility with older mail clients. -. .Pp On the other hand the POSIX standard defines a locale-independent 7-bit .Dq portable character set @@ -2256,11 +2754,7 @@ underscore .Ql _ and hyphen-minus .Ql - . -.\" }}} -. -.\" .Ss "Message states" {{{ .Ss "Message states" -. \*(UA differentiates in between several message states; the current state will be reflected in the summary of .Ic headers @@ -2293,21 +2787,18 @@ template sets the internal and .Va keepsave variables in order to suppress this behaviour. -. .Bl -hang -width ".It Ql new" .It Ql new Message has neither been viewed nor moved to any other state. Such messages are retained even in the .Mx -sx .Sx "primary system mailbox" . -. .It Ql unread Message has neither been viewed nor moved to any other state, but the message was present already when the mailbox has been opened last: Such messages are retained even in the .Mx -sx .Sx "primary system mailbox" . -. .It Ql read The message has been processed by one of the following commands: .Ic ~f , @@ -2354,7 +2845,6 @@ state when the mailbox is left will be saved in the unless the internal variable .Va hold it set. -. .It Ql deleted The message has been processed by one of the following commands: .Ic delete , @@ -2363,12 +2853,10 @@ The message has been processed by one of the following commands: Only .Ic undelete can be used to access such messages. -. .It Ql preserved The message has been processed by a .Ic preserve command and it will be retained in its current location. -. .It Ql saved The message has been processed by one of the following commands: .Ic save @@ -2389,7 +2877,6 @@ when the internal variable .Va keepsave is set. .El -. .Pp In addition to these message states, flags which otherwise have no technical meaning in the mail system except allowing special ways of @@ -2398,7 +2885,6 @@ addressing them when can be set on messages. These flags are saved with messages and are thus persistent, and are portable between a set of widely used MUAs. -. .Bl -hang -width ".It Ic answered" .It Ic answered Mark messages as having been answered. @@ -2407,11 +2893,7 @@ Mark messages as being a draft. .It Ic flag Mark messages which need special attention. .El -.\" }}} -. -.\" .Ss "Specifying messages" {{{ .Ss "Specifying messages" -. \*(NQ .Ic COMMANDS which take @@ -2430,7 +2912,6 @@ to be reported through the .Va ^ERR and companions, as well as the command exit status .Va \&? . -. .Pp For example, .Ql delete 1 2 @@ -2446,7 +2927,6 @@ will delete the messages that are located between (and including) messages 1 through 5 in the sorted/threaded order, as shown in the .Ic headers summary. -. .Pp Errors can for example be .Va ^ERR Ns -BADMSG @@ -2460,16 +2940,12 @@ for invalid syntax as well as .Va ^ERR Ns -IO for input/output errors can happen. The following special message names exist: -. -. .Bl -tag -width ".It Ar BaNg" .It Ar \&. The current message, the so-called .Dq dot . -. .It Ar \&; The message that was previously the current message; needs to be quoted. -. .It Ar \&, The parent message of the current message, that is the message with the Message-ID given in the @@ -2477,7 +2953,6 @@ that is the message with the Message-ID given in the field or the last entry of the .Ql References: field of the current message. -. .It Ar - The previous undeleted message, or the previous deleted message for the .Ic undelete @@ -2486,7 +2961,6 @@ command; In ed or .Ql thread Ns ed mode, the previous such message in the according order. -. .It Ar + The next undeleted message, or the next deleted message for the .Ic undelete @@ -2495,7 +2969,6 @@ command; In ed or .Ql thread Ns ed mode, the next such message in the according order. -. .It Ar ^ The first undeleted message, or the first deleted message for the @@ -2505,7 +2978,6 @@ command; In ed or .Ql thread Ns ed mode, the first such message in the according order. -. .It Ar $ The last message; In .Ic sort Ns @@ -2513,7 +2985,6 @@ ed or .Ql thread Ns ed mode, the last such message in the according order. Needs to be quoted. -. .It Ar & Ns Ar x In .Ql thread Ns @@ -2531,10 +3002,8 @@ If .Ar x is omitted, the thread beginning with the current message is selected. -. .It Ar * All messages. -. .It Ar ` All messages that were included in the .Sx "Message list arguments" @@ -2548,12 +3017,10 @@ as below, and then to read them in order with the default command \(em for this to work .Va showlast must be set.) -. .It Ar x-y An inclusive range of message numbers. Selectors that may also be used as endpoints include any of .Ar .;-+^$ . -. .It Ar address A case-insensitive .Dq any substring matches @@ -2572,7 +3039,6 @@ is completely ignored. For finer control and match boundaries use the .Ql @ search expression. -. .It Ar / Ns Ar string All messages that contain .Ar string @@ -2584,8 +3050,6 @@ If .Ar string is empty, the string from the previous specification of that type is used again. -. -. .It Xo Op Ar @ Ns Ar name-list Ns .Ar @ Ns Ar expr .Xc @@ -2603,10 +3067,8 @@ part is missing the search is restricted to the subject field body, but otherwise .Ar name-list specifies a comma-separated list of header fields to search, for example -. .Pp .Dl '@to,from,cc@Someone i ought to know' -. .Pp In order to search for a string that includes a .Ql @ @@ -2638,7 +3100,6 @@ will be interpreted as (an extended) regular expression if any of the .Mx -sx .Sx "magic regular expression characters" is seen. -. .Pp The special names .Ql header @@ -2657,7 +3118,6 @@ will perform full text searches \(en whereas the former searches only the body, the latter also searches the message header (\*(ID this mode yet brute force searches over the entire decoded content of messages, including administrativa strings). -. .Pp This specification performs full text comparison, but even with regular expression support it is almost impossible to write a search @@ -2668,11 +3128,8 @@ search expression is to be matched against, prefix the effective .Ar name-list with a tilde .Ql ~ : -. .Pp .Dl '@~f,c@@a\e.safe\e.domain\e.match$' -. -. .It Ar :c All messages of state or with matching condition .Ql c , @@ -2727,8 +3184,6 @@ Messages marked as messages. .El .El -. -. .Pp \*(OP IMAP-style SEARCH expressions may also be used. These consist of keywords and criterions, and because @@ -2752,17 +3207,14 @@ When the description indicates that the representation of an address field is used, this means that the search string is checked against both a list constructed as -. .Bd -literal -offset indent \&'(\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)' .Ed -. .Pp for each address, and the addresses without real names from the respective header field. These search expressions can be nested using parentheses, see below for examples. -. .Pp .Bl -tag -compact -width ".It Ar _n_u" .It Ar ( criterion ) @@ -2770,7 +3222,6 @@ All messages that satisfy the given .Ar criterion . .It Ar ( criterion1 criterion2 ... criterionN ) All messages that satisfy all of the given criteria. -. .It Ar ( or criterion1 criterion2 ) All messages that satisfy either .Ar criterion1 @@ -2792,7 +3243,6 @@ operation of independent criteria on the lowest nesting level, it is possible to achieve similar effects by using three separate criteria, as with .Ql (a) (b) (c) . -. .It Ar ( not criterion ) All messages that do not satisfy .Ar criterion . @@ -2848,7 +3298,6 @@ All messages that are larger than All messages that are smaller than .Ar size (in bytes). -. .It Ar ( before date ) All messages that were received before .Ar date , @@ -2864,7 +3313,6 @@ and .Ql yyyy is the year as four digits, for example .Ql 28-Dec-2012 . -. .It Ar ( on date ) All messages that were received on the specified date. .It Ar ( since date ) @@ -2881,11 +3329,7 @@ This specification cannot be used as part of another criterion. If the previous command line contained more than one independent criterion then the last of those criteria is used. .El -.\" }}} -. -.\" .Ss "On terminal control and line editor" {{{ review .Ss "On terminal control and line editor" -. \*(OP Terminal control through one of the standard .Ux libraries, @@ -2908,7 +3352,6 @@ is always used as a preferred source of terminal capabilities. .Sx FAQ entry .Sx "Not \(dqdefunctional\(dq, but the editor key does not work" . ) -. .Pp \*(OP The built-in Mailx-Line-Editor (MLE) should work in all environments which comply to the ISO C standard @@ -2924,7 +3367,6 @@ entries in will help shall the MLE misbehave, see there for more. The MLE can support a little bit of .Ic colour . -. .Pp \*(OP If the .Ic history @@ -2943,7 +3385,6 @@ and There also exists the macro hook .Va on-history-addition which can be used to apply finer control on what enters history. -. .Pp The MLE supports a set of editing and control commands. By default (as) many (as possible) of these will be assigned to a set of @@ -2964,26 +3405,21 @@ an action which can then be suppressed completely by setting .Va line-editor-no-defaults . .Sx "Shell-style argument quoting" notation is used in the following: -. -. .Pp .Bl -tag -compact -width ".It Ql \eBa" .It Ql \ecA Go to the start of the line .Mx .Pf ( Cd mle-go-home ) . -. .It Ql \ecB Move the cursor backward one character .Mx .Pf ( Cd mle-go-bwd ) . -. .It Ql \ecC .Xr raise 3 .Ql SIGINT .Mx .Pf ( Cd mle-raise-int ) . -. .It Ql \ecD Forward delete the character under the cursor; quits \*(UA if used on the empty line unless the internal variable @@ -2991,17 +3427,14 @@ quits \*(UA if used on the empty line unless the internal variable is set .Mx .Pf ( Cd mle-del-fwd ) . -. .It Ql \ecE Go to the end of the line .Mx .Pf ( Cd mle-go-end ) . -. .It Ql \ecF Move the cursor forward one character .Mx .Pf ( Cd mle-go-fwd ) . -. .It Ql \ecG Cancel current operation, full reset. If there is an active history search or tabulator expansion then this @@ -3009,12 +3442,10 @@ command will first reset that, reverting to the former line content; thus a second reset is needed for a full reset in this case .Mx .Pf ( Cd mle-reset ) . -. .It Ql \ecH Backspace: backward delete one character .Mx .Pf ( Cd mle-del-bwd ) . -. .It Ql \ecI \*(NQ Horizontal tabulator: @@ -3026,37 +3457,30 @@ this is affected by .Cd mle-quote-rndtrip and .Va line-editor-cpl-word-breaks ) . -. .It Ql \ecJ Newline: commit the current line .Mx .Pf ( Cd mle-commit ) . -. .It Ql \ecK Cut all characters from the cursor to the end of the line .Mx .Pf ( Cd mle-snarf-end ) . -. .It Ql \ecL Repaint the line .Mx .Pf ( Cd mle-repaint ) . -. .It Ql \ecN \*(OP Go to the next history entry .Mx .Pf ( Cd mle-hist-fwd ) . -. .It Ql \ecO (\*(OPally context-dependent) Invokes the command .Ic dt . -. .It Ql \ecP \*(OP Go to the previous history entry .Mx .Pf ( Cd mle-hist-bwd ) . -. .It Ql \ecQ Toggle roundtrip mode shell quotes, where produced, on and off @@ -3065,22 +3489,18 @@ on and off This setting is temporary, and will be forgotten once the command line is committed; also see .Ic shcodec . -. .It Ql \ecR \*(OP Complete the current line from (the remaining) older history entries .Mx .Pf ( Cd mle-hist-srch-bwd ) . -. .It Ql \ecS \*(OP Complete the current line from (the remaining) newer history entries .Mx .Pf ( Cd mle-hist-srch-fwd ) . -. .It Ql \ecT Paste the snarf buffer .Mx .Pf ( Cd mle-paste ) . -. .It Ql \ecU The same as .Ql \ecA @@ -3088,7 +3508,6 @@ followed by .Ql \ecK .Mx .Pf ( Cd mle-snarf-line ) . -. .It Ql \ecV Prompts for a Unicode character (hexadecimal number without prefix, see .Ic vexpr ) @@ -3102,29 +3521,24 @@ that shortcut purpose); this control code is then special-treated and thus cannot be part of any other sequence (because it will trigger the .Cd \&\&mle-prompt-char function immediately). -. .It Ql \ecW Cut the characters from the one preceding the cursor to the preceding word boundary .Mx .Pf ( Cd mle-snarf-word-bwd ) . -. .It Ql \ecX Move the cursor forward one word boundary .Mx .Pf ( Cd mle-go-word-fwd ) . -. .It Ql \ecY Move the cursor backward one word boundary .Mx .Pf ( Cd mle-go-word-bwd ) . -. .It Ql \ecZ .Xr raise 3 .Ql SIGTSTP .Mx .Pf ( Cd mle-raise-tstp ) . -. .It Ql \ec[ Escape: reset a possibly used multibyte character input state machine and \*(OPally a lingering, incomplete key binding @@ -3138,68 +3552,53 @@ This control code may also be part of a multi-byte sequence, but if a sequence is active and the very control code is currently also an expected input, then the active sequence takes precedence and will consume the control code. -. .It Ql \ec\e (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns + . -. .It Ql \ec] (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns $ . -. .It Ql \ec^ (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns 0 . -. .It Ql \ec_ Cut the characters from the one after the cursor to the succeeding word boundary .Mx .Pf ( Cd mle-snarf-word-fwd ) . -. .It Ql \ec? Backspace: .Cd mle-del-bwd . -. .It \(en .Mx .Cd mle-bell : ring the audible bell. -. .It \(en \*(OP .Mx .Cd mle-clear-screen : move the cursor home and clear the screen. -. .It \(en .Mx .Cd mle-fullreset : different to .Cd mle-reset this will immediately reset a possibly active search etc. -. .It \(en .Mx .Cd mle-go-screen-bwd : move the cursor backward one screen width. -. .It \(en .Mx .Cd mle-go-screen-fwd : move the cursor forward one screen width. -. .It \(en .Mx .Cd mle-raise-quit: .Xr raise 3 .Ql SIGQUIT . .El -.\" }}} -. -.\" .Ss "Coloured display" {{{ review .Ss "Coloured display" -. \*(OP Colours and font attributes through ANSI a.k.a. ISO 6429 SGR (select graphic rendition) escape sequences are optionally supported. Usage of colours and font attributes solely depends upon the @@ -3216,7 +3615,6 @@ Setting .Va colour-disable suppresses usage of colour and font attribute sequences, while leaving established mappings unchanged. -. .Pp Whether actually applicable colour and font attribute sequences should also be generated when output is going to be paged through the external @@ -3231,14 +3629,12 @@ Knowledge of some widely used pagers is however built-in, and in a clean environment it is often enough to simply set .Va colour-pager ; please refer to that variable for more on this topic. -. .Pp It might make sense to conditionalize colour setup on interactive mode via .Ic if .Pf ( Ql terminal indeed means .Dq interactive ) : -. .Bd -literal -offset indent if terminal && "$features" =% ,+colour, colour iso view-msginfo ft=bold,fg=green @@ -3252,11 +3648,7 @@ if terminal && "$features" =% ,+colour, colour mono view-header ft=bold,ft=reverse subject,from endif .Ed -.\" }}} -. -.\" .Ss "Handling spam" {{{ .Ss "Handling spam" -. \*(OP \*(UA can make use of several spam interfaces for the purpose of identification of, and, in general, dealing with spam messages. A precondition of most commands in order to function is that the @@ -3275,7 +3667,6 @@ entries will be used when displaying the .Va headline in the summary of .Ic headers . -. .Bl -bullet .It .Ic spamrate @@ -3309,7 +3700,6 @@ will simply set and clear, respectively, the mentioned volatile .Ql is-spam message flag, without any interface interaction. .El -. .Pp The .Xr spamassassin 1 @@ -3321,16 +3711,13 @@ requires a running instance of the server in order to function, started with the option .Fl -allow-tell shall Bayesian filter learning be possible. -. .Bd -literal -offset indent $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l] $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e --daemonize [--local] [--allow-tell] .Ed -. .Pp Thereafter \*(UA can make use of these interfaces: -. .Bd -literal -offset indent $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e -Sspamc-command=/usr/local/bin/spamc \e @@ -3340,13 +3727,11 @@ $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e -Sspamc-command=/usr/local/bin/spamc \e -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user= .Ed -. .Pp Using the generic filter approach allows usage of programs like .Xr bogofilter 1 . Here is an example, requiring it to be accessible via .Ev PATH : -. .Bd -literal -offset indent $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e -Sspamfilter-ham="bogofilter -n" \e @@ -3356,7 +3741,6 @@ $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e -Sspamfilter-spam="bogofilter -s" \e -Sspamfilter-rate-scanscore="1;^(.+)$" .Ed -. .Pp Because messages must exist on local storage in order to be scored (or used for Bayesian filter training), it is possibly a good idea to @@ -3364,7 +3748,6 @@ perform the local spam check last. Spam can be checked automatically when opening specific folders by setting a specialized form of the internal variable .Va folder-hook . -. .Bd -literal -offset indent define spamdelhook { # Server side DCC @@ -3379,7 +3762,6 @@ define spamdelhook { } set folder-hook-SOMEFOLDER=spamdelhook .Ed -. .Pp See also the documentation for the variables .Va spam-interface , spam-maxsize , @@ -3388,14 +3770,7 @@ See also the documentation for the variables spamfilter-rate and .Va spamfilter-rate-scanscore . -.\" }}} -. -.\" }}} (DESCRIPTION) -. -. -.\" .Sh COMMANDS {{{ .Sh COMMANDS -. \*(UA reads input in lines. An unquoted reverse solidus .Ql \e @@ -3411,7 +3786,6 @@ are removed from the beginning and end. Placing any whitespace characters at the beginning of a line will prevent a possible addition of the command line to the \*(OPal .Ic history . -. .Pp The beginning of such input lines is then scanned for the name of a known command: command names may be abbreviated, in which case the @@ -3424,7 +3798,6 @@ which will become expanded until no more expansion is possible. Once the command that shall be executed is known, the remains of the input line will be interpreted according to command-specific rules, documented in the following. -. .Pp This behaviour is different to the .Xr sh 1 Ns @@ -3436,7 +3809,6 @@ for example will never possibly assign value to one, because the variable assignment is performed no sooner but by the command .Pf ( Ic set ) , long after the expansion happened. -. .Pp A list of all commands in lookup order is dumped by the command .Ic list . @@ -3453,7 +3825,6 @@ with these documentation strings both commands support a more .Va verbose listing mode which includes the argument type of the command and other information which applies; a handy suggestion might thus be: -. .Bd -literal -offset indent ? define __xv { # Before v15: need to enable sh(1)ell-style on _entire_ line! @@ -3462,10 +3833,7 @@ information which applies; a handy suggestion might thus be: ? commandalias xv '\ecall __xv' ? xv help set .Ed -. -.\" .Ss "Command modifiers" {{{ .Ss "Command modifiers" -. Commands may be prefixed by none to multiple command modifiers. Some command modifiers can be used with a restricted set of commands only, the @@ -3473,7 +3841,6 @@ only, the version of .Ic list will (\*(OPally) show which modifiers apply. -. .Bl -bullet .It The modifier reverse solidus @@ -3489,7 +3856,6 @@ even if an (command)alias of the same name exists. .Ic commandalias content may itself contain further command modifiers, including an initial reverse solidus to prevent further expansions. -. .It The modifier .Mx @@ -3504,7 +3870,6 @@ mode. one of the .Sx "INTERNAL VARIABLES" , will be set to the real exit status of the command regardless. -. .It .Mx .Cm local @@ -3522,17 +3887,14 @@ chain, and all local settings will be garbage collected once the local scope is left. To record and unroll changes in the global scope use the command .Ic localopts . -. .It .Mx .Cm scope does yet not implement any functionality. -. .It .Mx .Cm u does yet not implement any functionality. -. .It Some commands support the .Mx @@ -3563,7 +3925,6 @@ the exit status should be set to .Ql -1 , but some commands deviate from the latter, which is documented. -. .It Last, but not least, the modifier .Mx @@ -3576,11 +3937,7 @@ This modifier is implied if .Va v15-compat is set to a non-empty value. .El -.\" }}} -. -.\" .Ss "Old-style argument quoting" v15-compat: rename Obsolete.. {{{ .Ss "Old-style argument quoting" -. \*(ID This section documents the traditional and POSIX standardized style of quoting non-message list arguments to commands which expect this type of arguments: whereas still used by the majority of such @@ -3593,8 +3950,6 @@ one of the Nonetheless care must be taken, because only new commands have been designed with all the capabilities of the new quoting rules in mind, which can, for example generate control characters. -. -. .Bl -bullet -offset indent .It An argument can be enclosed between paired double-quotes @@ -3612,21 +3967,15 @@ used nonetheless by escaping it with a reverse solidus .Ql \e , as in .Ql """y\e""ou""" . -. .It An argument that is not enclosed in quotes, as above, can usually still contain space characters if those spaces are reverse solidus escaped, as in .Ql you\e are . -. .It A reverse solidus outside of the enclosing quotes is discarded and the following character is treated literally as part of the argument. .El -.\" }}} -. -.\" .Ss "Shell-style argument quoting" {{{ .Ss "Shell-style argument quoting" -. .Xr sh 1 Ns ell-style, and therefore POSIX standardized, argument parsing and quoting rules are used by most commands. @@ -3634,7 +3983,6 @@ quoting rules are used by most commands. \*(NQ, some elder ones can use them with the command modifier .Cm wysh ; in the future only this type of argument quoting will remain. -. .Pp A command line is parsed from left to right and an input token is completed whenever an unquoted, otherwise ignored, metacharacter is seen. @@ -3657,7 +4005,6 @@ that the supports are not used, and are treated as ordinary characters: for one these characters are a vivid part of email addresses, and it seems highly unlikely that their function will become meaningful to \*(UA. -. .Bd -filled -offset indent .Sy Compatibility note: \*(ID Please note that even many new-style commands do not yet honour @@ -3679,7 +4026,6 @@ parameters fully support for an almost shell-compatible field splitting: .Ic call , call_if , read , vpospar , xcall . .Ed -. .Pp Any unquoted number sign .Ql # @@ -3696,7 +4042,6 @@ as well as .Sx ENVIRONMENT (shell) variables can be accessed through this mechanism, brace enclosing the name is supported (i.e., to subdivide a token). -. .Pp Whereas the metacharacters .Cm space , tabulator , newline @@ -3714,30 +4059,24 @@ and making the remainder of the line a subject to reevaluation. With sequencing, multiple command argument types and quoting rules may therefore apply to a single line, which can become problematic before v15: e.g., the first of the following will cause surprising results. -. .Pp .Dl ? echo one; set verbose; echo verbose=$verbose. .Dl ? echo one; wysh set verbose; echo verbose=$verbose. -. .Pp Quoting is a mechanism that will remove the special meaning of metacharacters and reserved words, and will prevent expansion. There are four quoting mechanisms: the escape character, single-quotes, double-quotes and dollar-single-quotes: -. -. .Bl -bullet -offset indent .It The literal value of any character can be preserved by preceding it with the escape character reverse solidus .Ql \e . -. .It Arguments which are enclosed in .Ql 'single-\:quotes' retain their literal value. A single-quote cannot occur within single-quotes. -. .It The literal value of all characters enclosed in .Ql \(dqdouble-\:quotes\(dq @@ -3757,7 +4096,6 @@ double-quote .Ql \e (to prevent escaping, i.e., to embed a reverse solidus character as-is), but has no special meaning otherwise. -. .It Arguments enclosed in .Ql $'dollar-\:single-\:quotes' @@ -3856,20 +4194,14 @@ Brace enclosing the name is supported. Not yet supported, just to raise awareness: Non-standard extension. .El .El -. .Pp Caveats: -. .Bd -literal -offset indent ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment ? echo Quotes ${HOME} and tokens differ! # comment ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A' .Ed -.\" }}} -. -.\" .Ss "Message list arguments" {{{ .Ss "Message list arguments" -. Many commands operate on message list specifications, as documented in .Sx "Specifying messages" . The argument input is first split into individual tokens via @@ -3886,11 +4218,7 @@ The output of the command .Ic list will indicate whether a command searches for a default message, or not. -.\" }}} -. -.\" .Ss "Raw data arguments for codec commands" {{{ .Ss "Raw data arguments for codec commands" -. A special set of commands, which all have the string .Dq codec in their name, like @@ -3905,7 +4233,6 @@ one-to-one the desired or questionable data. To gain a level of expansion, the entire command line can be .Ic eval Ns uated first, for example -. .Bd -literal -offset indent ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt ? echo $res @@ -3915,15 +4242,10 @@ $'/usr/Sch\eu00F6nes Wetter/heute.txt' ? eval shcodec d $res /usr/Sch\[:o]nes Wetter/heute.txt .Ed -.\" }}} -. -.\" .Ss "Filename transformations" {{{ .Ss "Filename transformations" -. Filenames, where expected, and unless documented otherwise, are subsequently subject to the following filename transformations, in sequence: -. .Bl -bullet -offset indent .It If the given name is a registered @@ -3932,7 +4254,6 @@ it will be replaced with the expanded shortcut. This step is mostly taken for .Ic folder Ns s only. -. .It The filename is matched against the following patterns or strings. But for plus @@ -3941,13 +4262,10 @@ But for plus expansion this step is mostly taken for .Ic folder Ns s only. -. -. .Pp .Bl -hang -compact -width ".Ar %user" .It Ar # (Number sign) is expanded to the previous file. -. .It Ar % (Percent sign) is replaced by the invoking .Mx -ix "primary system mailbox" @@ -3963,27 +4281,23 @@ against .Va \&\&inbox , then against .Ev MAIL . -. .It Ar %user Expands to the primary system mailbox of .Ar user (and never the value of .Va inbox , regardless of its actual setting). -. .It Ar & (Ampersand) is replaced with the invoking user's .Mx -ix "secondary mailbox" secondary mailbox, the .Ev MBOX . -. .It Ar +file Refers to a .Ar file in the .Va folder directory (if that variable is set). -. .It Ar %:filespec Expands to the same value as .Ar filespec , @@ -3998,8 +4312,6 @@ session will be moved to the .Ev MBOX mailbox instead of simply being flagged as read. .El -. -. .It Meta expansions may be applied to the resulting filename, as allowed by the operation and applicable to the resulting access protocol (also see @@ -4036,16 +4348,9 @@ arguments will usually be displayed in a properly quoted form, so a file may be displayed as .Ql 'diet\e is \ecurd.txt' . .El -.\" }}} -. -.\" .Ss "Commands" {{{ .Ss "Commands" -. The following commands are available: -. .Bl -tag -width ".It Ic BaNg" -. -. .Mx .It Ic \&! Executes the @@ -4067,7 +4372,6 @@ an error happened before the command was executed, or that the program did not exit cleanly, but maybe due to a signal: the error number is .Va ^ERR Ns -CHILD , then. -. .Pp In conjunction with the .Cm vput @@ -4083,8 +4387,6 @@ In case of catchable out-of-memory situations .Va ^ERR Ns -NOMEM will occur and \*(UA will try to store the empty string, just like with all other detected error conditions. -. -. .Mx .It Ic # The comment-command causes the entire line to be ignored. @@ -4095,18 +4397,15 @@ arguments, not a indicating special character, which means that for example trailing comments on a line are not possible (except for commands which use .Sx "Shell-style argument quoting" ) . -. .Mx .It Ic + Goes to the next message in sequence and types it (like .Dq ENTER ) . -. .Mx .It Ic - Display the preceding message, or the n'th previous message if given a numeric argument n. -. .Mx .It Ic = Shows the message number of the current message (the @@ -4127,7 +4426,6 @@ This command supports .Sx "Command modifiers" ) , and manages the error number .Va \&! . -. .Mx .It Ic \&? \*(OP Show a brief summary of commands. @@ -4147,13 +4445,11 @@ This mode also supports a more .Va verbose output, which will provide the information documented for .Ic list . -. .Mx .It Ic \&| A synonym for the .Ic pipe command. -. .Mx .Mx .It Ic account , unaccount @@ -4205,8 +4501,6 @@ account myisp { set mta=smtp://mylogin@smtp.myisp.example } .Ed -. -. .Mx .It Ic addrcodec Perform email address codec transformations on raw-data argument, rather @@ -4224,7 +4518,6 @@ The first argument must be either or .Ar skinl[ist] and specifies the operation to perform on the rest of the line. -. .Pp Decoding will show how a standard-compliant MUA will display the given argument, which should be an email address. @@ -4233,7 +4526,6 @@ standards, and vary wildly when (comments) in parenthesis, .Dq double-quoted strings, or quoted-pairs, as below, become involved. \*(ID \*(UA currently does not perform decoding when displaying addresses. -. .Pp Skinning is identical to decoding but only outputs the plain address, without any string, comment etc. components. @@ -4243,7 +4535,6 @@ set to .Va ^ERR Ns -INVAL if decoding fails to find a(n) (valid) email address, in which case the unmodified input will be output again. -. .Pp .Ar skinlist first performs a skin operation, and thereafter checks a valid @@ -4256,7 +4547,6 @@ eventually reporting that state in the error number as .Va ^ERR Ns -EXIST . (This state could later become overwritten by an I/O error, though.) -. .Pp Encoding supports four different modes, lesser automated versions can be chosen by prefixing one, two or three plus signs: the standard imposes @@ -4275,7 +4565,6 @@ The result will always be valid, if a successful exit status is reported .Ql > if the construct becomes more difficult, otherwise the current parser will fail; it is not smart enough to guess right. -. .Bd -literal -offset indent ? addrc enc "Hey, you",\e out\e there "\e"Hey, you\e", \e\e out\e\e there" @@ -4284,8 +4573,6 @@ will fail; it is not smart enough to guess right. ? addrc s "\e"Hey, you\e", \e\e out\e\e there" diet@exam.ple .Ed -. -. .Mx .Mx .It Ic alias , unalias @@ -4303,7 +4590,6 @@ known aliases, with one argument only the target(s) of the given one. When given two arguments, hyphen-minus .Ql - being the first, the target(s) of the second is/are expanded recursively. -. .Pp In all other cases the given alias is newly defined, or will be appended to: arguments must either be themselves valid alias names, or any @@ -4333,23 +4619,17 @@ The number sign .Ql # may need .Sx "Shell-style argument quoting" . -. .Pp -.\" ALIASCOLON next sentence \*(ID Unfortunately the colon is currently not supported, as it interferes with normal address parsing rules. -.\" ALIASCOLON next sentence \*(ID Such high bit characters will likely cause warnings at the moment for the same reasons why colon is unsupported; also, in the future locale dependent character set validity checks will be performed. -. .Bd -literal -offset indent ? alias cohorts bill jkf mark kridle@ucbcory ~/cohorts.mbox ? alias mark mark@exam.ple ? set mta-aliases=/etc/aliases .Ed -. -. .Mx .Mx .It Ic alternates , unalternates @@ -4380,7 +4660,6 @@ Otherwise the given arguments (after being checked for validity) are appended to the list of alternate names; in .Va posix mode they replace that list instead. -. .Mx .Mx .It Ic answered , unanswered @@ -4392,8 +4671,6 @@ to automatically if the variable is set. See the section .Sx "Message states" . -. -. .Mx .Mx .It Ic bind , unbind @@ -4410,7 +4687,6 @@ Due to initialization order unbinding will not work for built-in key bindings upon program startup, however: please use .Va line-editor-no-defaults for this purpose instead. -. .Pp With zero arguments, or with a context name the former command shows all key bindings (of the given context; an asterisk @@ -4435,7 +4711,6 @@ expansion shall instead be furtherly editable by the user, a commercial at leading and trailing whitespace will finally be removed. Reverse solidus cannot be used as the last character of expansion. An empty expansion will be rejected. -. .Pp Contexts define when a binding applies, i.e., a binding will not be seen unless the context for which it is defined for is currently active. @@ -4451,7 +4726,6 @@ context which is used in all not otherwise documented situations, and .Ql compose , which applies only to .Sx "Compose mode" . -. .Pp Bindings are specified as a comma-separated list of byte-sequences, where each list entry corresponds to one @@ -4479,7 +4753,6 @@ It is advisable to use an initial escape or other control character (like for user (as opposed to purely terminal capability based) bindings in order to avoid ambiguities; it also reduces search time. Examples: -. .Bd -literal -offset indent ? bind base a,b echo one ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape) @@ -4489,7 +4762,6 @@ Examples: ? bind default :kf1 File % ? bind compose :kf1 ~v .Ed -. .Pp Note that the entire comma-separated list is first parsed (over) as a shell-token with whitespace as the field separator, then parsed and @@ -4508,7 +4780,6 @@ will be visualized in most as well as in .Va debug mode. -. .Pp The following terminal capability names are built-in and can be used in .Xr terminfo 5 @@ -4524,7 +4795,6 @@ or the given terminal type; using the .Fl \&\&x flag will also show supported (non-standard) extensions. -. .Pp .Bl -tag -compact -width kcuuf_or_kcuuf .It Cd kbs Ns \0or Cd kb @@ -4584,7 +4854,6 @@ and .Cd F9 , respectively. .El -. .Pp Some terminals support key-modifier combination extensions, e.g., .Ql Alt+Shift+xy . @@ -4609,8 +4878,6 @@ finally The same for the left cursor key, .Cd kcub1 : .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 . -. -. .Mx .It Ic call \*(NQ Calls the given macro, which must have been created via @@ -4624,8 +4891,6 @@ is the last command of the current macro, consider to use the command .Ic xcall , which will first release all resources of the current macro before replacing the current macro with the called one. -. -. .Mx .It Ic call_if Identical to @@ -4633,12 +4898,10 @@ Identical to if the given macro has been created via .Ic define , but does not fail nor warn if the macro does not exist. -. .Mx .It Ic cd Synonym for .Ic chdir . -. .Mx .It Ic certsave \*(OP Only applicable to S/MIME signed messages. @@ -4649,7 +4912,6 @@ The certificates can later be used to send encrypted messages to the respective message senders by setting .Va smime-encrypt-USER@HOST variables. -. .Mx .Mx .It Ic charsetalias , uncharsetalias @@ -4677,7 +4939,6 @@ being the first, the second is instead expanded recursively. In all other cases the given arguments are treated as pairs of character sets and their desired target alias name, creating new or updating already existing aliases. -. .Mx .It Ic chdir \*(NQ(ch) Change the working directory to @@ -4685,7 +4946,6 @@ already existing aliases. or the given argument. Synonym for .Ic cd . -. .Mx .Mx .It Ic collapse , uncollapse @@ -4702,9 +4962,6 @@ messages and the Also when a message with collapsed replies is displayed, all of these are automatically uncollapsed. The latter command undoes collapsing. -. -. -.\" FIXME review until this point .Mx .Mx .It Ic colour , uncolour @@ -4730,7 +4987,6 @@ of the given type is shown (here the special or .Ql * also show all currently defined mappings). -. .Pp Otherwise the second argument defines the mappable slot, the third argument a (comma-separated list of) colour and font attribute @@ -4741,7 +4997,6 @@ found, and the default mapping (if any has been established) will only be chosen as a last resort. The types of available preconditions depend on the mappable slot, the following of which exist: -. .Pp Mappings prefixed with .Ql mle- @@ -4761,7 +5016,6 @@ Used for the occasionally appearing error indicator that is joined onto .Va prompt . \*(ID Also used for error messages written on standard error . .El -. .Pp Mappings prefixed with .Ql sum- @@ -4792,7 +5046,6 @@ For the thread structure which can be created with the format of the variable .Va headline . .El -. .Pp Mappings prefixed with .Ql view- @@ -4817,12 +5070,10 @@ For the introductional message info line. .It Ar view-partinfo For MIME part info lines. .El -. .Pp The following (case-insensitive) colour definitions and font attributes are understood, multiple of which can be specified in a comma-separated list: -. .Bl -tag -width ft= .It Ar ft= a font attribute: @@ -4832,7 +5083,6 @@ or .Ql underline . It is possible (and often applicable) to specify multiple font attributes for a single mapping. -. .It Ar fg= foreground colour attribute, in order (numbers 0 - 7) .Ql black , @@ -4868,13 +5118,11 @@ i=0 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done printf "\e033[0m\en" .Ed -. .It Ar bg= background colour attribute (see .Cd fg= for possible values). .El -. .Pp The command .Ic \&uncolour @@ -4887,8 +5135,6 @@ The special name will remove all mappings (no precondition allowed), thus .Ql uncolour * * will remove all established mappings. -. -. .Mx .Mx .It Ic commandalias , uncommandalias @@ -4924,7 +5170,6 @@ hello, ? xx world hello, world .Ed -. .Mx .It Ic Copy (C) Similar to @@ -4933,14 +5178,11 @@ but copy the messages to a file named after the local part of the sender of the first message instead of taking a filename argument; .Va outfolder is inspected to decide on the actual storage location. -. .Mx .It Ic copy (c) Copy messages to the named file and do not mark them as being saved; otherwise identical to .Ic save . -. -. .Mx .It Ic csop \*(NQ A multiplexer command which provides C-style string operations on @@ -4969,11 +5211,9 @@ is optional so that and .Ql find?case are identical. -. .Bl -hang -width ".It Cm length" .It Cm length Queries the length of the given argument. -. .It Cm hash , Cm hash32 Calculates a hash value of the given argument. The latter will return a 32-bit result regardless of host environment. @@ -4981,13 +5221,11 @@ The latter will return a 32-bit result regardless of host environment. modifier suffix is supported. These use Chris Torek's hash algorithm, the resulting hash value is bit mixed as shown by Bret Mulvey. -. .It Cm find Search for the second in the first argument. Shows the resulting 0-based offset shall it have been found. .Ql \&? modifier suffix is supported. -. .It Cm substring Creates a substring of its first argument. The optional second argument is the 0-based starting offset, @@ -5001,18 +5239,13 @@ for error logs), but reports them via the error number .Va \&! as .Va ^ERR Ns -OVERFLOW . -. .It Cm trim Trim away whitespace characters from both ends of the argument. -. .It Cm trim-front Trim away whitespace characters from the begin of the argument. -. .It Cm trim-end Trim away whitespace characters from the end of the argument. .El -. -. .Mx .It Ic cwd Show the name of the current working directory, as reported by @@ -5023,20 +5256,16 @@ Supports .Sx "Command modifiers" ) . The return status is tracked via .Va \&? . -. .Mx .It Ic Decrypt \*(OP For unencrypted messages this command is identical to .Ic Copy ; Encrypted messages are first decrypted, if possible, and then copied. -. .Mx .It Ic decrypt \*(OP For unencrypted messages this command is identical to .Ic copy ; Encrypted messages are first decrypted, if possible, and then copied. -. -. .Mx .Mx .It Ic define , undefine @@ -5048,7 +5277,6 @@ macro(s), including self-deletion. Without arguments the former command prints the current list of macros, including their content, otherwise it defines a macro, replacing an existing one of the same name as applicable. -. .Pp A defined macro can be invoked explicitly by using the .Ic call , @@ -5059,7 +5287,6 @@ commands, or implicitly if a macro hook is triggered, for example a .Va folder-hook . Execution of a macro body can be stopped from within by calling .Ic return . -. .Pp Temporary macro block-scope variables can be created or deleted with the .Cm local @@ -5077,7 +5304,6 @@ can be used instead; its covered scope depends on how (i.e., normal macro, folder hook, hook, .Ic account switch) the macro is invoked. -. .Pp Inside a .Ic call Ns @@ -5098,7 +5324,6 @@ A helpful command for numeric computation and string evaluations is .Ic vexpr , .Ic csop offers C-style byte string operations. -. .Bd -literal -offset indent define name { command1 @@ -5114,8 +5339,6 @@ define exmac { call exmac Hello macro exmac! echo ${?}/${!}/${^ERRNAME} .Ed -. -. .Mx .Mx .It Ic delete , undelete @@ -5139,8 +5362,6 @@ or the last message restored, respectively, is automatically d; also see .Ic dp , .Ic dt . -. -. .Mx .It Ic digmsg \*(NQ Digging (information out of) messages is possible through @@ -5165,7 +5386,6 @@ Note: output must be consumed before normal processing can continue; for .Ic \&\&digmsg objects this means each command output has to be read until the end of file (EOF) state occurs. -. .Pp The objects may be .Cm remove Ns @@ -5179,7 +5399,6 @@ and the third and all following arguments are interpreted as via .Ic ~^ (see .Sx "COMMAND ESCAPES" ) : -. .Bd -literal -offset indent ? vput = msgno; digmsg create $msgno ? digmsg $msgno header list; readall x; echon $x @@ -5190,15 +5409,12 @@ and the third and all following arguments are interpreted as via ? digmsg remove $msgno .Ed -. -. .Mx .It Ic discard (di) Identical to .Ic ignore . Superseded by the multiplexer .Ic headerpick . -. .Mx .Mx .It Ic dp , dt @@ -5208,7 +5424,6 @@ the new .Dq dot if one exists, regardless of the setting of .Va autoprint . -. .Mx .It Ic dotmove Move the @@ -5218,14 +5433,12 @@ up or down by one message when given or .Ql - argument, respectively. -. .Mx .Mx .It Ic draft , undraft Take message lists and mark each given message as being draft, or not being draft, respectively, as documented in the section .Sx "Message states" . -. .Mx .It Ic echo \*(NQ(ec) Print the given strings, equivalent to the shell utility @@ -5254,7 +5467,6 @@ transformation patterns is not possible; the subcommand of .Ic vexpr can be used to expand filenames. -. .Mx .It Ic echoerr \*(NQ Identical to @@ -5268,19 +5480,16 @@ In interactive sessions the \*(OPal message ring queue for will be used instead, if available and .Cm vput was not used. -. .Mx .It Ic echon \*(NQ Identical to .Ic echo , but does not write or store a trailing newline. -. .Mx .It Ic echoerrn \*(NQ Identical to .Ic echoerr , but does not write or store a trailing newline. -. .Mx .It Ic edit (e) Point the text @@ -5292,7 +5501,6 @@ variable is set, and are not used unless the mailbox can be written to and the editor returns a successful exit status. .Ic visual can be used instead for a more display oriented editor. -. .Mx .It Ic elif Part of the @@ -5303,7 +5511,6 @@ conditional \(em if the condition of a preceding .Ic if was false, check the following condition and execute the following block if it evaluates true. -. .Mx .It Ic else (el) Part of the @@ -5317,7 +5524,6 @@ and commands was true, the .Ic else block is executed. -. .Mx .It Ic endif (en) Marks the end of an @@ -5325,8 +5531,6 @@ block is executed. (see there for more), .Ic elif , else , endif conditional execution block. -. -. .Mx .It Ic environ \*(NQ There is a strict separation in between @@ -5344,10 +5548,8 @@ To integrate any other environment variable, and/or to export internal variables into the process environment where they normally are not, a .Cm link needs to become established with this command, for example -. .Pp .Dl environ link PERL5LIB TZ -. .Pp Afterwards changing such variables with .Ic set @@ -5362,7 +5564,6 @@ ed will be lost. This implies that .Ic localopts may cause loss of such links. -. .Pp The subcommand .Cm unlink @@ -5377,8 +5578,6 @@ and but additionally update the program environment accordingly; removing a variable breaks any freely established .Cm link . -. -. .Mx .It Ic errors \*(OP As console user interfaces at times scroll error messages by too @@ -5395,7 +5594,6 @@ There are also the variables .Va ^ERRQUEUE-COUNT and .Va ^ERRQUEUE-EXISTS . -. .Mx .It Ic eval \*(NQ Construct a command by concatenating the arguments, separated with @@ -5422,7 +5620,6 @@ call xxx arg call xxx arg < > call xxx arg .Ed -. .Mx .It Ic exit (ex or x) Exit from \*(UA without changing the active mailbox and skip @@ -5440,18 +5637,15 @@ The optional status number argument will be passed through to \*(ID For now it can happen that the given status will be overwritten, later this will only occur if a later error needs to be reported onto an otherwise success indicating status. -. .Mx .It Ic File (Fi) Like .Ic folder , but open the mailbox read-only. -. .Mx .It Ic file (fi) See .Ic folder . -. .Mx .Mx .It Ic filetype , unfiletype @@ -5493,7 +5687,6 @@ placing a leading space will avoid any possible misinterpretations. zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e' ? set record=+sent.zst.pgp .Ed -. .Mx .Mx .It Ic flag , unflag @@ -5501,14 +5694,11 @@ Take message lists and mark the messages as being flagged, or not being flagged, respectively, for urgent/special attention. See the section .Sx "Message states" . -. .Mx .It Ic Folder (Fold) Like .Ic folder , but open the mailbox read-only. -. -. .Mx .It Ic folder (fold) Open a new, or show status information of the current mailbox. @@ -5524,7 +5714,6 @@ is executed, and optionally a summary of is displayed if the variable .Va header is set. -. .Pp .Sx "Filename transformations" will be applied to the @@ -5540,7 +5729,6 @@ opening none-existing .Ic folders uses the protocol defined in .Va newfolders . -. .Pp For the protocols .Ar mbox @@ -5557,13 +5745,11 @@ Changing hooks will not affect already opened mailboxes. For example, the following creates hooks for the .Xr gzip 1 compression tool and a combined compressed and encrypted format: -. .Bd -literal -offset indent ? filetype \e gzip 'gzip -dc' 'gzip -c' \e zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e' .Ed -. .Pp For historic reasons .Ic filetype Ns @@ -5582,7 +5768,6 @@ however, but an explicit will find and use the handler for .Ql gz . \*(ID The latter mode can only be used for MBOX files. -. .Pp EML files consist of only one mail message, \*(ID and can only be opened read-only. @@ -5593,7 +5778,6 @@ MBOX files will be complained about (even more with in this case the method described for .Va mbox-rfc4155 can be used to create a valid MBOX database from the invalid input. -. .Pp MBOX databases and EML files will always be protected via file-region locks .Pf ( Xr fcntl 2 ) @@ -5618,7 +5802,6 @@ disables dotlock files. Also see .Sx FAQ : .Sx "Howto handle stale dotlock files" . -. .Pp \*(OP If no protocol has been fixated, and .Ar name @@ -5633,7 +5816,6 @@ format. The maildir format stores each message in its own file, and has been designed so that file locking is not necessary when reading or writing files. -. .Pp \*(OPally URLs can be used to access network resources, securely via .Sx "Encrypted network communication" , @@ -5642,11 +5824,9 @@ Network communication socket timeouts are configurable via .Va socket-connect-timeout . All network traffic may be proxied over a SOCKS server via .Va socks-proxy . -. .Pp .Dl \*(IN protocol://[user[:password]@]host[:port][/path] .Dl \*(OU protocol://[user@]host[:port][/path] -. .Pp \*(OPally supported network protocols are .Ar pop3 @@ -5662,8 +5842,6 @@ part is valid only for IMAP; there it defaults to .Ar INBOX . Network URLs require a special encoding as documented in the section .Sx "On URL syntax and credential lookup" . -. -. .Mx .It Ic folders Lists the names of all folders below the given argument or @@ -5671,7 +5849,6 @@ Lists the names of all folders below the given argument or For file-based protocols .Ev LISTER will be used for display purposes. -. .Mx .Mx .It Ic Followup , followup @@ -5688,7 +5865,6 @@ Also see .Ic Copy and .Ic Save . -. .Mx .It Ic Forward \*(CM Similar to @@ -5696,7 +5872,6 @@ and but saves the message in a file named after the local part of the recipient's address (instead of in .Va record Ns ). -. .Mx .It Ic forward \*(CM Take a message list and the address of a recipient, subject to @@ -5730,7 +5905,6 @@ for other errors. It can also fail with errors of .Sx "Specifying messages" . Any error stops processing of further messages. -. .Mx .It Ic from (f) Takes a list of message specifications and displays a summary of @@ -5745,28 +5919,22 @@ An alias of this command is .Ic search . Also see .Sx "Specifying messages" . -. .It Ic Fwd \*(OB Alias for .Ic Forward . -. .It Ic fwd \*(OB Alias for .Ic forward . -. .It Ic fwdignore \*(OB Superseded by the multiplexer .Ic headerpick . -. .It Ic fwdretain \*(OB Superseded by the multiplexer .Ic headerpick . -. .It Ic ghost , unghost \*(OB Replaced by .Ic commandalias , .Ic uncommandalias . -. .Mx .Mx .It Ic headerpick , unheaderpick @@ -5821,7 +5989,6 @@ to remove selections, i.e., from the given context, the given type of list, all the given headers will be removed, the special argument .Ql * will remove all headers. -. .Mx .It Ic headers (h) Show the current group of headers, the size of which depends on @@ -5836,12 +6003,10 @@ becomes the new the last message is targeted if .Va showlast is set. -. .Mx .It Ic help (hel) A synonym for .Ic \&? . -. .Mx .It Ic history \*(OP Without arguments or when given @@ -5869,7 +6034,6 @@ will delete all given entries .Pf ( Ar :NUMBER: ) . Also see .Sx "On terminal control and line editor" . -. .Mx .It Ic hold (ho, also @@ -5889,8 +6053,6 @@ command. command issued after .Ic hold will display the following message, not the current one. -. -. .Mx .It Ic if (i) Part of the @@ -5908,7 +6070,6 @@ end, the remaining are non-portable extensions. command prefix(es) .Sx "Shell-style argument quoting" and more test operators are available. -. .Bd -literal -offset indent if receive commands ... @@ -5916,7 +6077,6 @@ else commands ... endif .Ed -. .Pp Further (case-insensitive) one-argument conditions are .Ql t Ns @@ -5937,7 +6097,6 @@ or .Dq always execute . (Remarks: condition syntax errors skip all branches until .Ic endif . ) -. .Pp \*(OU and without .Cm wysh : @@ -5960,7 +6119,6 @@ they are always available, and there is no trigger: variables will have been expanded by the shell-compatible parser before the .Ic if etc. command sees them). -. .Pp \*(IN Two argument conditions. Variables can be tested for existence and expansion: @@ -5977,7 +6135,6 @@ will be true if the variable is set and expands to a non-empty string, .Ql -z $'\e$editalong' only if the expansion is empty, whether the variable exists or not. The remaining conditions take three arguments. -. .Pp Integer operators treat the arguments on the left and right hand side of the operator as integral numbers and compare them arithmetically. @@ -6008,7 +6165,6 @@ Available operators are (greater than or equal to), and .Ql -gt (greater than). -. .Pp String and regular expression data operators compare the left and right hand side according to their textual content. @@ -6022,7 +6178,6 @@ is optional, and .Ql ==?case are identical. -. .Pp Available string operators are .Ql < @@ -6046,7 +6201,6 @@ into account character set specifics. If the case-insensitivity modifier has been used, case is ignored according to the rules of the US-ASCII encoding, i.e., bytes are still compared. -. .Pp When the \*(OPal regular expression support is available, the additional string operators @@ -6058,7 +6212,6 @@ They treat the right hand side as an extended regular expression that is matched according to the active locale (see .Sx "Character sets" ) , i.e., character sets should be honoured correctly. -. .Pp Conditions can be joined via AND-OR lists (where the AND operator is .Ql && @@ -6072,13 +6225,11 @@ them in pairs of brackets .Ql [\ \&.\&.\&.\ ] , which may be interlocked within each other, and also be joined via AND-OR lists. -. .Pp The results of individual conditions and entire groups may be modified via unary operators: the unary operator .Ql \&! will reverse the result. -. .Bd -literal -offset indent wysh set v15-compat=yes # with value: automatic "wysh"! if -N debug;echo *debug* set;else;echo not;endif @@ -6100,15 +6251,12 @@ if true && [ -n "$debug" || -n "${verbose}" ] echo Left associativity, as is known from the shell endif .Ed -. -. .Mx .It Ic ignore (ig) Identical to .Ic discard . Superseded by the multiplexer .Ic headerpick . -. .Mx .It Ic list Shows the names of all available commands, in command lookup order. @@ -6160,8 +6308,6 @@ The command produces .Ic history entries. .El -. -. .Mx .It Ic localopts Enforce change localization of @@ -6186,7 +6332,6 @@ is left once a different account is activated, and some macros, notably .Va folder-hook Ns s , use their own specific notion of covered scope, here it will be extended until the folder is left again. -. .Pp This setting stacks up: i.e., if .Ql macro1 @@ -6206,7 +6351,6 @@ their scope will be extended, and in fact leaving the .Ic account will (thus) restore settings in (likely) global scope which actually were defined in a local, macro private context!) -. .Pp This command takes one or two arguments, the optional first one specifies an attribute that may be one of @@ -6225,7 +6369,6 @@ The latter two are mutually exclusive, and neither affects The (second) argument is interpreted as a boolean (string, see .Sx "INTERNAL VARIABLES" ) and states whether the given attribute shall be turned on or off. -. .Bd -literal -offset indent define temporary_settings { set possibly_global_option1 @@ -6236,8 +6379,6 @@ define temporary_settings { set possibly_global_option2 } .Ed -. -. .Mx .Mx .It Ic Lfollowup , Lreply @@ -6278,7 +6419,6 @@ It can also fail with errors of Occurrence of some of the errors depend on the value of .Va expandaddr . Any error stops processing of further messages. -. .Mx .It Ic Mail \*(CM Similar to @@ -6286,7 +6426,6 @@ Any error stops processing of further messages. but saves the message in a file named after the local part of the first recipient's address (instead of in .Va record Ns ). -. .Mx .It Ic mail \*(CM(m) Takes a (list of) recipient address(es) as (an) argument(s), @@ -6316,7 +6455,6 @@ It can also fail with errors of .Sx "Specifying messages" . Occurrence of some of the errors depend on the value of .Va expandaddr . -. .Mx .It Ic mailcap \*(OP When used without arguments or if @@ -6334,7 +6472,6 @@ Note that \*(UA will try to load the files only once, use to unlock further attempts. Loading and parsing can be made more .Va verbose . -. .Mx .It Ic mbox (mb) The given message list is to be sent to the @@ -6347,7 +6484,6 @@ is set. \*(ID This command can only be used in a .Mx -sx .Sx "primary system mailbox" . -. .Mx .Mx .It Ic mimetype , unmimetype @@ -6376,7 +6512,6 @@ will discard all existing MIME types, just as will .Ql reset , but which also reenables cache initialization via .Va mimetypes-load-control . -. .Mx .It Ic mimeview \*(ID Only available in interactive mode, this command allows execution @@ -6387,7 +6522,6 @@ output (see (\*(ID No syntax to directly address parts, this restriction may vanish.) The user will be asked for each non-text part of the given message in turn whether the registered handler shall be used to display the part. -. .Mx .Mx .It Ic mlist , unmlist @@ -6406,7 +6540,6 @@ without arguments, otherwise the given arguments will become known. will be interpreted as one, possibly matching many addresses; these will be sequentially matched via linked lists instead of being looked up in a dictionary. -. .Mx .Mx .It Ic mlsubscribe , unmlsubscribe @@ -6414,7 +6547,6 @@ Building upon the command pair .Ic mlist , unmlist , but only managing the subscription attribute of mailing lists. (The former will also create not yet existing mailing lists.) -. .Mx .It Ic Move Similar to @@ -6423,14 +6555,12 @@ but move the messages to a file named after the local part of the sender of the first message instead of taking a filename argument; .Va outfolder is inspected to decide on the actual storage location. -. .Mx .It Ic move Acts like .Ic copy but marks the messages for deletion if they were transferred successfully. -. .Mx .It Ic More Like @@ -6440,7 +6570,6 @@ but also displays header fields which would not pass the selection, and all MIME parts. Identical to .Ic Page . -. .Mx .It Ic more Invokes the @@ -6449,7 +6578,6 @@ on the given messages, even in non-interactive mode and as long as the standard output is a terminal. Identical to .Ic page . -. .Mx .It Ic mtaaliases \*(OP When used without arguments or if @@ -6462,7 +6590,6 @@ If the argument is then the cache will only be (re-)initialized, and .Ar clear will remove its contents. -. .Mx .It Ic netrc \*(OP When used without arguments, or when the argument was @@ -6488,7 +6615,6 @@ and the section the section .Sx "The .netrc file" documents the file format in detail. -. .Mx .It Ic newmail Checks for new mail in the current folder without committing any changes @@ -6499,7 +6625,6 @@ If the variable is set, the headers of each new message are also shown. This command is not available for all mailbox types. -. .Mx .It Ic next (n) (like @@ -6508,23 +6633,19 @@ or .Dq ENTER ) Goes to the next message in sequence and types it. With an argument list, types the next matching message. -. .Mx .It Ic New Same as .Ic Unread . -. .Mx .It Ic new Same as .Ic unread . -. .Mx .It Ic noop If the current folder is accessed via a network connection, a .Dq NOOP command is sent, otherwise no operation is performed. -. .Mx .It Ic Page Like @@ -6534,7 +6655,6 @@ but also displays header fields which would not pass the selection, and all MIME parts. Identical to .Ic More . -. .Mx .It Ic page Invokes the @@ -6543,7 +6663,6 @@ on the given messages, even in non-interactive mode and as long as the standard output is a terminal. Identical to .Ic more . -. .Mx .It Ic Pipe Like @@ -6553,7 +6672,6 @@ but also pipes header fields which would not pass the selection, and all parts of MIME .Ql multipart/alternative messages. -. .Mx .It Ic pipe (pi) Takes an optional message list and shell command (that defaults to @@ -6563,24 +6681,20 @@ If the .Va page variable is set, every message is followed by a formfeed character. -. .Mx .It Ic preserve (pre) A synonym for .Ic hold . -. .Mx .It Ic Print (P) Alias for .Ic Type . -. .Mx .It Ic print (p) Research .Ux equivalent of .Ic type . -. .Mx .It Ic quit (q) Terminates the session, saving all undeleted, unsaved messages in @@ -6612,7 +6726,6 @@ The optional status number argument will be passed through to \*(ID For now it can happen that the given status will be overwritten, later this will only occur if a later error needs to be reported onto an otherwise success indicating status. -. .Mx .It Ic read \*(NQ Read a line from standard input, or the channel set active via @@ -6649,7 +6762,6 @@ hey2.0,:"'you ",:world!:mars.: ? echo $?/$^ERRNAME / <$a><$b><$c> 0/NONE / <"'you ",><><> .Ed -. .Mx .It Ic readsh \*(NQ Like @@ -6662,7 +6774,6 @@ rather than at .Ic commandalias , maybe .Ql read --tokenize -- . -. .Mx .It Ic readall \*(NQ Read anything from standard input, or the channel set active via @@ -6684,7 +6795,6 @@ in case of I/O errors, or .Va ^ERR Ns -NONE upon End-Of-File. \*(ID The input data length is restricted to 31-bits. -. .Mx .It Ic readctl \*(NQ Manages input channels for @@ -6719,14 +6829,12 @@ $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6' hey, you .Ed -. .Mx .It Ic remove \*(NQ Removes the named files or directories. If a name refers to a mailbox, say a Maildir mailbox, then a mailbox type specific removal will be performed, deleting the complete mailbox. In interactive mode the user is asked for confirmation. -. .Mx .It Ic rename \*(NQ Takes the name of an existing folder @@ -6737,7 +6845,6 @@ including shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) are performed on both arguments. Both folders must be of the same type. -. .Mx .Mx .It Ic Reply , Respond @@ -6750,7 +6857,6 @@ etc.; setting .Va flipr will exchange this command with .Ic reply . -. .Mx .Mx .It Ic reply , respond @@ -6796,7 +6902,6 @@ for other errors. It can also fail with errors of .Sx "Specifying messages" . Any error stops processing of further messages. -. .Mx .It Ic Resend Like @@ -6804,7 +6909,6 @@ Like but does not add any header lines. This is not a way to hide the sender's identity, but useful for sending a message again to the same recipients. -. .Mx .It Ic resend Takes a list of messages and a name, @@ -6836,12 +6940,10 @@ for other errors. It can also fail with errors of .Sx "Specifying messages" . Any error stops processing of further messages. -. .Mx .It Ic retain (ret) Superseded by the multiplexer .Ic headerpick . -. .Mx .It Ic return Only available inside of a @@ -6858,7 +6960,6 @@ the second the 32-bit error number (stored in As documented for .Va \&? a non-0 exit status may cause the program to exit. -. .Mx .It Ic Save (S) Similar to @@ -6867,7 +6968,6 @@ but saves the messages in a file named after the local part of the sender of the first message instead of taking a filename argument; .Va outfolder is inspected to decide on the actual storage location. -. .Mx .It Ic save (s) Takes a message list and a filename and appends each message in turn @@ -6893,19 +6993,15 @@ slot of the white- and blacklisting command .Ic headerpick . Also see .Ic Copy . -. .It Ic savediscard \*(OB Superseded by the multiplexer .Ic headerpick . -. .It Ic saveignore \*(OB Superseded by the multiplexer .Ic headerpick . -. .It Ic saveretain \*(OB Superseded by the multiplexer .Ic headerpick . -. .Mx .It Ic search Takes a message specification (list) and displays a header summary of @@ -6915,12 +7011,9 @@ This command is an alias of .Ic from . Also see .Sx "Specifying messages" . -. .Mx .It Ic seen Takes a message list and marks all messages as having been read. -. -. .Mx .Mx .It Ic set , unset @@ -6945,7 +7038,6 @@ condition or a string passed to explicit .Ic \&\&set Ns ting, as well as some program-internal use cases (look-ups). -. .Pp Otherwise the given variables (and arguments) are set or adjusted. Arguments are of the form @@ -6971,7 +7063,6 @@ command prefix(es) can be used to quote arguments as necessary. \*(ID Otherwise quotation marks may be placed around any part of the assignment statement to quote blanks or tabs. -. .Pp When operating in global scope any .Ql name @@ -6998,13 +7089,10 @@ and the sections .Sx "INTERNAL VARIABLES" and .Sx ENVIRONMENT . -. .Bd -literal -offset indent ? wysh set indentprefix=' -> ' ? wysh set atab=$'\t' aspace=' ' zero=0 .Ed -. -. .Mx .It Ic shcodec Apply shell quoting rules to the given raw-data arguments. @@ -7028,12 +7116,10 @@ is set to .Va ^ERR Ns -CANCELED , and the unmodified input is used as the result; the error number may change again due to output or result storage errors. -. .Mx .It Ic shell \*(NQ (sh) Invokes an interactive version of the shell, and returns its exit status. -. .Mx .Mx .It Ic shortcut , unshortcut @@ -7046,7 +7132,6 @@ The former shows the list of all currently defined shortcuts if used without arguments, the target of the given with a single argument. Otherwise arguments are treated as pairs of shortcuts and their desired expansion, creating new or updating already existing ones. -. .Mx .It Ic shift \*(NQ Shift the positional parameter stack (starting at @@ -7062,19 +7147,16 @@ Note this command will fail in and hook macros unless the positional parameter stack has been explicitly created in the current context via .Ic vpospar . -. .Mx .It Ic show Like .Ic type , but performs neither MIME decoding nor decryption, so that the raw message text is shown. -. .Mx .It Ic size (si) Shows the size in characters of each message of the given message list. -. .Mx .It Ic sleep \*(NQ Sleep for the specified number of seconds (and optionally @@ -7090,8 +7172,6 @@ The command will fail and the error number will be if the given duration(s) overflow the time datatype, and .Va ^ERR Ns -INVAL if the given durations are no valid integers. -. -. .Mx .Mx .It Ic sort , unsort @@ -7116,7 +7196,6 @@ Automatic folder sorting can be enabled by setting the variable, as in .Ql set autosort=thread . Possible sorting criterions are: -. .Pp .Bl -tag -compact -width "subject" .It Ar date @@ -7149,8 +7228,6 @@ If the .Va showname variable is set, the recipient's real name (if any) is used. .El -. -. .Mx .It Ic source \*(NQ (so) The source command reads commands from the given file. @@ -7175,7 +7252,6 @@ or .Ic account Ns s , i.e., it can only be called from macros that were .Ic call Ns ed . -. .Mx .It Ic source_if \*(NQ The difference to @@ -7183,13 +7259,11 @@ i.e., it can only be called from macros that were (beside not supporting pipe syntax aka shell command input) is that this command will not generate an error nor warn if the given file argument cannot be opened successfully. -. .Mx .It Ic spamclear \*(OP Takes a list of messages and clears their .Ql is-spam flag. -. .Mx .It Ic spamforget \*(OP Takes a list of messages and causes the @@ -7202,7 +7276,6 @@ forgotten to be .Dq ham or .Dq spam . -. .Mx .It Ic spamham \*(OP Takes a list of messages and informs the Bayesian filter of the @@ -7212,7 +7285,6 @@ that they are This also clears the .Ql is-spam flag of the messages in question. -. .Mx .It Ic spamrate \*(OP Takes a list of messages and rates them using the configured @@ -7224,13 +7296,11 @@ will be forgotten once the mailbox is left. Refer to the manual section .Sx "Handling spam" for the complete picture of spam handling in \*(UA. -. .Mx .It Ic spamset \*(OP Takes a list of messages and sets their .Ql is-spam flag. -. .Mx .It Ic spamspam \*(OP Takes a list of messages and informs the Bayesian filter of the @@ -7240,15 +7310,12 @@ that they are This also sets the .Ql is-spam flag of the messages in question. -. .It Ic thread \*(OB The same as .Ql sort thread (consider using a .Ql commandalias as necessary). -. -. .Mx .It Ic tls \*(NQ TLS information and management command multiplexer to aid in @@ -7270,12 +7337,10 @@ to .Va ^ERR Ns -OVERFLOW . The TLS configuration is honoured, especially .Va tls-verify . -. .Bd -literal -offset indent ? vput tls result fingerprint pop3s://ex.am.ple ? echo $?/$!/$^ERRNAME: $result .Ed -. .Bl -hang -width ".It Cm random" .It Cm certchain Show the complete verified peer certificate chain. @@ -7294,8 +7359,6 @@ where the port defaults to the HTTPS port, 443). .Va tls-fingerprint is actively ignored for the runtime of this command. .El -. -. .Mx .It Ic Top Like @@ -7304,7 +7367,6 @@ but always uses the .Ic headerpick .Ql type slot for white- and blacklisting header fields. -. .Mx .It Ic top (to) Takes a message list and types out the first @@ -7329,7 +7391,6 @@ It is possible to apply compression to what is displayed by setting .Va topsqueeze . Messages are decrypted and converted to the terminal character set if necessary. -. .Mx .It Ic touch (tou) Takes a message list and marks the messages for saving in the @@ -7340,7 +7401,6 @@ if necessary. as a following .Ic next command will display the following message instead of the current one. -. .Mx .It Ic Type (T) Like @@ -7350,7 +7410,6 @@ but also displays header fields which would not pass the selection, and all visualizable parts of MIME .Ql multipart/alternative messages. -. .Mx .It Ic type (t) Takes a message list and types out each message on the user's terminal. @@ -7368,111 +7427,85 @@ if necessary. The command .Ic mimeview can be used to display parts which are not displayable as plain text. -. .It Ic unaccount See .Ic account . -. .It Ic unalias (una) See .Ic alias . -. .It Ic unanswered See .Ic answered . -. .It Ic unbind See .Ic bind . -. .It Ic uncollapse See .Ic collapse . -. .It Ic uncolour See .Ic colour . -. .It Ic undefine See .Ic define . -. .It Ic undelete See .Ic delete . -. .It Ic undraft See .Ic draft . -. .It Ic unflag See .Ic flag . -. .It Ic unfwdignore \*(OB Superseded by the multiplexer .Ic headerpick . -. .It Ic unfwdretain \*(OB Superseded by the multiplexer .Ic headerpick . -. .Mx .It Ic unignore Superseded by the multiplexer .Ic headerpick . -. .It Ic unmimetype See .Ic mimetype . -. .It Ic unmlist See .Ic mlist . -. .It Ic unmlsubscribe See .Ic mlsubscribe . -. .Mx .It Ic Unread Same as .Ic unread . -. .Mx .It Ic unread Takes a message list and marks each message as not having been read. -. .Mx .It Ic unretain Superseded by the multiplexer .Ic headerpick . -. .It Ic unsaveignore \*(OB Superseded by the multiplexer .Ic headerpick . -. .It Ic unsaveretain \*(OB Superseded by the multiplexer .Ic headerpick . -. .It Ic unset \*(NQ (uns) See .Ic set . -. .It Ic unshortcut See .Ic shortcut . -. .It Ic unsort See .Ic short . -. .It Ic unthread \*(OB Same as .Ic unsort . -. .Mx .It Ic urlcodec Perform URL percent codec operations on the raw-data argument, rather @@ -7515,7 +7548,6 @@ change again due to output or result storage errors. offers a .Cm makeprint subcommand, shall the URL be displayed.) -. .Mx .It Ic varshow \*(NQ This command produces the same output as the listing mode of @@ -7523,7 +7555,6 @@ subcommand, shall the URL be displayed.) including .Va verbose Ns ity adjustments, but only for the given variables. -. .Mx .It Ic verify \*(OP Takes a message list and verifies each message. @@ -7534,7 +7565,6 @@ certificate, if the message sender's email address matches one of those contained within the certificate, and if the message content has been altered. -. .Mx .It Ic version Shows the @@ -7548,8 +7578,6 @@ This command supports .Cm vput (see .Sx "Command modifiers" ) . -. -. .Mx .It Ic vexpr \*(NQ A multiplexer command which offers signed 64-bit numeric @@ -7576,7 +7604,6 @@ numbers, and errors will be reported in the error number .Va \&! as the numeric error .Va ^ERR Ns -RANGE . -. .Pp Numeric operations work on one or two signed 64-bit integers. Numbers prefixed with @@ -7613,7 +7640,6 @@ supports complicated conditions out of the box: < -009> 0b1001 .Ed -. .Pp One integer is expected by assignment (equals sign .Ql = ) , @@ -7644,7 +7670,6 @@ the bitwise signed left- and right shifts .Ql >> ) , as well as for the unsigned right shift .Ql >>> . -. .Pp Another numeric operation is .Cm pbase , @@ -7654,7 +7679,6 @@ on the second number given just the same as what equals sign does, but the number result will be formatted in the base given, as a signed 64-bit number unless unsigned interpretation of the input number had been forced (with an u prefix). -. .Pp Numeric operations support a saturated mode via the question mark .Ql \&? @@ -7675,17 +7699,14 @@ Any caught overflow will be reported via the error number .Va \&! as .Va ^ERR Ns -OVERFLOW . -. .Bd -literal -offset indent ? vput vexpr res -? +1 -9223372036854775808 ? echo $?/$!/$^ERRNAME:$res 0/75/OVERFLOW:-9223372036854775808 .Ed -. .Pp Character set agnostic string functions have no notion of locale settings and character sets. -. .Bl -hang -width ".It Cm random" .It Cm date-utc Outputs the current date and time in UTC (Coordinated Universal Time) @@ -7742,7 +7763,6 @@ bytes (a constant from if the value 0 is given; the random string will be base64url encoded according to RFC 4648, and thus be usable as a (portable) filename. .El -. .Pp String operations work, sufficient support provided, according to the active user's locale encoding and character set (see @@ -7757,12 +7777,10 @@ is optional, and .Ql regex?case are therefore identical. -. .Bl -hang -width ".It Cm regex" .It Cm makeprint (One-way) Converts the argument to something safely printable on the terminal. -. .It Cm regex \*(OP A string operation that will try to match the first argument with the regular expression given as the second argument. @@ -7786,8 +7804,6 @@ etc. is replaced with the according match group of the regular expression: 0/0/NONE:bauauframa: .Ed .El -. -. .Mx .It Ic vpospar \*(NQ Manage the positional parameter stack (see @@ -7804,7 +7820,6 @@ then the remaining arguments will be used to (re)create the stack, if the parameter stack size limit is excessed an .Va ^ERR Ns -OVERFLOW error will occur. -. .Pp If the first argument is .Ql quote , @@ -7829,7 +7844,6 @@ and can be used (in conjunction with .Ic eval ) to (re)create an argument stack from and to a single variable losslessly. -. .Bd -literal -offset indent ? vpospar set hey, "'you ", world! ? echo $#: <${1}><${2}><${3}> @@ -7839,8 +7853,6 @@ to (re)create an argument stack from and to a single variable losslessly. ? eval vpospar set ${x} ? echo $#: <${1}><${2}><${3}> .Ed -. -. .Mx .It Ic visual (v) Takes a message list and invokes the @@ -7852,7 +7864,6 @@ variable is set, and are not used unless the mailbox can be written to and the editor returns a successful exit status. .Ic edit can be used instead for a less display oriented editor. -. .Mx .It Ic write (w) For conventional messages the body without all headers is written. @@ -7895,7 +7906,6 @@ a dot are appended after a number sign .Ql # to the name until file creation succeeds (or fails due to other reasons). -. .Mx .It Ic xcall \*(NQ The sole difference to @@ -7910,12 +7920,10 @@ If this command is not used from within a .Ic call Ns ed macro it will silently be (a more expensive variant of) .Ic call . -. .Mx .It Ic xit (x) A synonym for .Ic exit . -. .Mx .It Ic z \*(NQ \*(UA presents message headers in @@ -7941,7 +7949,6 @@ or .Ql \- indicates that the window is calculated in relation to the current position, and a number without a prefix specifies an absolute position. -. .Mx .It Ic Z \*(NQ Similar to @@ -7952,14 +7959,7 @@ or .Ic flag Ns ged message. .El -.\" }}} -. -.\" }}} -. -. -.\" .Sh COMMAND ESCAPES {{{ .Sh "COMMAND ESCAPES" -. Command escapes are available in .Sx "Compose mode" during interactive usage, when explicitly requested via @@ -7976,7 +7976,6 @@ The default .Va escape character is the tilde .Ql ~ . -. .Pp Unless otherwise documented command escapes ensure proper updates of the error number @@ -7989,7 +7988,6 @@ controls whether a failed operation errors out message compose mode and causes program exit. Escapes may be prefixed by none to multiple single character command modifiers, interspersed whitespace is ignored: -. .Bl -bullet .It An effect equivalent to the command modifier @@ -8009,7 +8007,6 @@ that control operators like semicolon .Cm \&; are interpreted unintentionally, they must be quoted. .El -. .Pp Addition of the command line to the \*(OPal history can be prevented by placing whitespace directly after @@ -8018,8 +8015,6 @@ The \*(OPal key .Ic bind Ns ings support a compose mode specific context. The following command escapes are supported: -. -. .Bl -tag -width ".It Ic BaNg" .Mx .It Ic ~~ Ar string @@ -8027,7 +8022,6 @@ Insert the string of text in the message prefaced by a single .Ql ~ . (If the escape character has been changed, that character must be doubled instead.) -. .Mx .It Ic ~! Ar command Execute the indicated shell @@ -8036,7 +8030,6 @@ which follows, replacing unescaped exclamation marks with the previously executed command if the internal variable .Va bang is set, then return to the message. -. .Mx .It Ic ~. End compose mode and send the message. @@ -8062,28 +8055,23 @@ will be joined in if set, finally a given .Va message-inject-tail will be incorporated, after which the compose mode is left. -. .Mx .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command Can be used to execute .Sx COMMANDS (which are allowed in compose mode). -. .Mx .It Ic ~< Ar filename Identical to .Ic ~r . -. .Mx .It Ic ~|}: . -. .Mx .It Va quote-fold \*(OP Can be set in addition to @@ -11801,8 +11467,6 @@ If not set explicitly the minimum will reflect the goal algorithmically. The goal cannot be smaller than the length of .Va indentprefix plus some additional pad; necessary adjustments take place silently. -. -. .Mx .Mx .It Va quote-inject-head , quote-inject-tail @@ -11820,7 +11484,6 @@ and expand values of the original message, unless noted otherwise. Note that names and addresses are not subject to the setting of .Va showto . Valid format specifiers are: -. .Pp .Bl -tag -compact -width ".It Ql _%%_" .It Ql %% @@ -11851,8 +11514,6 @@ allows usage, the address(es) otherwise. .It Ql %r The senders real name(s) if there is one, the address(es) otherwise. .El -. -. .Mx .It Va r-option-implicit \*(BO Setting this option evaluates the contents of @@ -11862,7 +11523,6 @@ The senders real name(s) if there is one, the address(es) otherwise. and passes the results onto the used (file-based) MTA as described for the .Fl r option (empty argument case). -. .Mx .It Va recipients-in-cc \*(BO When doing a @@ -11881,7 +11541,6 @@ If this variable is set a sensitive algorithm tries to place in .Ql To: only the sender of the message being replied to, others are placed in .Ql Cc: . -. .Mx .It Va record Unless this variable is defined, no copies of outgoing mail will be saved. @@ -11899,7 +11558,6 @@ to force interpretation relative to .Va folder .Va outfolder needs to be set in addition. -. .Mx .It Va record-files \*(BO If this variable is set the meaning of @@ -11910,7 +11568,6 @@ recipients (see These address types will not appear in recipient lists unless .Va add-file-recipients is also set. -. .Mx .It Va record-resent \*(BO If this variable is set the meaning of @@ -11920,7 +11577,6 @@ will be extended to also cover the and .Ic Resend commands. -. .Mx .It Va reply-in-same-charset \*(BO If this variable is set \*(UA first tries to use the same @@ -11928,7 +11584,6 @@ character set of the original message for replies. If this fails, the mechanism described in .Sx "Character sets" is evaluated as usual. -. .Mx .It Va reply-strings Can be set to a comma-separated list of (case-insensitive according to @@ -11944,7 +11599,6 @@ and the .Ql Wg: which often has been seen in the wild; I.e., the separating colon has to be specified explicitly. -. .Mx .It Va reply-to A list of addresses to put into the @@ -11953,11 +11607,9 @@ field of the message header. Members of this list are handled as if they were in the .Ic alternates list. -. .It Va replyto \*(OB Variant of .Va reply-to . -. .Mx .It Va reply-to-honour Controls whether a @@ -11971,7 +11623,6 @@ This is a .Sx quadoption ; if set without a value it defaults to .Dq yes . -. .Mx .It Va reply-to-swap-in Standards like DKIM and (in conjunction with) DMARC caused many @@ -11991,7 +11642,6 @@ fine-grained control on when swapping shall be used; for now supported is .Va mlist , here swapping occurs if the sender is a mailing-list as defined by .Ic mlist . -. .Mx .It Va rfc822-body-from_ \*(BO This variable can be used to force displaying a so-called @@ -12000,13 +11650,11 @@ line for messages that are embedded into an envelope mail via the .Ql message/rfc822 MIME mechanism, for more visual convenience, also see .Va mbox-rfc4155 . -. .Mx .It Va save \*(BO Enable saving of (partial) messages in .Ev DEAD upon interrupt or delivery error. -. .Mx .It Va screen The number of lines that represents a @@ -12030,7 +11678,6 @@ and .Ev LINES and the variable .Va crt . -. .Mx .It Va searchheaders \*(BO Expand message list specifiers in the form @@ -12040,7 +11687,6 @@ to all messages containing the substring in the header field .Ql x . The string search is case insensitive. -. .Mx .It Va sendcharsets \*(OP A comma-separated list of character set names that can be used in @@ -12056,7 +11702,6 @@ Also see and refer to the section .Sx "Character sets" for the complete picture of character set conversion in \*(UA. -. .Mx .It Va sendcharsets-else-ttycharset \*(BO\*(OP If this variable is set, but @@ -12093,7 +11738,6 @@ then; and/or do something like the following in the resource file: \eset sendcharsets-else-ttycharset \eend .Ed -. .Mx .It Va sender An address that is put into the @@ -12114,23 +11758,18 @@ the list of Also see .Fl r , .Va r-option-implicit . -. .It Va sendmail \*(OB Predecessor of .Va mta . -. .It Va sendmail-arguments \*(OB Predecessor of .Va mta-arguments . -. .It Va sendmail-no-default-arguments \*(OB\*(BO Predecessor of .Va mta-no-default-arguments . -. .It Va sendmail-progname \*(OB Predecessor of .Va mta-argv0 . -. .Mx .It Va sendwait Sending messages to the chosen @@ -12157,7 +11796,6 @@ for delivery, and .Ql pcc for command-pipe receivers. -. .Mx .It Va showlast \*(BO This setting causes \*(UA to start at the last message @@ -12165,17 +11803,14 @@ instead of the first one when opening a mail folder, as well as with .Ic from and .Ic headers . -. .Mx .It Va showname \*(BO Causes \*(UA to use the sender's real name instead of the plain address in the header field summary and in message specifications. -. .Mx .It Va showto \*(BO Causes the recipient of the message to be shown in the header summary if the message was sent by the user. -. .Mx .It Va Sign The value backing @@ -12187,7 +11822,6 @@ Also see .Va on-compose-leave and .Va on-compose-splice . -. .Mx .It Va sign The value backing @@ -12199,7 +11833,6 @@ Also see .Va on-compose-leave and .Va on-compose-splice . -. .Mx .It Va signature \*(OB Please use @@ -12211,13 +11844,11 @@ or and (if necessary) .Va message-inject-tail instead! -. .Mx .It Va skipemptybody \*(BO If an outgoing message has an empty first or only message part, do not send, but discard it, successfully (also see the command line option .Fl E ) . -. .Mx .Mx .It Va smime-ca-dir , smime-ca-file @@ -12230,19 +11861,16 @@ be explicitly turned off by setting .Va smime-ca-no-defaults , and further fine-tuning is possible via .Va smime-ca-flags . -. .Mx .It Va smime-ca-flags \*(OP Can be used to fine-tune behaviour of the X509 CA certificate storage, and the certificate verification that is used. The actual values and their meanings are documented for .Va tls-ca-flags . -. .Mx .It Va smime-ca-no-defaults \*(BO\*(OP Do not load the default CA locations that are built into the used to TLS library to verify S/MIME signed messages. -. .Mx Va smime-cipher .It Va smime-cipher-USER@HOST , smime-cipher \*(OP Specifies the cipher to use when generating S/MIME encrypted @@ -12270,17 +11898,14 @@ library that \*(UA uses. dynamic loading via .Xr EVP_get_cipherbyname 3 (OpenSSL) if \*(UA has been compiled to support this. -. .Mx .It Va smime-crl-dir \*(OP Specifies a directory that contains files with CRLs in PEM format to use when verifying S/MIME messages. -. .Mx .It Va smime-crl-file \*(OP Specifies a file that contains a CRL in PEM format to use when verifying S/MIME messages. -. .Mx .It Va smime-encrypt-USER@HOST \*(OP If this variable is set, messages send to the given receiver are @@ -12300,11 +11925,9 @@ It is recommended to sign encrypted messages, i.e., to also set the variable. .Va content-description-smime-message will be inspected for messages which become encrypted. -. .Mx .It Va smime-force-encryption \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages. -. .Mx .It Va smime-sign \*(BO\*(OP S/MIME sign outgoing messages with the user's @@ -12322,7 +11945,6 @@ Also see .Va smime-sign-cert , smime-sign-include-certs and .Va smime-sign-digest . -. .Mx Va smime-sign-cert .It Va smime-sign-cert-USER@HOST , smime-sign-cert \*(OP Points to a file in PEM format. @@ -12377,7 +11999,6 @@ To include intermediate certificates, use .Va smime-sign-include-certs . The possible password sources are documented in .Sx "On URL syntax and credential lookup" . -. .Mx Va smime-sign-digest .It Va smime-sign-digest-USER@HOST , smime-sign-digest \*(OP Specifies the message digest to use when signing S/MIME messages. @@ -12418,7 +12039,6 @@ finally More digests may \*(OPally be available through dynamic loading via the OpenSSL function .Xr EVP_get_digestbyname 3 . -. .Mx Va smime-sign-include-certs .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs \*(OP If used, this is supposed to a consist of a comma-separated list @@ -12446,11 +12066,9 @@ will be used for performing password lookups for these certificates, shall they have been given one, therefore the lookup can be automated via the mechanisms described in .Sx "On URL syntax and credential lookup" . -. .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest \*(OB\*(OP Predecessor(s) of .Va smime-sign-digest . -. .It Va smtp \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in .Va mta . @@ -12458,7 +12076,6 @@ via the mechanisms described in .Va smtp is used in preference of .Va mta . -. .Mx Va smtp-auth .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth \*(OP Variable chain that controls the SMTP @@ -12513,7 +12130,6 @@ Note for .Va smtp-auth-USER@HOST : may override dependent on sender address in the variable .Va from . ) -. .It Va smtp-auth-password \*(OP\*(OU Sets the global fallback password for SMTP authentication. If the authentication method requires a password, but neither @@ -12522,13 +12138,11 @@ nor a matching .Va smtp-auth-password-USER@HOST can be found, \*(UA will ask for a password on the user's terminal. -. .It Va smtp-auth-password-USER@HOST \*(OU Overrides .Va smtp-auth-password for specific values of sender addresses, dependent upon the variable .Va from . -. .It Va smtp-auth-user \*(OP\*(OU Sets the global fallback user name for SMTP authentication. If the authentication method requires a user name, but neither @@ -12537,13 +12151,11 @@ nor a matching .Va smtp-auth-user-USER@HOST can be found, \*(UA will ask for a user name on the user's terminal. -. .It Va smtp-auth-user-USER@HOST \*(OU Overrides .Va smtp-auth-user for specific values of sender addresses, dependent upon the variable .Va from . -. .Mx .It Va smtp-hostname \*(OP\*(IN Normally \*(UA uses the variable @@ -12580,7 +12192,6 @@ header fields. If the \*(OPal IDNA support is available (see .Va idna-disable ) variable assignment is aborted when a necessary conversion fails. -. .Mx Va smtp-use-starttls .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls \*(BO\*(OP Causes \*(UA to issue a @@ -12588,13 +12199,11 @@ variable assignment is aborted when a necessary conversion fails. command to make an SMTP .Va mta session TLS encrypted, i.e., to enable transport layer security. -. .Mx .It Va socket-connect-timeout \*(OP A positive number that defines the timeout to wait for establishing a socket connection before forcing .Va ^ERR Ns -TIMEDOUT . -. .Mx Va socks-proxy .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy \*(OP If set to the URL of a SOCKS5 server then all network activities @@ -12615,7 +12224,6 @@ $ ssh -D 10000 USER@HOST $ \*(uA -Ssocks-proxy=[socks5://]localhost:10000 # or =localhost:10000; no local DNS: =127.0.0.1:10000 .Ed -. .Mx .It Va spam-interface \*(OP In order to use any of the spam-related commands (like @@ -12625,7 +12233,6 @@ Please refer to the manual section .Sx "Handling spam" for the complete picture of spam handling in \*(UA. All or none of the following interfaces may be available: -. .Bl -tag -width ".It Ql _ilte_" .It Ql spamc Interaction with @@ -12655,7 +12262,6 @@ Note that this interface does not inspect the .Ql is-spam flag of a message for the command .Ic spamforget . -. .It Ql filter generic spam filter support via freely configurable hooks. This interface is meant for programs like @@ -12689,15 +12295,12 @@ available and the .Va spamfilter-rate-scanscore variable is set. .El -. -. .Mx .It Va spam-maxsize \*(OP Messages that exceed this size will not be passed through to the configured .Va spam-interface . If unset or 0, the default of 420000 bytes is used. -. .Mx .It Va spamc-command \*(OP The path to the @@ -12709,7 +12312,6 @@ Note that the path is not expanded, but used .Dq as is . A fallback path will have been compiled into the \*(UA binary if the executable had been found during compilation. -. .Mx .It Va spamc-arguments \*(OP Even though \*(UA deals with most arguments for the @@ -12718,7 +12320,6 @@ executable had been found during compilation. automatically, it may at least sometimes be desirable to specify connection-related ones via this variable, for example .Ql -d server.example.com -p 783 . -. .Mx .It Va spamc-user \*(OP Specify a username for per-user configuration files for the @@ -12727,7 +12328,6 @@ connection-related ones via this variable, for example If this is set to the empty string then \*(UA will use the name of the current .Va user . -. .Mx .Mx .Mx @@ -12741,7 +12341,6 @@ current The manual section .Sx "Handling spam" contains examples for some programs. -. .Mx .It Va spamfilter-rate-scanscore \*(OP Because of the generic nature of the @@ -12758,88 +12357,71 @@ Then the latter is used to parse the first output line of the .Va spamfilter-rate hook, and, in case the evaluation is successful, the group that has been specified via the number is interpreted as a floating point scan score. -. .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\ ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file \*(OB\*(OP Predecessors of .Va tls-ca-file , .Va tls-ca-dir . -. .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags \*(OB\*(OP Predecessor of .Va tls-ca-flags . -. .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\ ssl-ca-no-defaults \*(OB\*(BO\*(OP Predecessor of .Va tls-ca-no-defaults . -. .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert \*(OB\*(OP Please use the .Cd Certificate slot of .Va tls-config-pairs . -. .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list \*(OB\*(OP Please use the .Cd CipherString slot of .Va tls-config-pairs . -. .It Va ssl-config-file \*(OB\*(OP Predecessor of .Va tls-config-file . -. .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\ ssl-config-module \*(OB\*(OP Predecessor of .Va tls-config-module . -. .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs \*(OB\*(OP Predecessor of .Va tls-config-pairs . -. .It Va ssl-crl-dir , ssl-crl-file \*(OB\*(OP Predecessors of .Va tls-crl-dir , .Va tls-crl-file . -. .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves \*(OB\*(OP Please use the .Cd Curves slot of .Va tls-config-pairs . -. .It Va ssl-features \*(OB\*(OP\*(RO Predecessor of .Va tls-features . -. .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key \*(OB\*(OP Please use the .Cd PrivateKey slot of .Va tls-config-pairs . -. .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method \*(OB\*(OP Please use the .Cd Protocol slot of .Va tls-config-pairs . -. .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol \*(OB\*(OP Please use the .Cd Protocol slot of .Va tls-config-pairs . -. .It Va ssl-rand-file \*(OB\*(OP Predecessor of .Va tls-rand-file . -. .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify \*(OB\*(OP Predecessor of .Va tls-verify . -. .Mx .It Va stealthmua If only set without an assigned value, then this setting inhibits the @@ -12860,15 +12442,12 @@ then the mentioned and .Ql Content-ID: suppression does not occur. -. .Mx .It Va system-mailrc \*(RO The compiled in path of the system wide initialization file one of the .Sx "Resource files" : .Pa \*(UR . -. -. .Mx .It Va termcap (\*(OP) This specifies a comma-separated list of @@ -12887,7 +12466,6 @@ It will always be inspected, regardless of whether .Va features denotes termcap/terminfo library support via .Ql ,+termcap, . -. .Pp String capabilities form .Ql cap=value @@ -12916,15 +12494,12 @@ finally three letter octal sequences, as in are supported. To specify that a terminal supports 256-colours, and to define sequences that home the cursor and produce an audible bell, one might write: -. .Bd -literal -offset indent ? set termcap='Co#256,home=\eE[H,bel=^G' .Ed -. .Pp The following terminal capabilities are or may be meaningful for the operation of the built-in line editor or \*(UA in general: -. .Pp .Bl -tag -compact -width ".It Cd yay" .It Cd am @@ -12934,7 +12509,6 @@ boolean which indicates if the right margin needs special treatment; the capability is related, for more see .Ev COLUMNS . This capability is only used when backed by library support. -. .It Cd clear Ns \0or Cd cl .Cd clear_screen : clear the screen and home cursor. @@ -12942,27 +12516,22 @@ clear the screen and home cursor. .Cd ho plus .Cd cd . ) -. -.\" mx_HAVE_COLOUR .It Cd colors Ns \0or Cd Co .Cd max_colors : numeric capability specifying the maximum number of colours. Note that \*(UA does not actually care about the terminal beside that, but always emits ANSI / ISO 6429 escape sequences; also see .Ic colour . -. .It Cd cr .Cd carriage_return : move to the first column in the current row. The default built-in fallback is .Ql \er . -. .It Cd cub1 Ns \0or Cd le .Cd cursor_left : move the cursor left one space (non-destructively). The default built-in fallback is .Ql \eb . -. .It Cd cuf1 Ns \0or Cd nd .Cd cursor_right : move the cursor right one space (non-destructively). @@ -12973,23 +12542,18 @@ Less often occur .Ql \eEC and .Ql \eEOC . -. .It Cd ed Ns \0or Cd cd .Cd clr_eos : clear the screen. -. -.\" mx_HAVE_MLE .It Cd el Ns \0or Cd ce .Cd clr_eol : clear to the end of line. (Will be simulated via .Cd ch plus repetitions of space characters.) -. .It Cd home Ns \0or Cd ho .Cd cursor_home : home cursor. -. .It Cd hpa Ns \0or Cd ch .Cd column_address : move the cursor (to the given column parameter) in the current row. @@ -12997,8 +12561,6 @@ move the cursor (to the given column parameter) in the current row. .Cd cr plus .Cd nd . ) -. -.\" mx_HAVE_TERMCAP .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti .Cd exit_ca_mode and @@ -13007,7 +12569,6 @@ respectively: exit and enter the alternative screen ca-mode, effectively turning \*(UA into a fullscreen application. This must be enabled explicitly by setting .Va termcap-ca-mode . -. .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke .Cd keypad_xmit and @@ -13016,7 +12577,6 @@ respectively: enable and disable the keypad. This is always enabled if available, because it seems even keyboards without keypads generate other key codes for, e.g., cursor keys in that case, and only if enabled we see the codes that we are interested in. -. .It Cd xenl Ns \0or Cd xn .Cd eat_newline_glitch : boolean which indicates whether a newline written in the last column of an @@ -13027,12 +12587,9 @@ This will be inspected even without .Ql ,+termcap, .Va features . .El -. .Pp Many more capabilities which describe key-sequences are documented for .Ic bind . -. -. .Mx .It Va termcap-ca-mode \*(OP Allow usage of the @@ -13048,7 +12605,6 @@ also dependent on the value of .Sy Note this variable will only be queried once at program startup and can thus only be specified in resource files or on the command line. -. .Mx .It Va termcap-disable \*(OP Disable any interaction with a terminal control library. @@ -13058,7 +12614,6 @@ describe the terminal to \*(UA. .Sy Note this variable will only be queried once at program startup and can thus only be specified in resource files or on the command line. -. .Mx Va tls-ca-file .Mx Va tls-ca-dir .It Va tls-ca-dir-USER@HOST , tls-ca-dir-HOST , tls-ca-dir ,\ @@ -13078,8 +12633,6 @@ and .Xr verify 1 (or .Xr c_rehash 1 ) . -. -. .Mx Va tls-ca-flags .It Va tls-ca-flags-USER@HOST , tls-ca-flags-HOST , tls-ca-flags \*(OP Can be used to fine-tune behaviour of the X509 CA certificate @@ -13095,7 +12648,6 @@ and the availability of which depends on the used TLS library version: a directive without mapping is ignored (error log subject to .Va debug ) . Directives currently understood (case-insensitively) include: -. .Pp .Bl -tag -compact -width ".It Cd BaNg" .It Cd no-alt-chains @@ -13125,14 +12677,11 @@ Newer versions of OpenSSL support alternative chain checking and enable it by default, resulting in the same behaviour; also see .Cd no-alt-chains . .El -. -. .Mx Va tls-ca-no-defaults .It Va tls-ca-no-defaults-USER@HOST , tls-ca-no-defaults-HOST ,\ tls-ca-no-defaults \*(BO\*(OP Do not load the default CA locations that are built into the used to TLS library to verify TLS server certificates. -. .Mx .It Va tls-config-file \*(OP If this variable is set @@ -13154,7 +12703,6 @@ The application name will always be passed as Some TLS libraries support application-specific configuration via resource files loaded like this, please see .Va tls-config-module . -. .Mx Va tls-config-module .It Va tls-config-module-USER@HOST , tls-config-module-HOST ,\ tls-config-module @@ -13190,8 +12738,6 @@ CipherString = TLSv1.2:!aNULL:!eNULL: MinProtocol = TLSv1.1 Options = Bugs .Ed -. -. .Mx Va tls-config-pairs .It Va tls-config-pairs-USER@HOST , tls-config-pairs-HOST , tls-config-pairs \*(OP The value of this variable chain will be interpreted as @@ -13220,7 +12766,6 @@ Unless proper support is announced by only the keys below are supported, otherwise the pairs will be used directly as arguments to the function .Xr SSL_CONF_cmd 3 . -. .Pp .Bl -tag -compact -width ".It Cd C_rtificate_" .It Cd Certificate @@ -13236,7 +12781,6 @@ Some services support so-called authentication if a TLS client certificate was successfully presented during connection establishment .Pf ( Dq connecting is authenticating ) . -. .It Cd CipherString A list of ciphers for TLS connections, see .Xr ciphers 1 . @@ -13246,7 +12790,6 @@ specific list of ciphers (the protocol standards define lists of acceptable ciphers; possibly cramped by the used TLS library). Fallback support via .Xr SSL_CTX_set_cipher_list 3 . -. .It Cd Ciphersuites A list of ciphers used for TLSv1.3 connections, see .Xr ciphers 1 . @@ -13258,14 +12801,12 @@ announces .Ql ,+ctx-set-ciphersuites, , as necessary via .Xr SSL_CTX_set_ciphersuites 3 . -. .It Cd Curves A list of supported elliptic curves, if applicable. By default no curves are set. Fallback support via .Xr SSL_CTX_set1_curves_list 3 , if available. -. .It Cd MaxProtocol , MinProtocol The maximum and minimum supported TLS versions, respectively. Available if @@ -13285,7 +12826,6 @@ these fallbacks use an internal parser which understands the strings and the special value .Ql None , which disables the given limit. -. .It Cd Options Various flags to set. Fallback via @@ -13293,7 +12833,6 @@ Fallback via in which case any other value but (exactly) .Ql Bugs results in an error. -. .It Cd PrivateKey Filename of the private key in PEM format of a TLS client certificate. If unset, the value of @@ -13303,7 +12842,6 @@ is used. are performed. Fallback via .Xr SSL_CTX_use_PrivateKey_file 3 . -. .It Cd Protocol The used TLS protocol. If @@ -13336,14 +12874,11 @@ prefix disables a protocol, so that .Ql -ALL, TLSv1.2 enables only the TLSv1.2 protocol. .El -. -. .Mx .Mx .It Va tls-crl-dir , tls-crl-file \*(OP Specify a directory / a file, respectively, that contains a CRL in PEM format to use when verifying TLS server certificates. -. .Mx .It Va tls-features \*(OP\*(RO This expands to a comma-separated list of the TLS library @@ -13381,7 +12916,6 @@ slot of and .Ql tls-rand-file .Pf ( Va tls-rand-file ) . -. .Mx Va tls-fingerprint .It Va tls-fingerprint-USER@HOST , tls-fingerprint-HOST , tls-fingerprint \*(OP It is possible to replace the verification of the connection @@ -13392,7 +12926,6 @@ the so-called fingerprint, to be specified as the used .Va tls-fingerprint-digest . This fingerprint can for example be calculated with .Ql Ic tls Ns \:\0\:fingerprint HOST . -. .Mx Va tls-fingerprint-digest .It Va tls-fingerprint-digest-USER@HOST , tls-fingerprint-digest-HOST , \ tls-fingerprint-digest @@ -13402,7 +12935,6 @@ fingerprints, the defaults, if available, in test order, being .Ql SHA256 . For the complete list of digest algorithms refer to .Va smime-sign-digest . -. .Mx .It Va tls-rand-file \*(OP If @@ -13424,7 +12956,6 @@ Shall seeding the PRNG have been successful, will be called to update the entropy. Remarks: libraries which do not announce this feature seed the PRNG by other means. -. .Mx Va tls-verify .It Va tls-verify-USER@HOST , tls-verify-HOST , tls-verify \*(OP Variable chain that sets the action to be performed if an error @@ -13461,13 +12992,11 @@ unsigned right shifting (see the .Va screen height. -. .Mx .It Va topsqueeze \*(BO If set then the .Ic top command series will strip adjacent empty lines and quotations. -. .Mx .It Va ttycharset The character set of the terminal \*(UA operates on, @@ -13486,7 +13015,6 @@ had been used to freeze the given value. Refer to the section .Sx "Character sets" for the complete picture about character sets. -. .Mx .It Va typescript-mode \*(BO A special multiplex variable that disables all variables and @@ -13498,7 +13026,6 @@ it sets and (before startup completed only) .Va termcap-disable . Unsetting it does not restore the former state of the covered settings. -. .Mx .It Va umask For a safe-by-default policy the process file mode creation mask @@ -13510,13 +13037,11 @@ and unless this variable is set. By assigning this an empty value the active setting will not be changed, otherwise the given value will be made the new file mode creation mask. Child processes inherit the file mode creation mask of their parent. -. .Mx Va user .It Va user-HOST , user \*(IN Variable chain that sets a global fallback user name, used in case none has been given in the protocol and account-specific URL. This variable defaults to the name of the user who runs \*(UA. -. .Mx .It Va v15-compat Enable upward compatibility with \*(UA version 15.0 in respect to which @@ -13530,7 +13055,6 @@ over for all commands which support both. This manual uses \*(IN and \*(OU to refer to the new and the old way of doing things, respectively. -. .Mx .It Va verbose Verbose mode enables logging of informational context messages. @@ -13543,7 +13067,6 @@ Assigning the value 0 disables verbosity and thus (almost) equals The maximum number is 3. Also see .Va debug . -. .Mx .Mx .Mx @@ -13563,7 +13086,6 @@ and update version numbers. The output of the command .Ic version will include this information. -. .Mx .It Va writebackedited If this variable is set messages modified using the @@ -13580,14 +13102,7 @@ performed, and proper quoting of newly added or edited content is also left as an exercise to the user. .El -.\" }}} (Variables) -. -.\" }}} (INTERNAL VARIABLES) -. -. -.\" .Sh ENVIRONMENT {{{ .Sh ENVIRONMENT -. The term .Dq environment variable should be considered an indication that these variables are either @@ -13605,7 +13120,6 @@ and .Ic unset , causing automatic program environment updates (to be inherited by newly created child processes). -. .Pp In order to integrate other environment variables equally they need to be imported (linked) with the command @@ -13617,13 +13131,11 @@ The following example, applicable to a POSIX shell, sets the environment variable for \*(UA only, and beforehand exports the .Ev EDITOR in order to affect any further processing in the running shell: -. .Bd -literal -offset indent $ EDITOR="vim -u ${HOME}/.vimrc" $ export EDITOR $ COLUMNS=80 \*(uA -R .Ed -. .Bl -tag -width ".It Ev BaNg" .Mx .It Ev COLUMNS @@ -13645,7 +13157,6 @@ be) determined once. (Normally the .Xr sh 1 manages these variables, and unsets them for pipe specifications etc.) -. .Mx .It Ev DEAD The name of the (mailbox) @@ -13663,7 +13174,6 @@ Except shell globs (also see .Ic folder ) will be performed. -. .Mx .It Ev EDITOR Pathname of the text editor to use for the @@ -13673,7 +13183,6 @@ command and .Pf (see\0 Sx "COMMAND ESCAPES" ) ; .Ev VISUAL is used for a more display oriented editor. -. .Mx .It Ev HOME The user's home directory. @@ -13687,7 +13196,6 @@ this directory is a default write target for, for example, .Ev DEAD , .Ev MBOX and more.) -. .Mx .Mx .Mx @@ -13703,7 +13211,6 @@ which includes updating .Va ttycharset (except during startup if the variable has been frozen via .Fl S ) . -. .Mx .It Ev LINES The user's preferred number of lines for the terminal screen. @@ -13711,7 +13218,6 @@ The behaviour is as described for .Ev COLUMNS , yet the compile-time constant used in non-interactive mode and as a fallback defaults to 24 (lines). -. .Mx .It Ev LISTER Pathname of the directory lister to use in the @@ -13721,13 +13227,11 @@ Default is .Xr ls 1 (path search through .Ev SHELL ) . -. .Mx .It Ev LOGNAME Upon startup \*(UA will actively ensure that this variable refers to the name of the user who runs \*(UA, in order to be able to pass a verified name to any newly created child process. -. .Mx .It Ev MAIL Is used as the user's @@ -13739,7 +13243,6 @@ is set. If the environmental fallback is also not set, a built-in compile-time default is used. This is assumed to be an absolute pathname. -. .Mx .It Ev MAILCAPS \*(OP Override the default path search of @@ -13749,7 +13252,6 @@ content to the list of MIME type handler directives. The RFC 1524 standard imposed default value is assigned otherwise: .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap . (The default value is a compile-time \*(OP.) -. .Mx .It Ev MAILRC Is used as a startup file instead of @@ -13761,7 +13263,6 @@ either set this variable to or the .Fl \&: command line option should be used. -. .Mx .It Ev MAILX_NO_SYSTEM_RC If this variable is set then reading of @@ -13774,7 +13275,6 @@ had been started up with the option (and according argument) or .Fl n . This variable is only used when it resides in the process environment. -. .Mx .It Ev MBOX The name of the user's @@ -13794,13 +13294,11 @@ Traditionally this MBOX is used as the file to save messages from the that have been read. Also see .Sx "Message states" . -. .Mx .It Ev NETRC \*(IN\*(OP This variable overrides the default location of the user's .Pa \*(VN file. -. .Mx .It Ev PAGER Pathname of the program to use for backing the command @@ -13826,18 +13324,15 @@ will optionally be set to .Ql -c . Also see .Va colour-pager . -. .Mx .It Ev PATH A colon-separated list of directories that is searched by the shell when looking for commands, for example .Ql /bin:/usr/bin:/usr/local/bin . -. .Mx .It Ev POSIXLY_CORRECT This environment entry is automatically squared with .Va posix . -. .Mx .It Ev SHELL The shell to use for the commands @@ -13848,12 +13343,10 @@ the .Sx "COMMAND ESCAPES" and when starting subprocesses. A default shell is used if this environment variable is not defined. -. .Mx .It Ev SOCKS5_PROXY This environment entry is automatically squared with .Va socks-proxy . -. .Mx .It Ev SOURCE_DATE_EPOCH Specifies a time in seconds since the Unix epoch (1970-01-01) to be @@ -13869,7 +13362,6 @@ This operation mode is used for development and by software packagers. a program abortion. .Pp .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA -. .Mx .It Ev TERM \*(OP The terminal type for which output is to be prepared. @@ -13877,7 +13369,6 @@ For extended colour and font control please refer to .Sx "Coloured display" , and for terminal management in general to .Sx "On terminal control and line editor" . -. .Mx .It Ev TMPDIR Except for the root user this variable defines the directory for @@ -13888,14 +13379,12 @@ well as read- and writable. This variable is only used when it resides in the process environment, but \*(UA will ensure at startup that this environment variable is updated to contain a usable temporary directory. -. .Mx .It Ev USER Identical to .Ev LOGNAME (see there), but this variable is not standardized, should therefore not be used, and is only corrected if already set. -. .Mx .It Ev VISUAL Pathname of the text editor to use for the @@ -13906,14 +13395,7 @@ command and .Ev EDITOR is used for a less display oriented editor. .El -. -.\" }}} -. -. -.\" .Sh FILES {{{ .Sh FILES -. -.\" file list {{{ .Bl -tag -width ".It Pa BaNg" .Mx .Mx @@ -13922,7 +13404,6 @@ is used for a less display oriented editor. .Sx "The Mailcap files" . (The shown names are part of the RFC 1524 standard search path .Ev MAILCAPS . ) -. .It Pa \*(ur , \*(UR User-specific and system-wide files giving initial commands, the .Sx "Resource files" . @@ -13931,18 +13412,15 @@ User-specific and system-wide files giving initial commands, the and .Va system-mailrc , respectively.) -. .Mx .It Pa \*(VM The default value for .Ev MBOX . -. .Mx .Mx .It Pa \*(vU , \*(vS Personal and system-wide MIME types, see .Sx "The mime.types files" . -. .Mx .It Pa \*(VN \*(IN\*(OP The default location of the user's @@ -13952,24 +13430,17 @@ file \(en the section documents the file format. The used path can be set via .Ev NETRC . -. .Mx .It Pa /dev/null The data sink .Xr null 4 . -. .Mx .It Pa ~/.rnd \*(OP Possible location for persistent random entropy seed storage, see .Va tls-rand-file . .El -.\" }}} -. -.\" .Ss "Resource files" {{{ .Ss "Resource files" -. Upon startup \*(UA reads in several resource files, in order: -. .Bl -tag -width ".It Pa BaNg" .Mx .It Pa \*(UR @@ -13983,7 +13454,6 @@ command line options, or by setting the .Sx ENVIRONMENT variable .Ev MAILX_NO_SYSTEM_RC . -. .Mx .It Pa \*(ur File giving initial commands. @@ -13994,17 +13464,14 @@ variable Reading of this file can be suppressed with the .Fl \&: command line option. -. .It Va mailx-extra-rc Defines a startup file to be read after all other resource files. It can be used to specify settings that are not understood by other .Xr mailx 1 implementations, for example. .El -. .Pp The content of these files is interpreted as follows: -. .Pp .Bl -bullet -compact .It @@ -14030,7 +13497,6 @@ then it is a comment-command and also ignored. (The comment-command is a real command, which does nothing, and therefore the usual follow lines mechanism applies!) .El -. .Pp Errors while loading these files are subject to the settings of .Va errexit @@ -14039,7 +13505,6 @@ and More files with syntactically equal content can be .Ic source Ns ed . The following, saved in a file, would be an examplary content: -. .Bd -literal -offset indent # This line is a comment command. And y\e es, it is really continued here. @@ -14047,11 +13512,7 @@ set debug \e verbose set editheaders .Ed -.\" }}} -. -.\" .Ss "The mime.types files" {{{ .Ss "The mime.types files" -. As stated in .Sx "HTML mail and MIME attachments" \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions) @@ -14065,12 +13526,10 @@ Another is the command which also offers access to \*(UAs MIME type cache. .Pa mime.types files have the following syntax: -. .Bd -literal -offset indent type/subtype extension [extension ...] # For example text/html html htm .Ed -. .Pp where .Ql type/subtype @@ -14085,19 +13544,15 @@ s, separated by whitespace, can be bound to the media type format. Comments may be introduced anywhere on a line with a number sign .Ql # , causing the remaining line to be discarded. -. \*(UA also supports an extended, non-portable syntax in especially crafted files, which can be loaded via the alternative value syntax of .Va mimetypes-load-control , and prepends an optional .Ql type-marker : -. .Pp .Dl [type-marker ]type/subtype extension [extension ...] -. .Pp The following type markers are supported: -. .Pp .Bl -tag -compact -width ".It Ar _n_u" .It Ar \&? @@ -14120,7 +13575,6 @@ This can be annoying, for example signatures serve a contextual purpose, their content is of no use by itself. This marker will avoid displaying the text message. .El -. .Pp Further reading: for sending messages: @@ -14135,11 +13589,7 @@ For reading etc. messages: .Va mimetypes-load-control , .Va pipe-TYPE/SUBTYPE , .Va pipe-EXTENSION . -.\" }}} -. -.\" .Ss "The Mailcap files" {{{ review .Ss "The Mailcap files" -. \*(OP RFC 1524 defines a .Dq User Agent Configuration Mechanism to be used to inform mail user agent programs about the locally @@ -14156,7 +13606,6 @@ operates on that cache, and the variable will suppress automatic loading, and usage of any mailcap handlers. .Sx "HTML mail and MIME attachments" gives a general overview of how MIME types are handled. -. .Pp .Dq Mailcap files consist of a set of newline separated entries. @@ -14171,7 +13620,6 @@ reverse solidus character last in all but the final line. The standard does not specify how leading whitespace of successive lines is to be treated, therefore they are retained. -. .Pp .Dq Mailcap entries consist of a number of semicolon @@ -14185,7 +13633,6 @@ The reverse solidus character can be used to escape any following character including semicolon and itself in the content of the second field, and in value parts of any optional key/value field. -. .Pp The first field defines the MIME .Ql TYPE/SUBTYPE @@ -14198,7 +13645,6 @@ would match any audio type. The second field is the .Cd view shell command used to display MIME parts of the given type. -. .Pp Data consuming shell commands will be fed message (MIME part) data on standard input unless one or more instances of the (unquoted) string @@ -14221,21 +13667,17 @@ flags had been set; unless the command requests the .Cd x-mailx-tmpfile-unlink flag is also implied; see below for more. -. .Pp Optional fields define single-word flags (case-insensitive), or key / value pairs consisting of a case-insensitive keyword, an equals sign .Ql = , and a shell command; whitespace surrounding the equals sign is removed. Optional fields include the following: -. -. .Bl -tag -width ".It Cd BaNg" .It Cd compose A program that can be used to compose a new body or body part in the given format. (Currently unused.) -. .It Cd composetyped Similar to the .Cd compose @@ -14243,7 +13685,6 @@ field, but is to be used when the composing program needs to specify the .Ql Content-type: header field to be applied to the composed data. (Currently unused.) -. .Mx .It Cd copiousoutput A flag field which indicates that the output of the @@ -14251,17 +13692,14 @@ A flag field which indicates that the output of the command is integrable into \*(UAs normal visual display. It is mutually exclusive with .Cd needsterminal . -. .It Cd description A textual description that describes this type of data. The text may optionally be enclosed within double quotation marks .Ql \&" . -. .It Cd edit A program that can be used to edit a body or body part in the given format. (Currently unused.) -. .It Cd nametemplate This field specifies a filename format for the .Ql %s @@ -14282,7 +13720,6 @@ viewer with a name ending in .Ql .jpg , .Ql nametemplate=%s.jpg can be used. -. .Mx .It Cd needsterminal This flag field indicates that the given shell command must be run on @@ -14291,12 +13728,10 @@ an interactive terminal. interactive mode, in non-interactive mode this entry will be entirely ignored; this flag implies .Cd x-mailx-noquote . -. .It Cd print A program that can be used to print a message or body part in the given format. (Currently unused.) -. .It Cd test Specifies a program to be run to test some condition, for example, the machine architecture, or the window system in use, to determine whether @@ -14308,7 +13743,6 @@ Standard I/O of the test program is redirected from and to and the format .Ql %s is not supported (the data does not yet exist). -. .It Cd textualnewlines A flag field which indicates that this type of data is line-oriented and that, if encoded in @@ -14316,12 +13750,10 @@ that, if encoded in all newlines should be converted to canonical form (CRLF) before encoding, and will be in that form after decoding. (Currently unused.) -. .It Cd x11-bitmap Names a file, in X11 bitmap (xbm) format, which points to an appropriate icon to be used to visually denote the presence of this kind of data. This field is not used by \*(UA. -. .Mx .It Cd x-mailx-async Extension flag field that denotes that the given @@ -14331,7 +13763,6 @@ Cannot be used in conjunction with .Cd needsterminal ; the standard output of the command will go to .Pa /dev/null . -. .Mx .It Cd x-mailx-noquote An extension flag field that indicates that even a @@ -14340,7 +13771,6 @@ An extension flag field that indicates that even a command shall not be used when .Va quote Ns ing messages, as it would by default. -. .Mx .It Cd x-mailx-test-once Extension flag which denotes whether the given @@ -14348,7 +13778,6 @@ Extension flag which denotes whether the given command shall be evaluated once only with its exit status being cached. This is handy if some global unchanging condition is to be queried, like .Dq running under the X Window System . -. .Mx .It Cd x-mailx-tmpfile Extension flag field that requests creation of a zero-sized temporary @@ -14357,7 +13786,6 @@ file, the name of which is to be placed in the environment variable It is an error to use this flag with commands that include a .Ql %s format (because that is implemented by means of this temporary file). -. .Mx .It Cd x-mailx-tmpfile-fill Normally the MIME part content is passed to the handler via standard @@ -14370,7 +13798,6 @@ explicitly! It is an error to use this flag with commands that include a .Ql %s format. -. .Mx .It Cd x-mailx-tmpfile-unlink Extension flag field that requests that the temporary file shall be @@ -14381,20 +13808,16 @@ format, or in conjunction with .Cd x-mailx-async . .Cd x-mailx-tmpfile is implied. -. .Mx .It Cd x-mailx-last-resort An extension flag that indicates that this handler shall only be used as a last resort, when no other source (see .Sx "HTML mail and MIME attachments" ) provides a MIME handler. -. .Mx .It Cd x-mailx-ignore An extension that enforces that this handler is not used at all. .El -. -. .Pp The standard includes the possibility to define any number of additional fields, prefixed by @@ -14412,12 +13835,10 @@ command needs to specify the flag, but the .Cd compose command shall not, the following will help out the latter: -. .Bd -literal -offset indent application/postscript; ps-to-terminal %s; needsterminal application/postscript; ps-to-terminal %s; compose=idraw %s .Ed -. .Pp In value parts of command fields any occurrence of the format string .Ql %t @@ -14434,7 +13855,6 @@ character. The entire parameter should appear as a single command line argument, regardless of embedded spaces, shell quoting will be performed by the RFC 1524 processor, thus: -. .Bd -literal -offset indent # Message Content-type: multipart/mixed; boundary=42 @@ -14446,7 +13866,6 @@ multipart/*; /usr/local/bin/showmulti \e # Executed shell command /usr/local/bin/showmulti multipart/mixed 42 .Ed -. .Pp Note that \*(UA does not support handlers for multipart MIME parts as shown in this example (as of today). @@ -14459,7 +13878,6 @@ An example file, also showing how to properly deal with the expansion of which includes any quotes that are necessary to make it a valid shell argument by itself and thus will cause undesired behaviour when placed in additional user-provided quotes: -. .Bd -literal -offset indent # Comment line text/richtext; richtext %s; copiousoutput @@ -14480,7 +13898,6 @@ application/*; echo "This is \e\e"%t\e\e" but \e is 50 \e% Greek to me" \e; < %s head -c 512 | cat -vet; \e copiousoutput; x-mailx-noquote; x-mailx-last-resort .Ed -. .Pp Further reading: .Sx "HTML mail and MIME attachments" , @@ -14490,11 +13907,7 @@ Further reading: .Va mime-counter-evidence , .Va pipe-TYPE/SUBTYPE , .Va pipe-EXTENSION . -.\" }}} -. -.\" .Ss "The .netrc file" {{{ review .Ss "The .netrc file" -. User credentials for machine accounts (see .Sx "On URL syntax and credential lookup" ) can be placed in the @@ -14512,14 +13925,12 @@ replaced with the output of the shell command set in to load an encrypted file, for example. The cache can be managed with the command .Ic netrc . -. .Pp The file consists of space, tabulator or newline separated tokens. This parser implements a superset of the original BSD syntax, but users should nonetheless be aware of portability glitches, shall their .Pa .netrc be usable across multiple programs and platforms: -. .Pp .Bl -bullet -compact .It @@ -14563,7 +13974,6 @@ than .Dq anonymous , this parser will always require these strict permissions. .El -. .Pp Of the following list of supported tokens this parser uses (and caches) .Cd machine , @@ -14573,7 +13983,6 @@ and An existing .Cd default entry will not be used. -. .Bl -tag -width ".It Cd BaNg" .It Cd machine Ar name The hostname of the entries' machine, lowercase-normalized before use. @@ -14608,24 +14017,19 @@ nor .Ql smtp.example.com will be matched by the wildcard, since the exact matches take precedence (it is however faster to specify it the other way around). -. .It Cd default This is the same as .Cd machine except that it is a fallback entry that is used shall none of the specified machines match; only one default token may be specified, and it must be the last first-class token. -. .It Cd login Ar name The user name on the remote machine. -. .It Cd password Ar string The user's password on the remote machine. -. .It Cd account Ar string Supply an additional account password. This is merely for FTP purposes. -. .It Cd macdef Ar name Define a macro. A macro is defined with the specified @@ -14643,17 +14047,8 @@ If a macro named exists, it is automatically run as the last step of the login process. This is merely for FTP purposes. .El -.\" }}} -. -.\" }}} -. -. -.\" .Sh EXAMPLES {{{ .Sh EXAMPLES -. -.\" .Ss "An example configuration" {{{ .Ss "An example configuration" -. .Bd -literal -offset indent # This example assumes v15.0 compatibility mode set v15-compat @@ -14840,7 +14235,6 @@ define V { } commandalias V '\e'call V .Ed -. .Pp When storing passwords in .Pa \*(ur @@ -14852,7 +14246,6 @@ is available user credentials can be stored in the central .Pa \*(VN file instead; e.g., here is a different version of the example account that sets up SMTP and POP3: -. .Bd -literal -offset indent define XandeX { set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent @@ -14870,26 +14263,18 @@ account XandeX { \ecall XandeX } .Ed -. .Pp and, in the .Pa \*(VN file: -. .Bd -literal -offset indent machine *.yXXXXx.ru login USER password PASS .Ed -. .Pp This configuration should now work just fine: -. .Pp .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple -.\" }}} -. -.\" .Ss "S/MIME step by step" {{{ .Ss "S/MIME step by step" -. \*(OP The first thing that is needed for .Sx "Signed and encrypted messages with S/MIME" is a personal certificate, and a private key. @@ -14903,7 +14288,6 @@ Whereas the certificate is included in each signed message, the private key must be kept secret. It is used to decrypt messages that were previously encrypted with the public key, and to sign messages. -. .Pp For personal use it is recommended to get a S/MIME certificate from one of the major CAs on the Internet. @@ -14912,14 +14296,12 @@ Usually offered is a combined certificate and private key in PKCS#12 format which \*(UA does not accept directly. To convert it to PEM format, the following shell command can be used; please read on for how to use these PEM files. -. .Bd -literal -offset indent $ openssl pkcs12 -in cert.p12 -out certpem.pem -clcerts -nodes $ # Alternatively $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts -nokeys $ openssl pkcs12 -in cert.p12 -out key.pem -nocerts -nodes .Ed -. .Pp There is also .Lk https://www.CAcert.org @@ -14935,7 +14317,6 @@ or as a vivid member of the .Va smime-ca-file . But let us take a step-by-step tour on how to setup S/MIME with a certificate from CAcert.org despite this situation! -. .Pp First of all you will have to become a member of the CAcert.org community, simply by registrating yourself via the web interface. @@ -14947,15 +14328,12 @@ Now ready to create S/MIME certificates, so let us create a new ensure to include all email addresses that should be covered by the certificate in the following web form, and also to use your name as the .Dq common name . -. .Pp Create a private key and a certificate request on your local computer (please see the manual pages of the used commands for more in-depth knowledge on what the used arguments etc. do): -. .Pp .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem -. .Pp Afterwards copy-and-paste the content of .Dq creq.pem @@ -14969,15 +14347,12 @@ will find its way into the certificate via the certificate-request). You are now ready and can create your CAcert certified certificate. Download and store or copy-and-paste it as .Dq pub.crt . -. .Pp Yay. In order to use your new S/MIME setup a combined private key/public key (certificate) file has to be created: -. .Pp .Dl $ cat key.pem pub.crt > ME@HERE.com.paired -. .Pp This is the file \*(UA will work with. If you have created your private key with a passphrase then \*(UA will @@ -14987,19 +14362,13 @@ operation has been automated as described in Set the following variables to henceforth use S/MIME (setting .Va smime-ca-file is of interest for verification only): -. .Bd -literal -offset indent ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e smime-sign-cert=ME@HERE.com.paired \e smime-sign-digest=SHA512 \e smime-sign from=myname@my.host .Ed -. -.\" }}} -. -.\" .Ss "Using CRLs with S/MIME or TLS" {{{ .Ss "Using CRLs with S/MIME or TLS" -. \*(OP Certification authorities (CAs) issue certificate revocation lists (CRLs) on a regular basis. These lists contain the serial numbers of certificates that have been @@ -15014,14 +14383,11 @@ There is otherwise no method to distinguish between valid and invalidated certificates. \*(UA currently offers no mechanism to fetch CRLs, nor to access them on the Internet, so they have to be retrieved by some external mechanism. -. .Pp \*(UA accepts CRLs in PEM format only; CRLs in DER format must be converted, like, e.\|g.: -. .Pp .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem -. .Pp To tell \*(UA about the CRLs, a directory that contains all CRL files (and no other files) must be created. @@ -15032,14 +14398,7 @@ or variables, respectively, must then be set to point to that directory. After that, \*(UA requires a CRL to be present for each CA that is used to verify a certificate. -.\" }}} -. -.\" }}} (Examples) -. -. -.\" .Sh "FAQ" {{{ .Sh "FAQ" -. In general it is a good idea to turn on .Va debug .Pf ( Fl d ) @@ -15049,10 +14408,7 @@ and / or twice) if something does not work well. Very often a diagnostic message can be produced that leads to the problems' solution. -. -.\" .Ss "\*(UA shortly hangs on startup" {{{ .Ss "\*(UA shortly hangs on startup" -. This can have two reasons, one is the necessity to wait for a file lock and cannot be helped, the other being that \*(UA calls the function .Xr uname 2 @@ -15071,17 +14427,12 @@ Does this local hostname have a domain suffix? RFC 6762 standardized the link-local top-level domain .Ql .local , try again after adding an (additional) entry with this extension. -.\" }}} -. -.\" .Ss "I cannot login to Google mail (via OAuth)" {{{ .Ss "I cannot login to Google mail \&(via OAuth\&)" -. Since 2014 some free service providers classify programs as .Dq less secure unless they use a special authentication method (OAuth 2.0) which was not standardized for non-HTTP protocol authentication token query until August 2015 (RFC 7628). -. .Pp Different to Kerberos / GSSAPI, which is developed since the mid of the 1980s, where a user can easily create a local authentication ticket for @@ -15091,7 +14442,6 @@ program, that protocol has no such local part but instead requires a world-wide-web query to create or fetch a token; since there is no local cache this query would have to be performed whenever \*(UA is invoked (in interactive sessions situation may differ). -. .Pp \*(UA does not directly support OAuth. It, however, supports XOAUTH2 / OAUTHBEARER, see @@ -15100,7 +14450,6 @@ If that is not used it is necessary to declare \*(UA a .Dq less secure app (on the providers account web page) in order to read and send mail. However, it also seems possible to take the following steps instead: -. .Pp .Bl -enum -compact .It @@ -15115,11 +14464,7 @@ use that special password instead of the real Google account password in \*(UA (for more on that see the section .Sx "On URL syntax and credential lookup" ) . .El -.\" }}} -. -.\" .Ss "But, how about XOAUTH2 / OAUTHBEARER?" {{{ .Ss "But, how about XOAUTH2 / OAUTHBEARER?" -. Following up .Sx "I cannot login to Google mail \&(via OAuth\&)" one OAuth-based authentication method is available: @@ -15133,7 +14478,6 @@ changes via a simple TLS secured server login would be possible in theory, but today a web browser and an external support tool are prerequisites for using this authentication method. The token times out and must be periodically refreshed via the web. -. .Pp Some hurdles must be taken before being able to use this method. Using GMail as an example, an application (that is a name) must be @@ -15148,7 +14492,6 @@ Thereafter a refresh token can be requested; a python program to do this for GMail accounts is .Lk https://github.com/google/\:gmail-oauth2-tools/\:raw/\:\ master/\:python/\:oauth2.py : -. .Bd -literal -offset indent $ python oauth2.py --user=EMAIL \e --client-id=THE-ID --client-secret=THE-SECRET \e @@ -15163,7 +14506,6 @@ $ # Of which the last three are actual token responses. $ # Thereafter access tokens can regularly be refreshed $ # via the created refresh token (read on) .Ed -. .Pp The generated refresh token must also be saved locally (securely). The procedure as a whole can be read at @@ -15176,7 +14518,6 @@ or (for sending only) .Va on-compose-enter (for more on authentication please see the section .Sx "On URL syntax and credential lookup" ) : -. .Bd -literal -offset indent set on-main-loop-tick=o-m-l-t on-compose-enter=o-c-e define o-m-l-t { @@ -15205,11 +14546,7 @@ define update_access_token { endif } .Ed -.\" }}} -. -.\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{ review .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" -. Two thinkable situations: the first is a shadowed sequence; setting .Va debug , or the most possible @@ -15218,7 +14555,6 @@ mode, causes a printout of the .Ic bind tree after that is built; being a cache, this happens only upon startup or after modifying bindings. -. .Pp Or second, terminal libraries (see .Sx "On terminal control and line editor", @@ -15233,7 +14569,6 @@ ings will show the byte sequences that are expected. (One common source of problems is that the \(em possibly even non-existing \(em keypad is not turned on, and the resulting layout reports the keypad control codes for the normal keyboard keys.) -. .Pp To overcome the situation use for example the program .Xr cat 1 @@ -15245,7 +14580,6 @@ by keypresses, and use the variable to make \*(UA aware of them. The terminal this is typed on produces some unexpected sequences, here for an example the shifted home key: -. .Bd -literal -offset indent ? set verbose ? bind* @@ -15259,15 +14593,10 @@ $ \*(uA -v -Stermcap='kHOM=\eE[H' # 1B 5B=[ 48=H bind base :kHOM z0 .Ed -.\" }}} -. -.\" .Ss "Can \*(UA git-send-email?" {{{ .Ss "Can \*(UA git-send-email?" -. Yes. Put (at least parts of) the following in your .Pa ~/.gitconfig : -. .Bd -literal -offset indent [sendemail] smtpserver = /usr/bin/\*(uA @@ -15286,23 +14615,17 @@ thread = true quiet = true annotate = true .Ed -. .Pp Newer .Xr git 1 versions (v2.33.0) added the option .Cm sendmailCmd . Patches can also be send directly, for example: -. .Bd -literal -offset indent $ git format-patch -M --stdout HEAD^ | \*(uA -A the-account-you-need -t RECEIVER .Ed -.\" }}} -. -.\" .Ss "Howto handle stale dotlock files" {{{ .Ss "Howto handle stale dotlock files" -. .Ic folder sometimes fails to open MBOX mail databases because creation of .Mx -sx @@ -15314,23 +14637,14 @@ The site policy is usually defined by administrator(s), and expressed in the configuration of a locally installed MTA (for example Postfix .Ql stale_lock_time=500s ) . Therefore the suggestion: -. .Bd -literal -offset indent $ |}:"}, - {ok_v_SHELL, {0,}, VAL_SHELL}, - {ok_v_TMPDIR, {0,}, VAL_TMPDIR}, - {ok_v_toplines, {0,}, "5"}, - {ok_v_ttycharset, {0,}, CHARSET_8BIT}, - {ok_v_VISUAL, {0,}, VAL_VISUAL}, -}; -#define a_AMV_VAR_DEFVALS_CNT 28 - -#define a_AMV_VAR__SPECIAL_PARAM_MAP_IDX 0u -#define a_AMV_VAR__QM_MAP_IDX 1u -#define a_AMV_VAR__EM_MAP_IDX 2u - -# undef a_X -#endif /* !a__CREATE_OKEY_MAP_PL */ -#define a_AMV_VAR_REV_ILL 341u -#define a_AMV_VAR_REV_PRIME 619u -#define a_AMV_VAR_REV_LONGEST 6u -#define a_AMV_VAR_REV_WRAPAROUND 0 -static u16 const a_amv_var_revmap[a_AMV_VAR_REV_PRIME] = { - 229u, 176u, 341u, 341u, 184u, 341u, 259u, 294u, 318u, 341u, - 2u, 23u, 267u, 341u, 341u, 155u, 341u, 119u, 122u, 341u, - 25u, 341u, 341u, 341u, 341u, 48u, 249u, 315u, 341u, 341u, - 341u, 29u, 228u, 165u, 341u, 121u, 196u, 158u, 250u, 129u, - 266u, 341u, 192u, 220u, 72u, 302u, 341u, 341u, 341u, 341u, - 231u, 341u, 341u, 57u, 65u, 327u, 341u, 341u, 341u, 341u, - 162u, 131u, 54u, 341u, 241u, 341u, 341u, 341u, 341u, 341u, - 341u, 341u, 86u, 6u, 341u, 341u, 341u, 341u, 40u, 80u, - 150u, 113u, 248u, 312u, 341u, 341u, 341u, 341u, 341u, 341u, - 170u, 341u, 341u, 341u, 341u, 341u, 171u, 341u, 43u, 180u, - 341u, 73u, 309u, 341u, 341u, 341u, 12u, 106u, 341u, 341u, - 341u, 272u, 341u, 341u, 341u, 341u, 341u, 341u, 341u, 341u, - 74u, 157u, 341u, 251u, 341u, 93u, 341u, 341u, 341u, 246u, - 289u, 303u, 341u, 104u, 32u, 217u, 316u, 341u, 66u, 55u, - 341u, 20u, 160u, 199u, 322u, 341u, 341u, 99u, 341u, 317u, - 222u, 341u, 69u, 341u, 341u, 341u, 4u, 166u, 255u, 341u, - 341u, 335u, 243u, 169u, 341u, 112u, 341u, 341u, 341u, 341u, - 341u, 213u, 276u, 281u, 341u, 71u, 194u, 279u, 197u, 290u, - 125u, 323u, 341u, 91u, 341u, 341u, 204u, 341u, 153u, 297u, - 84u, 22u, 328u, 341u, 341u, 236u, 154u, 296u, 16u, 313u, - 341u, 341u, 341u, 174u, 341u, 24u, 175u, 264u, 326u, 172u, - 83u, 225u, 341u, 341u, 123u, 182u, 202u, 341u, 95u, 341u, - 341u, 341u, 341u, 134u, 179u, 319u, 144u, 306u, 341u, 341u, - 341u, 341u, 341u, 187u, 224u, 341u, 237u, 7u, 341u, 46u, - 151u, 161u, 118u, 211u, 275u, 307u, 81u, 341u, 78u, 341u, - 11u, 198u, 186u, 90u, 140u, 36u, 109u, 149u, 214u, 338u, - 39u, 341u, 341u, 15u, 341u, 341u, 341u, 341u, 138u, 102u, - 208u, 164u, 341u, 341u, 341u, 227u, 223u, 341u, 254u, 5u, - 77u, 256u, 148u, 341u, 341u, 85u, 341u, 240u, 239u, 341u, - 341u, 341u, 269u, 341u, 341u, 341u, 82u, 341u, 341u, 128u, - 341u, 341u, 341u, 341u, 45u, 76u, 341u, 341u, 146u, 263u, - 341u, 206u, 288u, 9u, 301u, 341u, 341u, 341u, 341u, 341u, - 59u, 132u, 314u, 341u, 341u, 92u, 226u, 200u, 341u, 341u, - 341u, 341u, 341u, 341u, 203u, 116u, 147u, 89u, 265u, 178u, - 110u, 75u, 337u, 341u, 341u, 341u, 341u, 310u, 19u, 341u, - 70u, 87u, 168u, 3u, 341u, 308u, 195u, 341u, 341u, 341u, - 341u, 341u, 42u, 115u, 37u, 139u, 26u, 300u, 284u, 341u, - 341u, 159u, 205u, 183u, 30u, 332u, 341u, 127u, 152u, 341u, - 324u, 17u, 298u, 341u, 341u, 341u, 341u, 341u, 336u, 341u, - 53u, 143u, 8u, 124u, 133u, 341u, 341u, 136u, 341u, 341u, - 341u, 60u, 341u, 188u, 193u, 341u, 244u, 56u, 207u, 242u, - 114u, 210u, 218u, 339u, 341u, 341u, 341u, 341u, 341u, 181u, - 341u, 321u, 0u, 341u, 341u, 341u, 191u, 341u, 282u, 341u, - 62u, 341u, 142u, 257u, 292u, 341u, 341u, 341u, 341u, 341u, - 341u, 107u, 293u, 341u, 341u, 341u, 88u, 341u, 341u, 221u, - 235u, 31u, 331u, 341u, 341u, 341u, 100u, 34u, 341u, 341u, - 341u, 333u, 108u, 341u, 47u, 185u, 341u, 341u, 341u, 103u, - 212u, 341u, 341u, 341u, 341u, 341u, 341u, 341u, 341u, 341u, - 341u, 126u, 341u, 341u, 10u, 21u, 49u, 341u, 173u, 61u, - 117u, 135u, 201u, 260u, 277u, 305u, 320u, 33u, 120u, 130u, - 141u, 268u, 341u, 51u, 156u, 44u, 52u, 58u, 311u, 341u, - 341u, 232u, 341u, 238u, 247u, 341u, 341u, 278u, 245u, 18u, - 94u, 163u, 291u, 340u, 341u, 68u, 101u, 330u, 38u, 341u, - 341u, 341u, 341u, 341u, 341u, 341u, 341u, 341u, 177u, 252u, - 341u, 341u, 341u, 341u, 216u, 262u, 285u, 341u, 98u, 280u, - 341u, 341u, 219u, 329u, 274u, 209u, 234u, 341u, 167u, 341u, - 283u, 14u, 79u, 50u, 105u, 35u, 304u, 341u, 341u, 253u, - 28u, 64u, 341u, 341u, 215u, 230u, 111u, 270u, 271u, 137u, - 261u, 190u, 341u, 341u, 341u, 341u, 341u, 341u, 341u, 341u, - 341u, 341u, 67u, 341u, 325u, 341u, 341u, 341u, 273u, 286u, - 1u, 96u, 258u, 295u, 341u, 233u, 13u, 341u, 27u, 341u, - 299u, 334u, 63u, 97u, 341u, 145u, 189u, 287u, 41u -}; +/*@ gen-okeys.h, generated by make-okey-map.pl. + *@ See accmacvar.c for more */ + +static char const a_amv_var_names[] = { +'-','-','s','p','e','c','i','a','l','-','p','a','r','a','m','\0', +'?','\0', +'!','\0', +'a','c','c','o','u','n','t','\0', +'a','d','d','-','f','i','l','e','-','r','e','c','i','p','i','e','n','t','s','\0', +'a','g','e','n','t','-','s','h','e','l','l','-','l','o','o','k','u','p','\0', +'a','l','l','n','e','t','\0', +'a','p','p','e','n','d','\0', +'a','s','k','\0', +'a','s','k','a','t','e','n','d','\0', +'a','s','k','a','t','t','a','c','h','\0', +'a','s','k','b','c','c','\0', +'a','s','k','c','c','\0', +'a','s','k','s','i','g','n','\0', +'a','s','k','s','e','n','d','\0', +'a','s','k','s','u','b','\0', +'a','t','t','r','l','i','s','t','\0', +'a','u','t','o','b','c','c','\0', +'a','u','t','o','c','c','\0', +'a','u','t','o','c','o','l','l','a','p','s','e','\0', +'a','u','t','o','p','r','i','n','t','\0', +'a','u','t','o','t','h','r','e','a','d','\0', +'a','u','t','o','s','o','r','t','\0', +'b','a','n','g','\0', +'b','a','t','c','h','-','e','x','i','t','-','o','n','-','e','r','r','o','r','\0', +'b','i','n','d','-','t','i','m','e','o','u','t','\0', +'b','i','n','d','-','i','n','t','e','r','-','b','y','t','e','-','t','i','m','e','o','u','t','\0', +'b','i','n','d','-','i','n','t','e','r','-','k','e','y','-','t','i','m','e','o','u','t','\0', +'b','s','d','a','n','n','o','u','n','c','e','\0', +'b','s','d','c','o','m','p','a','t','\0', +'b','s','d','f','l','a','g','s','\0', +'b','s','d','h','e','a','d','l','i','n','e','\0', +'b','s','d','m','s','g','s','\0', +'b','s','d','o','r','d','e','r','\0', +'b','u','i','l','d','-','c','c','\0', +'b','u','i','l','d','-','l','d','\0', +'b','u','i','l','d','-','o','s','\0', +'b','u','i','l','d','-','r','e','s','t','\0', +'C','O','L','U','M','N','S','\0', +'c','h','a','r','s','e','t','-','7','b','i','t','\0', +'c','h','a','r','s','e','t','-','8','b','i','t','\0', +'c','h','a','r','s','e','t','-','u','n','k','n','o','w','n','-','8','b','i','t','\0', +'c','m','d','\0', +'c','o','l','o','u','r','-','d','i','s','a','b','l','e','\0', +'c','o','l','o','u','r','-','p','a','g','e','r','\0', +'c','o','n','t','a','c','t','-','m','a','i','l','\0', +'c','o','n','t','a','c','t','-','w','e','b','\0', +'c','o','n','t','e','n','t','-','d','e','s','c','r','i','p','t','i','o','n','-','f','o','r','w','a','r','d','e','d','-','m','e','s','s','a','g','e','\0', +'c','o','n','t','e','n','t','-','d','e','s','c','r','i','p','t','i','o','n','-','q','u','o','t','e','-','a','t','t','a','c','h','m','e','n','t','\0', +'c','o','n','t','e','n','t','-','d','e','s','c','r','i','p','t','i','o','n','-','s','m','i','m','e','-','m','e','s','s','a','g','e','\0', +'c','o','n','t','e','n','t','-','d','e','s','c','r','i','p','t','i','o','n','-','s','m','i','m','e','-','s','i','g','n','a','t','u','r','e','\0', +'c','r','t','\0', +'c','u','s','t','o','m','h','d','r','\0', +'D','E','A','D','\0', +'d','a','t','e','f','i','e','l','d','\0', +'d','a','t','e','f','i','e','l','d','-','m','a','r','k','o','u','t','-','o','l','d','e','r','\0', +'d','e','b','u','g','\0', +'d','i','s','p','o','s','i','t','i','o','n','-','n','o','t','i','f','i','c','a','t','i','o','n','-','s','e','n','d','\0', +'d','o','t','\0', +'d','o','t','l','o','c','k','-','d','i','s','a','b','l','e','\0', +'d','o','t','l','o','c','k','-','i','g','n','o','r','e','-','e','r','r','o','r','\0', +'E','D','I','T','O','R','\0', +'e','d','i','t','a','l','o','n','g','\0', +'e','d','i','t','h','e','a','d','e','r','s','\0', +'e','m','p','t','y','s','t','a','r','t','\0', +'e','n','c','o','d','i','n','g','\0', +'e','r','r','e','x','i','t','\0', +'e','r','r','o','r','s','-','l','i','m','i','t','\0', +'e','s','c','a','p','e','\0', +'e','x','p','a','n','d','a','d','d','r','\0', +'e','x','p','a','n','d','a','d','d','r','-','d','o','m','a','i','n','c','h','e','c','k','\0', +'e','x','p','a','n','d','a','r','g','v','\0', +'f','e','a','t','u','r','e','s','\0', +'f','l','i','p','r','\0', +'f','o','l','d','e','r','\0', +'f','o','l','d','e','r','-','r','e','s','o','l','v','e','d','\0', +'f','o','l','d','e','r','-','h','o','o','k','\0', +'f','o','l','l','o','w','u','p','-','t','o','\0', +'f','o','l','l','o','w','u','p','-','t','o','-','a','d','d','-','c','c','\0', +'f','o','l','l','o','w','u','p','-','t','o','-','h','o','n','o','u','r','\0', +'f','o','r','w','a','r','d','-','a','d','d','-','c','c','\0', +'f','o','r','w','a','r','d','-','a','s','-','a','t','t','a','c','h','m','e','n','t','\0', +'f','o','r','w','a','r','d','-','i','n','j','e','c','t','-','h','e','a','d','\0', +'f','o','r','w','a','r','d','-','i','n','j','e','c','t','-','t','a','i','l','\0', +'f','r','o','m','\0', +'f','u','l','l','n','a','m','e','s','\0', +'f','w','d','h','e','a','d','i','n','g','\0', +'H','O','M','E','\0', +'h','e','a','d','e','r','\0', +'h','e','a','d','l','i','n','e','\0', +'h','e','a','d','l','i','n','e','-','b','i','d','i','\0', +'h','e','a','d','l','i','n','e','-','p','l','a','i','n','\0', +'h','i','s','t','o','r','y','-','f','i','l','e','\0', +'h','i','s','t','o','r','y','-','g','a','b','b','y','\0', +'h','i','s','t','o','r','y','-','g','a','b','b','y','-','p','e','r','s','i','s','t','\0', +'h','i','s','t','o','r','y','-','s','i','z','e','\0', +'h','o','l','d','\0', +'h','o','s','t','n','a','m','e','\0', +'i','d','n','a','-','d','i','s','a','b','l','e','\0', +'i','f','s','\0', +'i','f','s','-','w','s','\0', +'i','g','n','o','r','e','\0', +'i','g','n','o','r','e','e','o','f','\0', +'i','n','b','o','x','\0', +'i','n','d','e','n','t','p','r','e','f','i','x','\0', +'k','e','e','p','\0', +'k','e','e','p','-','c','o','n','t','e','n','t','-','l','e','n','g','t','h','\0', +'k','e','e','p','s','a','v','e','\0', +'L','A','N','G','\0', +'L','C','_','A','L','L','\0', +'L','C','_','C','T','Y','P','E','\0', +'L','I','N','E','S','\0', +'L','I','S','T','E','R','\0', +'L','O','G','N','A','M','E','\0', +'l','i','n','e','-','e','d','i','t','o','r','-','c','p','l','-','w','o','r','d','-','b','r','e','a','k','s','\0', +'l','i','n','e','-','e','d','i','t','o','r','-','d','i','s','a','b','l','e','\0', +'l','i','n','e','-','e','d','i','t','o','r','-','n','o','-','d','e','f','a','u','l','t','s','\0', +'l','o','g','-','p','r','e','f','i','x','\0', +'M','A','I','L','\0', +'M','A','I','L','C','A','P','S','\0', +'M','A','I','L','R','C','\0', +'M','A','I','L','X','_','N','O','_','S','Y','S','T','E','M','_','R','C','\0', +'M','B','O','X','\0', +'m','a','i','l','b','o','x','-','r','e','s','o','l','v','e','d','\0', +'m','a','i','l','b','o','x','-','d','i','s','p','l','a','y','\0', +'m','a','i','l','c','a','p','-','d','i','s','a','b','l','e','\0', +'m','a','i','l','x','-','e','x','t','r','a','-','r','c','\0', +'m','a','i','l','x','-','c','o','m','m','a','n','d','\0', +'m','a','i','l','x','-','s','u','b','j','e','c','t','\0', +'m','a','i','l','x','-','f','r','o','m','\0', +'m','a','i','l','x','-','s','e','n','d','e','r','\0', +'m','a','i','l','x','-','t','o','\0', +'m','a','i','l','x','-','c','c','\0', +'m','a','i','l','x','-','b','c','c','\0', +'m','a','i','l','x','-','r','a','w','-','t','o','\0', +'m','a','i','l','x','-','r','a','w','-','c','c','\0', +'m','a','i','l','x','-','r','a','w','-','b','c','c','\0', +'m','a','i','l','x','-','o','r','i','g','-','f','r','o','m','\0', +'m','a','i','l','x','-','o','r','i','g','-','t','o','\0', +'m','a','i','l','x','-','o','r','i','g','-','c','c','\0', +'m','a','i','l','x','-','o','r','i','g','-','b','c','c','\0', +'m','a','r','k','a','n','s','w','e','r','e','d','\0', +'m','b','o','x','-','f','c','c','-','a','n','d','-','p','c','c','\0', +'m','b','o','x','-','r','f','c','4','1','5','5','\0', +'m','e','m','d','e','b','u','g','\0', +'m','e','s','s','a','g','e','-','i','d','-','d','i','s','a','b','l','e','\0', +'m','e','s','s','a','g','e','-','i','n','j','e','c','t','-','h','e','a','d','\0', +'m','e','s','s','a','g','e','-','i','n','j','e','c','t','-','t','a','i','l','\0', +'m','e','t','o','o','\0', +'m','i','m','e','-','a','l','l','o','w','-','t','e','x','t','-','c','o','n','t','r','o','l','s','\0', +'m','i','m','e','-','a','l','t','e','r','n','a','t','i','v','e','-','f','a','v','o','u','r','-','r','i','c','h','\0', +'m','i','m','e','-','c','o','u','n','t','e','r','-','e','v','i','d','e','n','c','e','\0', +'m','i','m','e','-','e','n','c','o','d','i','n','g','\0', +'m','i','m','e','-','f','o','r','c','e','-','s','e','n','d','o','u','t','\0', +'m','i','m','e','t','y','p','e','s','-','l','o','a','d','-','c','o','n','t','r','o','l','\0', +'m','t','a','\0', +'m','t','a','-','a','l','i','a','s','e','s','\0', +'m','t','a','-','a','r','g','u','m','e','n','t','s','\0', +'m','t','a','-','n','o','-','d','e','f','a','u','l','t','-','a','r','g','u','m','e','n','t','s','\0', +'m','t','a','-','n','o','-','r','e','c','e','i','v','e','r','-','a','r','g','u','m','e','n','t','s','\0', +'m','t','a','-','a','r','g','v','0','\0', +'m','t','a','-','b','c','c','-','o','k','\0', +'N','A','I','L','_','E','X','T','R','A','_','R','C','\0', +'N','A','I','L','_','N','O','_','S','Y','S','T','E','M','_','R','C','\0', +'N','A','I','L','_','H','E','A','D','\0', +'N','A','I','L','_','H','I','S','T','F','I','L','E','\0', +'N','A','I','L','_','H','I','S','T','S','I','Z','E','\0', +'N','A','I','L','_','T','A','I','L','\0', +'N','E','T','R','C','\0', +'n','e','t','r','c','-','l','o','o','k','u','p','\0', +'n','e','t','r','c','-','p','i','p','e','\0', +'n','e','w','f','o','l','d','e','r','s','\0', +'n','e','w','m','a','i','l','\0', +'o','n','-','a','c','c','o','u','n','t','-','c','l','e','a','n','u','p','\0', +'o','n','-','c','o','m','p','o','s','e','-','c','l','e','a','n','u','p','\0', +'o','n','-','c','o','m','p','o','s','e','-','e','n','t','e','r','\0', +'o','n','-','c','o','m','p','o','s','e','-','l','e','a','v','e','\0', +'o','n','-','c','o','m','p','o','s','e','-','s','p','l','i','c','e','\0', +'o','n','-','c','o','m','p','o','s','e','-','s','p','l','i','c','e','-','s','h','e','l','l','\0', +'o','n','-','h','i','s','t','o','r','y','-','a','d','d','i','t','i','o','n','\0', +'o','n','-','m','a','i','n','-','l','o','o','p','-','t','i','c','k','\0', +'o','n','-','p','r','o','g','r','a','m','-','e','x','i','t','\0', +'o','n','-','r','e','s','e','n','d','-','c','l','e','a','n','u','p','\0', +'o','n','-','r','e','s','e','n','d','-','e','n','t','e','r','\0', +'o','u','t','f','o','l','d','e','r','\0', +'P','A','G','E','R','\0', +'P','A','T','H','\0', +'P','O','S','I','X','L','Y','_','C','O','R','R','E','C','T','\0', +'p','a','g','e','\0', +'p','a','s','s','w','o','r','d','\0', +'p','i','p','e','r','a','w','\0', +'p','o','p','3','-','a','u','t','h','\0', +'p','o','p','3','-','b','u','l','k','-','l','o','a','d','\0', +'p','o','p','3','-','k','e','e','p','a','l','i','v','e','\0', +'p','o','p','3','-','n','o','-','a','p','o','p','\0', +'p','o','p','3','-','u','s','e','-','s','t','a','r','t','t','l','s','\0', +'p','o','s','i','x','\0', +'p','r','i','n','t','-','a','l','t','e','r','n','a','t','i','v','e','s','\0', +'p','r','o','m','p','t','\0', +'p','r','o','m','p','t','2','\0', +'q','u','i','e','t','\0', +'q','u','o','t','e','\0', +'q','u','o','t','e','-','a','d','d','-','c','c','\0', +'q','u','o','t','e','-','a','s','-','a','t','t','a','c','h','m','e','n','t','\0', +'q','u','o','t','e','-','c','h','a','r','s','\0', +'q','u','o','t','e','-','f','o','l','d','\0', +'q','u','o','t','e','-','i','n','j','e','c','t','-','h','e','a','d','\0', +'q','u','o','t','e','-','i','n','j','e','c','t','-','t','a','i','l','\0', +'r','-','o','p','t','i','o','n','-','i','m','p','l','i','c','i','t','\0', +'r','e','c','i','p','i','e','n','t','s','-','i','n','-','c','c','\0', +'r','e','c','o','r','d','\0', +'r','e','c','o','r','d','-','f','i','l','e','s','\0', +'r','e','c','o','r','d','-','r','e','s','e','n','t','\0', +'r','e','p','l','y','-','i','n','-','s','a','m','e','-','c','h','a','r','s','e','t','\0', +'r','e','p','l','y','-','s','t','r','i','n','g','s','\0', +'r','e','p','l','y','t','o','\0', +'r','e','p','l','y','-','t','o','\0', +'r','e','p','l','y','-','t','o','-','h','o','n','o','u','r','\0', +'r','e','p','l','y','-','t','o','-','s','w','a','p','-','i','n','\0', +'r','f','c','8','2','2','-','b','o','d','y','-','f','r','o','m','_','\0', +'S','H','E','L','L','\0', +'S','Y','S','V','3','\0', +'s','a','v','e','\0', +'s','c','r','e','e','n','\0', +'s','e','a','r','c','h','h','e','a','d','e','r','s','\0', +'s','e','n','d','c','h','a','r','s','e','t','s','\0', +'s','e','n','d','c','h','a','r','s','e','t','s','-','e','l','s','e','-','t','t','y','c','h','a','r','s','e','t','\0', +'s','e','n','d','e','r','\0', +'s','e','n','d','m','a','i','l','\0', +'s','e','n','d','m','a','i','l','-','a','r','g','u','m','e','n','t','s','\0', +'s','e','n','d','m','a','i','l','-','n','o','-','d','e','f','a','u','l','t','-','a','r','g','u','m','e','n','t','s','\0', +'s','e','n','d','m','a','i','l','-','p','r','o','g','n','a','m','e','\0', +'s','e','n','d','w','a','i','t','\0', +'s','h','o','w','l','a','s','t','\0', +'s','h','o','w','n','a','m','e','\0', +'s','h','o','w','t','o','\0', +'S','i','g','n','\0', +'s','i','g','n','\0', +'s','i','g','n','a','t','u','r','e','\0', +'s','k','i','p','e','m','p','t','y','b','o','d','y','\0', +'s','m','i','m','e','-','c','a','-','d','i','r','\0', +'s','m','i','m','e','-','c','a','-','f','i','l','e','\0', +'s','m','i','m','e','-','c','a','-','f','l','a','g','s','\0', +'s','m','i','m','e','-','c','a','-','n','o','-','d','e','f','a','u','l','t','s','\0', +'s','m','i','m','e','-','c','i','p','h','e','r','\0', +'s','m','i','m','e','-','c','r','l','-','d','i','r','\0', +'s','m','i','m','e','-','c','r','l','-','f','i','l','e','\0', +'s','m','i','m','e','-','e','n','c','r','y','p','t','\0', +'s','m','i','m','e','-','f','o','r','c','e','-','e','n','c','r','y','p','t','i','o','n','\0', +'s','m','i','m','e','-','n','o','-','d','e','f','a','u','l','t','-','c','a','\0', +'s','m','i','m','e','-','s','i','g','n','\0', +'s','m','i','m','e','-','s','i','g','n','-','c','e','r','t','\0', +'s','m','i','m','e','-','s','i','g','n','-','d','i','g','e','s','t','\0', +'s','m','i','m','e','-','s','i','g','n','-','i','n','c','l','u','d','e','-','c','e','r','t','s','\0', +'s','m','i','m','e','-','s','i','g','n','-','m','e','s','s','a','g','e','-','d','i','g','e','s','t','\0', +'s','m','t','p','\0', +'s','m','t','p','-','a','u','t','h','\0', +'s','m','t','p','-','a','u','t','h','-','p','a','s','s','w','o','r','d','\0', +'s','m','t','p','-','a','u','t','h','-','u','s','e','r','\0', +'s','m','t','p','-','h','o','s','t','n','a','m','e','\0', +'s','m','t','p','-','u','s','e','-','s','t','a','r','t','t','l','s','\0', +'S','O','C','K','S','5','_','P','R','O','X','Y','\0', +'S','O','U','R','C','E','_','D','A','T','E','_','E','P','O','C','H','\0', +'s','o','c','k','e','t','-','c','o','n','n','e','c','t','-','t','i','m','e','o','u','t','\0', +'s','o','c','k','s','-','p','r','o','x','y','\0', +'s','p','a','m','-','i','n','t','e','r','f','a','c','e','\0', +'s','p','a','m','-','m','a','x','s','i','z','e','\0', +'s','p','a','m','c','-','c','o','m','m','a','n','d','\0', +'s','p','a','m','c','-','a','r','g','u','m','e','n','t','s','\0', +'s','p','a','m','c','-','u','s','e','r','\0', +'s','p','a','m','f','i','l','t','e','r','-','h','a','m','\0', +'s','p','a','m','f','i','l','t','e','r','-','n','o','h','a','m','\0', +'s','p','a','m','f','i','l','t','e','r','-','n','o','s','p','a','m','\0', +'s','p','a','m','f','i','l','t','e','r','-','r','a','t','e','\0', +'s','p','a','m','f','i','l','t','e','r','-','r','a','t','e','-','s','c','a','n','s','c','o','r','e','\0', +'s','p','a','m','f','i','l','t','e','r','-','s','p','a','m','\0', +'s','s','l','-','c','a','-','d','i','r','\0', +'s','s','l','-','c','a','-','f','i','l','e','\0', +'s','s','l','-','c','a','-','f','l','a','g','s','\0', +'s','s','l','-','c','a','-','n','o','-','d','e','f','a','u','l','t','s','\0', +'s','s','l','-','c','e','r','t','\0', +'s','s','l','-','c','i','p','h','e','r','-','l','i','s','t','\0', +'s','s','l','-','c','o','n','f','i','g','-','f','i','l','e','\0', +'s','s','l','-','c','o','n','f','i','g','-','m','o','d','u','l','e','\0', +'s','s','l','-','c','o','n','f','i','g','-','p','a','i','r','s','\0', +'s','s','l','-','c','u','r','v','e','s','\0', +'s','s','l','-','c','r','l','-','d','i','r','\0', +'s','s','l','-','c','r','l','-','f','i','l','e','\0', +'s','s','l','-','f','e','a','t','u','r','e','s','\0', +'s','s','l','-','k','e','y','\0', +'s','s','l','-','m','e','t','h','o','d','\0', +'s','s','l','-','n','o','-','d','e','f','a','u','l','t','-','c','a','\0', +'s','s','l','-','p','r','o','t','o','c','o','l','\0', +'s','s','l','-','r','a','n','d','-','e','g','d','\0', +'s','s','l','-','r','a','n','d','-','f','i','l','e','\0', +'s','s','l','-','v','e','r','i','f','y','\0', +'s','t','e','a','l','t','h','m','u','a','\0', +'s','y','s','t','e','m','-','m','a','i','l','r','c','\0', +'T','E','R','M','\0', +'T','M','P','D','I','R','\0', +'t','e','r','m','c','a','p','\0', +'t','e','r','m','c','a','p','-','c','a','-','m','o','d','e','\0', +'t','e','r','m','c','a','p','-','d','i','s','a','b','l','e','\0', +'t','l','s','-','c','a','-','d','i','r','\0', +'t','l','s','-','c','a','-','f','i','l','e','\0', +'t','l','s','-','c','a','-','f','l','a','g','s','\0', +'t','l','s','-','c','a','-','n','o','-','d','e','f','a','u','l','t','s','\0', +'t','l','s','-','c','o','n','f','i','g','-','f','i','l','e','\0', +'t','l','s','-','c','o','n','f','i','g','-','m','o','d','u','l','e','\0', +'t','l','s','-','c','o','n','f','i','g','-','p','a','i','r','s','\0', +'t','l','s','-','c','r','l','-','d','i','r','\0', +'t','l','s','-','c','r','l','-','f','i','l','e','\0', +'t','l','s','-','f','e','a','t','u','r','e','s','\0', +'t','l','s','-','f','i','n','g','e','r','p','r','i','n','t','\0', +'t','l','s','-','f','i','n','g','e','r','p','r','i','n','t','-','d','i','g','e','s','t','\0', +'t','l','s','-','r','a','n','d','-','f','i','l','e','\0', +'t','l','s','-','v','e','r','i','f','y','\0', +'t','o','p','l','i','n','e','s','\0', +'t','o','p','s','q','u','e','e','z','e','\0', +'t','t','y','c','h','a','r','s','e','t','\0', +'t','y','p','e','s','c','r','i','p','t','-','m','o','d','e','\0', +'U','S','E','R','\0', +'u','m','a','s','k','\0', +'u','s','e','r','\0', +'V','I','S','U','A','L','\0', +'v','1','5','-','c','o','m','p','a','t','\0', +'v','e','r','b','o','s','e','\0', +'v','e','r','s','i','o','n','\0', +'v','e','r','s','i','o','n','-','d','a','t','e','\0', +'v','e','r','s','i','o','n','-','h','e','x','n','u','m','\0', +'v','e','r','s','i','o','n','-','m','a','j','o','r','\0', +'v','e','r','s','i','o','n','-','m','i','n','o','r','\0', +'v','e','r','s','i','o','n','-','u','p','d','a','t','e','\0', +'w','r','i','t','e','b','a','c','k','e','d','i','t','e','d','\0', +'d','i','s','c','o','n','n','e','c','t','e','d','\0', +'i','m','a','p','-','a','u','t','h','\0', +'i','m','a','p','-','c','a','c','h','e','\0', +'i','m','a','p','-','d','e','l','i','m','\0', +'i','m','a','p','-','k','e','e','p','a','l','i','v','e','\0', +'i','m','a','p','-','l','i','s','t','-','d','e','p','t','h','\0', +'i','m','a','p','-','u','s','e','-','s','t','a','r','t','t','l','s','\0', +}; +#define a_AMV_VAR_NAME_KEY_MAXOFF 4508u +#define a_AMV_VAR_HAS_OBSOLETE + +CTA(a_AMV_VF_NONE == 0, "Value not 0 as expected"); +static struct a_amv_var_map const a_amv_var_map[] = { +{227278652u, 0u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_NOLOPTS}, +{154495572u, 16u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_NOLOPTS}, +{80927451u, 18u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_NOLOPTS}, +{3357062669u, 20u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_NOLOPTS}, +{493847641u, 28u, 0|a_AMV_VF_BOOL}, +{3300482900u, 48u, 0|a_AMV_VF_OBSOLETE}, +{494283953u, 67u, 0|a_AMV_VF_BOOL}, +{1058320012u, 74u, 0|a_AMV_VF_BOOL}, +{2551535105u, 81u, 0|a_AMV_VF_BOOL|a_AMV_VF_VIP}, +{3811864832u, 85u, 0|a_AMV_VF_BOOL}, +{996153470u, 94u, 0|a_AMV_VF_BOOL}, +{1888769187u, 104u, 0|a_AMV_VF_BOOL}, +{116464337u, 111u, 0|a_AMV_VF_BOOL}, +{2284472721u, 117u, 0|a_AMV_VF_BOOL}, +{3082104315u, 125u, 0|a_AMV_VF_BOOL}, +{311620u, 133u, 0|a_AMV_VF_BOOL|a_AMV_VF_I3VAL}, +{745929243u, 140u, 0}, +{4253309083u, 149u, 0}, +{1364365036u, 157u, 0}, +{3614598233u, 164u, 0|a_AMV_VF_BOOL}, +{1227119359u, 177u, 0|a_AMV_VF_BOOL}, +{2751932733u, 187u, 0|a_AMV_VF_BOOL|a_AMV_VF_OBSOLETE}, +{795112500u, 198u, 0}, +{2505240952u, 207u, 0|a_AMV_VF_BOOL}, +{1320334633u, 212u, 0|a_AMV_VF_BOOL|a_AMV_VF_OBSOLETE}, +{2561950027u, 232u, 0|a_AMV_VF_VIP|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM|a_AMV_VF_OBSOLETE}, +{3708435556u, 245u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{3166102662u, 269u, 0|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{2594579305u, 292u, 0|a_AMV_VF_BOOL|a_AMV_VF_OBSOLETE}, +{3899593563u, 304u, 0|a_AMV_VF_BOOL}, +{4175238939u, 314u, 0|a_AMV_VF_BOOL}, +{544406618u, 323u, 0|a_AMV_VF_BOOL}, +{3124538195u, 335u, 0|a_AMV_VF_BOOL}, +{4225922782u, 343u, 0|a_AMV_VF_BOOL}, +{4282337783u, 352u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{580749460u, 361u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{855442780u, 370u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{826549826u, 379u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{2160670167u, 390u, 0|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{1152129485u, 398u, 0|a_AMV_VF_VIP|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY}, +{3559906218u, 411u, 0|a_AMV_VF_VIP|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY}, +{2813999997u, 424u, 0|a_AMV_VF_VIP}, +{3267913060u, 445u, 0}, +{287190100u, 449u, 0|a_AMV_VF_BOOL}, +{846327017u, 464u, 0|a_AMV_VF_BOOL}, +{1122098125u, 477u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{1124592011u, 490u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{2597875993u, 502u, 0|a_AMV_VF_DEFVAL}, +{1060377975u, 540u, 0|a_AMV_VF_DEFVAL}, +{3459029433u, 577u, 0|a_AMV_VF_DEFVAL}, +{2186292469u, 611u, 0|a_AMV_VF_DEFVAL}, +{2999592795u, 647u, 0|a_AMV_VF_POSNUM}, +{2781333397u, 651u, 0|a_AMV_VF_VIP}, +{2415640462u, 661u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{1827964010u, 666u, 0|a_AMV_VF_I3VAL}, +{393145609u, 676u, 0|a_AMV_VF_I3VAL}, +{3577320874u, 700u, 0|a_AMV_VF_BOOL|a_AMV_VF_VIP}, +{2967068228u, 706u, 0|a_AMV_VF_BOOL}, +{1214666681u, 736u, 0|a_AMV_VF_BOOL}, +{160284180u, 740u, 0|a_AMV_VF_BOOL}, +{1694953629u, 756u, 0|a_AMV_VF_BOOL|a_AMV_VF_OBSOLETE}, +{1242446766u, 777u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{1594887356u, 784u, 0}, +{3883110174u, 794u, 0|a_AMV_VF_BOOL}, +{2988505335u, 806u, 0|a_AMV_VF_BOOL}, +{3787987885u, 817u, 0|a_AMV_VF_OBSOLETE}, +{558368469u, 826u, 0|a_AMV_VF_BOOL}, +{2009839120u, 834u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{226969255u, 847u, 0|a_AMV_VF_DEFVAL}, +{290884965u, 854u, 0}, +{1137944571u, 865u, 0|a_AMV_VF_NOTEMPTY}, +{246331225u, 888u, 0}, +{2405915007u, 899u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{396387274u, 908u, 0|a_AMV_VF_BOOL}, +{1247301214u, 914u, 0|a_AMV_VF_VIP}, +{380489737u, 921u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{3313520922u, 937u, 0}, +{724424027u, 949u, 0|a_AMV_VF_BOOL}, +{207519379u, 961u, 0|a_AMV_VF_BOOL}, +{4130486046u, 980u, 0}, +{1845222365u, 999u, 0|a_AMV_VF_BOOL}, +{1502086073u, 1014u, 0|a_AMV_VF_BOOL}, +{3821632635u, 1036u, 0}, +{2452299938u, 1056u, 0}, +{602154724u, 1076u, 0|a_AMV_VF_VIP}, +{3763021371u, 1081u, 0|a_AMV_VF_BOOL}, +{1982641597u, 1091u, 0|a_AMV_VF_OBSOLETE}, +{2741985269u, 1102u, 0|a_AMV_VF_VIP|a_AMV_VF_NODEL|a_AMV_VF_IMPORT|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{64545433u, 1107u, 0|a_AMV_VF_BOOL|a_AMV_VF_I3VAL}, +{3501927842u, 1114u, 0}, +{1804975779u, 1123u, 0}, +{1481160096u, 1137u, 0|a_AMV_VF_BOOL}, +{912008308u, 1152u, 0}, +{3026632813u, 1165u, 0}, +{2385770127u, 1179u, 0|a_AMV_VF_BOOL}, +{525831433u, 1201u, 0|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{2672153034u, 1214u, 0|a_AMV_VF_BOOL}, +{2616319247u, 1219u, 0|a_AMV_VF_VIP}, +{978281147u, 1228u, 0|a_AMV_VF_BOOL}, +{1104992522u, 1241u, 0|a_AMV_VF_VIP|a_AMV_VF_DEFVAL}, +{3356804030u, 1245u, 0|a_AMV_VF_VIP|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_I3VAL}, +{728948543u, 1252u, 0|a_AMV_VF_BOOL}, +{2906377970u, 1259u, 0|a_AMV_VF_BOOL}, +{2604688712u, 1269u, 0}, +{1338595061u, 1275u, 0|a_AMV_VF_DEFVAL}, +{143835737u, 1288u, 0|a_AMV_VF_BOOL}, +{4104264131u, 1293u, 0|a_AMV_VF_BOOL}, +{174649434u, 1313u, 0|a_AMV_VF_BOOL}, +{2145171579u, 1322u, 0|a_AMV_VF_VIP|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{1678977712u, 1327u, 0|a_AMV_VF_VIP|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{1182282912u, 1334u, 0|a_AMV_VF_VIP|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{2376678931u, 1343u, 0|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{1848015380u, 1349u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{3871590672u, 1356u, 0|a_AMV_VF_RDONLY|a_AMV_VF_IMPORT|a_AMV_VF_ENV}, +{3059025987u, 1364u, 0|a_AMV_VF_DEFVAL}, +{3293963057u, 1392u, 0|a_AMV_VF_BOOL}, +{3853763107u, 1412u, 0|a_AMV_VF_BOOL}, +{1789070192u, 1436u, 0|a_AMV_VF_NODEL|a_AMV_VF_I3VAL}, +{1789157842u, 1447u, 0|a_AMV_VF_ENV}, +{2736404651u, 1452u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_IMPORT|a_AMV_VF_ENV}, +{3252715507u, 1461u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_IMPORT|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{3506381864u, 1468u, 0|a_AMV_VF_BOOL|a_AMV_VF_IMPORT|a_AMV_VF_ENV}, +{81016594u, 1487u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{431868467u, 1492u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_NOLOPTS}, +{3586483916u, 1509u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_NOLOPTS}, +{3619987079u, 1525u, 0|a_AMV_VF_BOOL}, +{1809788732u, 1541u, 0|a_AMV_VF_NOTEMPTY}, +{2060730609u, 1556u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{878559998u, 1570u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{3291580202u, 1584u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{1152455935u, 1595u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{3628560729u, 1608u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{3280403201u, 1617u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{4089466605u, 1626u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{733346855u, 1636u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{3980034930u, 1649u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{2033036569u, 1662u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{1852847708u, 1676u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{3612286188u, 1692u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{1108270344u, 1706u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{114853847u, 1720u, 0|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{3344360316u, 1735u, 0|a_AMV_VF_BOOL}, +{97960896u, 1748u, 0|a_AMV_VF_BOOL|a_AMV_VF_I3VAL}, +{1206644946u, 1765u, 0|a_AMV_VF_BOOL}, +{411705792u, 1778u, 0|a_AMV_VF_BOOL|a_AMV_VF_VIP}, +{2924780567u, 1787u, 0|a_AMV_VF_BOOL}, +{3508650772u, 1806u, 0}, +{2318901230u, 1826u, 0}, +{3755204636u, 1846u, 0|a_AMV_VF_BOOL}, +{1123775568u, 1852u, 0|a_AMV_VF_BOOL}, +{1016573875u, 1877u, 0|a_AMV_VF_BOOL}, +{1894749336u, 1906u, 0|a_AMV_VF_POSNUM}, +{7077405u, 1928u, 0}, +{212277572u, 1942u, 0|a_AMV_VF_BOOL}, +{3037097698u, 1961u, 0}, +{553443582u, 1984u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY}, +{832650830u, 1988u, 0|a_AMV_VF_NOTEMPTY}, +{2950745266u, 2000u, 0}, +{3777230887u, 2014u, 0|a_AMV_VF_BOOL}, +{1537483713u, 2039u, 0|a_AMV_VF_BOOL}, +{2122434769u, 2065u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY}, +{3661122784u, 2075u, 0|a_AMV_VF_BOOL}, +{3872053044u, 2086u, 0|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY|a_AMV_VF_OBSOLETE}, +{297169422u, 2100u, 0|a_AMV_VF_BOOL|a_AMV_VF_IMPORT|a_AMV_VF_ENV|a_AMV_VF_OBSOLETE}, +{1607860199u, 2118u, 0|a_AMV_VF_OBSOLETE}, +{2276529140u, 2128u, 0|a_AMV_VF_OBSOLETE}, +{3334752474u, 2142u, 0|a_AMV_VF_NOTEMPTY|a_AMV_VF_NUM|a_AMV_VF_OBSOLETE}, +{1983079716u, 2156u, 0|a_AMV_VF_OBSOLETE}, +{2020589051u, 2166u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{1260217930u, 2172u, 0|a_AMV_VF_BOOL|a_AMV_VF_CHAIN}, +{3886637952u, 2185u, 0}, +{3651172215u, 2196u, 0}, +{3304640034u, 2207u, 0}, +{117356079u, 2215u, 0|a_AMV_VF_NOTEMPTY}, +{4290007558u, 2234u, 0|a_AMV_VF_NOTEMPTY}, +{293825268u, 2253u, 0|a_AMV_VF_NOTEMPTY}, +{2131049871u, 2270u, 0|a_AMV_VF_NOTEMPTY}, +{3562380821u, 2287u, 0|a_AMV_VF_NOTEMPTY}, +{3452672776u, 2305u, 0|a_AMV_VF_NOTEMPTY}, +{1488358487u, 2329u, 0|a_AMV_VF_NOTEMPTY}, +{3412211600u, 2349u, 0|a_AMV_VF_NOTEMPTY}, +{395906010u, 2367u, 0|a_AMV_VF_NOTEMPTY}, +{1767855548u, 2383u, 0|a_AMV_VF_NOTEMPTY}, +{2401366305u, 2401u, 0|a_AMV_VF_NOTEMPTY}, +{416513343u, 2417u, 0|a_AMV_VF_BOOL}, +{1489818949u, 2427u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{2822297945u, 2433u, 0|a_AMV_VF_NODEL|a_AMV_VF_IMPORT|a_AMV_VF_ENV}, +{2133454918u, 2438u, 0|a_AMV_VF_BOOL|a_AMV_VF_VIP|a_AMV_VF_IMPORT|a_AMV_VF_ENV}, +{110139073u, 2454u, 0|a_AMV_VF_BOOL}, +{236033362u, 2459u, 0|a_AMV_VF_CHAIN}, +{1184554264u, 2468u, 0|a_AMV_VF_BOOL}, +{959912200u, 2476u, 0|a_AMV_VF_CHAIN}, +{2157156237u, 2486u, 0|a_AMV_VF_BOOL}, +{3679046711u, 2501u, 0|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{1128676729u, 2516u, 0|a_AMV_VF_BOOL|a_AMV_VF_CHAIN}, +{403462699u, 2529u, 0|a_AMV_VF_BOOL|a_AMV_VF_CHAIN}, +{2340434703u, 2547u, 0|a_AMV_VF_BOOL|a_AMV_VF_VIP}, +{909397219u, 2553u, 0|a_AMV_VF_BOOL}, +{3753422504u, 2572u, 0|a_AMV_VF_I3VAL}, +{1957394514u, 2579u, 0|a_AMV_VF_I3VAL}, +{149149615u, 2587u, 0|a_AMV_VF_BOOL}, +{3721493487u, 2593u, 0}, +{366442025u, 2599u, 0|a_AMV_VF_BOOL}, +{1890299439u, 2612u, 0|a_AMV_VF_BOOL}, +{4044677414u, 2632u, 0|a_AMV_VF_VIP|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY}, +{3595968213u, 2644u, 0}, +{2640088545u, 2655u, 0}, +{2904204181u, 2673u, 0}, +{1640115048u, 2691u, 0|a_AMV_VF_BOOL}, +{188553526u, 2709u, 0|a_AMV_VF_BOOL}, +{540723528u, 2726u, 0}, +{146539205u, 2733u, 0|a_AMV_VF_BOOL}, +{2425465309u, 2746u, 0|a_AMV_VF_BOOL}, +{1513358607u, 2760u, 0|a_AMV_VF_BOOL}, +{1900410726u, 2782u, 0}, +{2583631056u, 2796u, 0|a_AMV_VF_NOTEMPTY|a_AMV_VF_OBSOLETE}, +{1151099134u, 2804u, 0|a_AMV_VF_NOTEMPTY}, +{2823711003u, 2813u, 0}, +{1277335386u, 2829u, 0}, +{3620202244u, 2846u, 0|a_AMV_VF_BOOL}, +{1938020952u, 2864u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_IMPORT|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{4069714370u, 2870u, 0|a_AMV_VF_BOOL|a_AMV_VF_ENV|a_AMV_VF_OBSOLETE}, +{3498694618u, 2876u, 0|a_AMV_VF_BOOL|a_AMV_VF_I3VAL}, +{3962019339u, 2881u, 0|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{1130371609u, 2888u, 0|a_AMV_VF_BOOL}, +{968926480u, 2902u, 0|a_AMV_VF_VIP}, +{760633097u, 2915u, 0|a_AMV_VF_BOOL}, +{504631978u, 2944u, 0|a_AMV_VF_VIP}, +{856236114u, 2951u, 0|a_AMV_VF_OBSOLETE}, +{3085354123u, 2960u, 0|a_AMV_VF_OBSOLETE}, +{1325127300u, 2979u, 0|a_AMV_VF_BOOL|a_AMV_VF_OBSOLETE}, +{3864687553u, 3009u, 0|a_AMV_VF_OBSOLETE}, +{1977567474u, 3027u, 0|a_AMV_VF_I3VAL}, +{3980879360u, 3036u, 0|a_AMV_VF_BOOL}, +{4203664219u, 3045u, 0|a_AMV_VF_BOOL}, +{3064935001u, 3054u, 0|a_AMV_VF_BOOL}, +{833163053u, 3061u, 0}, +{1713520988u, 3066u, 0}, +{2783766075u, 3071u, 0|a_AMV_VF_OBSOLETE}, +{534091439u, 3081u, 0|a_AMV_VF_BOOL|a_AMV_VF_VIP}, +{135477722u, 3095u, 0}, +{946781610u, 3108u, 0}, +{1507345877u, 3122u, 0}, +{2951976498u, 3137u, 0|a_AMV_VF_BOOL}, +{1752439545u, 3158u, 0|a_AMV_VF_CHAIN}, +{102302029u, 3171u, 0}, +{86428004u, 3185u, 0}, +{237746033u, 3200u, 0|a_AMV_VF_CHAIN}, +{2767628932u, 3214u, 0|a_AMV_VF_BOOL}, +{1005584095u, 3237u, 0|a_AMV_VF_BOOL|a_AMV_VF_OBSOLETE}, +{2610149716u, 3257u, 0|a_AMV_VF_BOOL}, +{4112782207u, 3268u, 0|a_AMV_VF_CHAIN}, +{1704393517u, 3284u, 0|a_AMV_VF_CHAIN}, +{2740251050u, 3302u, 0|a_AMV_VF_CHAIN}, +{3761658326u, 3327u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{1782732536u, 3353u, 0|a_AMV_VF_OBSOLETE}, +{1658958037u, 3358u, 0|a_AMV_VF_CHAIN}, +{3638650800u, 3368u, 0|a_AMV_VF_OBSOLETE}, +{2020555875u, 3387u, 0|a_AMV_VF_OBSOLETE}, +{1820965540u, 3402u, 0|a_AMV_VF_VIP}, +{1837607842u, 3416u, 0|a_AMV_VF_BOOL|a_AMV_VF_CHAIN}, +{907387109u, 3434u, 0|a_AMV_VF_VIP|a_AMV_VF_IMPORT|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{900761917u, 3447u, 0|a_AMV_VF_RDONLY|a_AMV_VF_IMPORT|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{3456900515u, 3465u, 0|a_AMV_VF_POSNUM}, +{3775764645u, 3488u, 0|a_AMV_VF_VIP|a_AMV_VF_NOTEMPTY|a_AMV_VF_CHAIN}, +{1607330400u, 3500u, 0}, +{1763068644u, 3515u, 0|a_AMV_VF_NOTEMPTY|a_AMV_VF_POSNUM}, +{1908563950u, 3528u, 0}, +{1452123120u, 3542u, 0}, +{4013666858u, 3558u, 0}, +{1923764058u, 3569u, 0}, +{3955925583u, 3584u, 0}, +{3561917382u, 3601u, 0}, +{261790554u, 3619u, 0}, +{914178751u, 3635u, 0}, +{2230056064u, 3661u, 0}, +{1769124455u, 3677u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{1778108319u, 3688u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{3110362859u, 3700u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{623065149u, 3713u, 0|a_AMV_VF_BOOL|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{139775082u, 3732u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{2317777583u, 3741u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{3936220190u, 3757u, 0|a_AMV_VF_OBSOLETE}, +{315983966u, 3773u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{1105329479u, 3791u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{800287693u, 3808u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{542424727u, 3819u, 0|a_AMV_VF_OBSOLETE}, +{1605928646u, 3831u, 0|a_AMV_VF_OBSOLETE}, +{2392084957u, 3844u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_OBSOLETE}, +{4242392148u, 3857u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{842733395u, 3865u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{120659094u, 3876u, 0|a_AMV_VF_BOOL|a_AMV_VF_OBSOLETE}, +{3391235883u, 3894u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{2493237115u, 3907u, 0|a_AMV_VF_OBSOLETE}, +{1150749481u, 3920u, 0|a_AMV_VF_OBSOLETE}, +{3001703062u, 3934u, 0|a_AMV_VF_CHAIN|a_AMV_VF_OBSOLETE}, +{3060393762u, 3945u, 0}, +{3170554710u, 3956u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{1689227859u, 3970u, 0|a_AMV_VF_ENV}, +{275160966u, 3975u, 0|a_AMV_VF_VIP|a_AMV_VF_DEFVAL|a_AMV_VF_IMPORT|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{2006033901u, 3982u, 0}, +{1881431006u, 3990u, 0|a_AMV_VF_BOOL}, +{3874156389u, 4006u, 0|a_AMV_VF_BOOL}, +{49001407u, 4022u, 0|a_AMV_VF_CHAIN}, +{2310520195u, 4033u, 0|a_AMV_VF_CHAIN}, +{1223767828u, 4045u, 0|a_AMV_VF_CHAIN}, +{3113270631u, 4058u, 0|a_AMV_VF_BOOL|a_AMV_VF_CHAIN}, +{172056861u, 4077u, 0}, +{3002246919u, 4093u, 0|a_AMV_VF_CHAIN}, +{789322284u, 4111u, 0|a_AMV_VF_CHAIN}, +{3248783469u, 4128u, 0}, +{1888319427u, 4140u, 0}, +{4259586683u, 4153u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{1139189225u, 4166u, 0|a_AMV_VF_CHAIN}, +{2530971234u, 4182u, 0|a_AMV_VF_CHAIN}, +{2971415438u, 4205u, 0}, +{3259662180u, 4219u, 0|a_AMV_VF_CHAIN}, +{3045770460u, 4230u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY|a_AMV_VF_NUM}, +{2347832344u, 4239u, 0|a_AMV_VF_BOOL}, +{3335676089u, 4250u, 0|a_AMV_VF_VIP|a_AMV_VF_DEFVAL|a_AMV_VF_NOTEMPTY}, +{807899482u, 4261u, 0|a_AMV_VF_BOOL|a_AMV_VF_VIP}, +{330400956u, 4277u, 0|a_AMV_VF_RDONLY|a_AMV_VF_IMPORT|a_AMV_VF_ENV}, +{1567917856u, 4282u, 0|a_AMV_VF_VIP|a_AMV_VF_NODEL|a_AMV_VF_I3VAL|a_AMV_VF_POSNUM}, +{875435785u, 4288u, 0|a_AMV_VF_NOTEMPTY|a_AMV_VF_CHAIN}, +{1942497279u, 4293u, 0|a_AMV_VF_DEFVAL|a_AMV_VF_ENV|a_AMV_VF_NOTEMPTY}, +{691216848u, 4300u, 0}, +{3973338304u, 4311u, 0|a_AMV_VF_VIP|a_AMV_VF_POSNUM}, +{944087093u, 4319u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{1337487108u, 4327u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL}, +{3081657388u, 4340u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_POSNUM}, +{1921844491u, 4355u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_POSNUM}, +{1707804737u, 4369u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_POSNUM}, +{3760910668u, 4383u, 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_POSNUM}, +{432301395u, 4398u, 0|a_AMV_VF_BOOL}, +{1643918527u, 4414u, 0|a_AMV_VF_BOOL|a_AMV_VF_CHAIN}, +{259555527u, 4427u, 0|a_AMV_VF_CHAIN}, +{3710399665u, 4437u, 0}, +{3006849165u, 4448u, 0|a_AMV_VF_CHAIN}, +{1681336106u, 4459u, 0|a_AMV_VF_CHAIN}, +{3435503022u, 4474u, 0}, +{2746817971u, 4490u, 0|a_AMV_VF_BOOL|a_AMV_VF_CHAIN}, +}; + +#ifndef a__CREATE_OKEY_MAP_PL +# undef a_X +# ifdef mx_HAVE_PUTENV +# define a_X(X) X +# else +# define a_X(X) +# endif + +CTAV(4 == FIELD_SIZEOF(struct a_amv_var_chain_map_bsrch, avcmb_prefix)); +static struct a_amv_var_chain_map const a_amv_var_chain_map[] = { +{4414u, ok_b_disconnected}, +{4427u, ok_v_imap_auth}, +{4448u, ok_v_imap_delim}, +{4459u, ok_v_imap_keepalive}, +{4490u, ok_b_imap_use_starttls}, +{2172u, ok_b_netrc_lookup}, +{2459u, ok_v_password}, +{2476u, ok_v_pop3_auth}, +{2516u, ok_b_pop3_no_apop}, +{2529u, ok_b_pop3_use_starttls}, +{3158u, ok_v_smime_cipher}, +{3200u, ok_v_smime_encrypt}, +{3268u, ok_v_smime_sign_cert}, +{3284u, ok_v_smime_sign_digest}, +{3302u, ok_v_smime_sign_include_certs}, +{3327u, ok_v_smime_sign_message_digest}, +{3358u, ok_v_smtp_auth}, +{3416u, ok_b_smtp_use_starttls}, +{3488u, ok_v_socks_proxy}, +{3677u, ok_v_ssl_ca_dir}, +{3688u, ok_v_ssl_ca_file}, +{3700u, ok_v_ssl_ca_flags}, +{3713u, ok_b_ssl_ca_no_defaults}, +{3732u, ok_v_ssl_cert}, +{3741u, ok_v_ssl_cipher_list}, +{3773u, ok_v_ssl_config_module}, +{3791u, ok_v_ssl_config_pairs}, +{3808u, ok_v_ssl_curves}, +{3857u, ok_v_ssl_key}, +{3865u, ok_v_ssl_method}, +{3894u, ok_v_ssl_protocol}, +{3934u, ok_v_ssl_verify}, +{4022u, ok_v_tls_ca_dir}, +{4033u, ok_v_tls_ca_file}, +{4045u, ok_v_tls_ca_flags}, +{4058u, ok_b_tls_ca_no_defaults}, +{4093u, ok_v_tls_config_module}, +{4111u, ok_v_tls_config_pairs}, +{4166u, ok_v_tls_fingerprint}, +{4182u, ok_v_tls_fingerprint_digest}, +{4219u, ok_v_tls_verify}, +{4288u, ok_v_user}, +}; +#define a_AMV_VAR_CHAIN_MAP_CNT 42 + +static struct a_amv_var_chain_map_bsrch const a_amv_var_chain_map_bsrch[] = { +{"disc", 0u, ok_b_disconnected}, +{"imap", 1u, ok_b_imap_use_starttls}, +{"netr", 5u, ok_b_netrc_lookup}, +{"pass", 6u, ok_v_password}, +{"pop3", 7u, ok_b_pop3_use_starttls}, +{"smim", 10u, ok_v_smime_sign_message_digest}, +{"smtp", 16u, ok_b_smtp_use_starttls}, +{"sock", 18u, ok_v_socks_proxy}, +{"ssl-", 19u, ok_v_ssl_verify}, +{"tls-", 32u, ok_v_tls_verify}, +{"user", 41u, ok_v_user}, +}; +#define a_AMV_VAR_CHAIN_MAP_BSRCH_CNT 11 + +/* Unfortunately init of varsized buffer impossible: define "subclass"es */ +static char const a_amv_var_virt_build_cc_val[] = {VAL_BUILD_CC_ARRAY}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[8 +1]; +} const a_amv_var_virt_build_cc = {NIL, a_amv_var_virt_build_cc_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "build-cc"}; + +static char const a_amv_var_virt_build_ld_val[] = {VAL_BUILD_LD_ARRAY}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[8 +1]; +} const a_amv_var_virt_build_ld = {NIL, a_amv_var_virt_build_ld_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "build-ld"}; + +static char const a_amv_var_virt_build_os_val[] = {VAL_BUILD_OS}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[8 +1]; +} const a_amv_var_virt_build_os = {NIL, a_amv_var_virt_build_os_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "build-os"}; + +static char const a_amv_var_virt_build_rest_val[] = {VAL_BUILD_REST_ARRAY}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[10 +1]; +} const a_amv_var_virt_build_rest = {NIL, a_amv_var_virt_build_rest_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "build-rest"}; + +static char const a_amv_var_virt_contact_mail_val[] = {VAL_CONTACT_MAIL}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[12 +1]; +} const a_amv_var_virt_contact_mail = {NIL, a_amv_var_virt_contact_mail_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "contact-mail"}; + +static char const a_amv_var_virt_contact_web_val[] = {VAL_CONTACT_WEB}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[11 +1]; +} const a_amv_var_virt_contact_web = {NIL, a_amv_var_virt_contact_web_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "contact-web"}; + +static char const a_amv_var_virt_features_val[] = {VAL_FEATURES}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[8 +1]; +} const a_amv_var_virt_features = {NIL, a_amv_var_virt_features_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "features"}; + +static char const a_amv_var_virt_ssl_features_val[] = {VAL_TLS_FEATURES}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[12 +1]; +} const a_amv_var_virt_ssl_features = {NIL, a_amv_var_virt_ssl_features_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_OBSOLETE, "ssl-features"}; + +static char const a_amv_var_virt_system_mailrc_val[] = {VAL_SYSCONFDIR "/" VAL_SYSCONFRC}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[13 +1]; +} const a_amv_var_virt_system_mailrc = {NIL, a_amv_var_virt_system_mailrc_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "system-mailrc"}; + +static char const a_amv_var_virt_tls_features_val[] = {VAL_TLS_FEATURES}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[12 +1]; +} const a_amv_var_virt_tls_features = {NIL, a_amv_var_virt_tls_features_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "tls-features"}; + +static char const a_amv_var_virt_version_val[] = {mx_VERSION}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[7 +1]; +} const a_amv_var_virt_version = {NIL, a_amv_var_virt_version_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "version"}; + +static char const a_amv_var_virt_version_date_val[] = {mx_VERSION_DATE}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[12 +1]; +} const a_amv_var_virt_version_date = {NIL, a_amv_var_virt_version_date_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL, "version-date"}; + +static char const a_amv_var_virt_version_hexnum_val[] = {mx_VERSION_HEXNUM}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[14 +1]; +} const a_amv_var_virt_version_hexnum = {NIL, a_amv_var_virt_version_hexnum_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_POSNUM, "version-hexnum"}; + +static char const a_amv_var_virt_version_major_val[] = {mx_VERSION_MAJOR}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[13 +1]; +} const a_amv_var_virt_version_major = {NIL, a_amv_var_virt_version_major_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_POSNUM, "version-major"}; + +static char const a_amv_var_virt_version_minor_val[] = {mx_VERSION_MINOR}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[13 +1]; +} const a_amv_var_virt_version_minor = {NIL, a_amv_var_virt_version_minor_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_POSNUM, "version-minor"}; + +static char const a_amv_var_virt_version_update_val[] = {mx_VERSION_UPDATE}; +static struct{ +struct a_amv_var *av_link; +char const *av_value; +a_X(char *av_env;) +u32 av_flags; +char const av_name[14 +1]; +} const a_amv_var_virt_version_update = {NIL, a_amv_var_virt_version_update_val, a_X(0 su_COMMA) 0|a_AMV_VF_VIRT|a_AMV_VF_RDONLY|a_AMV_VF_NODEL|a_AMV_VF_POSNUM, "version-update"}; + +static struct a_amv_var_virt const a_amv_var_virts[] = { +{ok_v_build_cc, {0,}, (void const*)&a_amv_var_virt_build_cc}, +{ok_v_build_ld, {0,}, (void const*)&a_amv_var_virt_build_ld}, +{ok_v_build_os, {0,}, (void const*)&a_amv_var_virt_build_os}, +{ok_v_build_rest, {0,}, (void const*)&a_amv_var_virt_build_rest}, +{ok_v_contact_mail, {0,}, (void const*)&a_amv_var_virt_contact_mail}, +{ok_v_contact_web, {0,}, (void const*)&a_amv_var_virt_contact_web}, +{ok_v_features, {0,}, (void const*)&a_amv_var_virt_features}, +{ok_v_ssl_features, {0,}, (void const*)&a_amv_var_virt_ssl_features}, +{ok_v_system_mailrc, {0,}, (void const*)&a_amv_var_virt_system_mailrc}, +{ok_v_tls_features, {0,}, (void const*)&a_amv_var_virt_tls_features}, +{ok_v_version, {0,}, (void const*)&a_amv_var_virt_version}, +{ok_v_version_date, {0,}, (void const*)&a_amv_var_virt_version_date}, +{ok_v_version_hexnum, {0,}, (void const*)&a_amv_var_virt_version_hexnum}, +{ok_v_version_major, {0,}, (void const*)&a_amv_var_virt_version_major}, +{ok_v_version_minor, {0,}, (void const*)&a_amv_var_virt_version_minor}, +{ok_v_version_update, {0,}, (void const*)&a_amv_var_virt_version_update}, +}; +#define a_AMV_VAR_VIRTS_CNT 16 + +static struct a_amv_var_defval const a_amv_var_i3vals[] = { +{ok_b_asksub, {0,}, NIL}, +{ok_v_datefield, {0,}, "%Y-%m-%d %H:%M"}, +{ok_v_datefield_markout_older, {0,}, "%Y-%m-%d"}, +{ok_b_header, {0,}, NIL}, +{ok_v_ifs_ws, {0,}, " \t\n"}, +{ok_v_log_prefix, {0,}, VAL_UAGENT ": "}, +{ok_b_mbox_fcc_and_pcc, {0,}, NIL}, +{ok_v_prompt, {0,}, "? "}, +{ok_v_prompt2, {0,}, ".. "}, +{ok_b_save, {0,}, NIL}, +{ok_v_sendwait, {0,}, ""}, +{ok_v_umask, {0,}, "0077"}, +}; +#define a_AMV_VAR_I3VALS_CNT 12 + +static struct a_amv_var_defval const a_amv_var_defvals[] = { +{ok_v_bind_inter_byte_timeout, {0,}, mx_BIND_INTER_BYTE_TIMEOUT}, +{ok_v_charset_7bit, {0,}, CHARSET_7BIT}, +{ok_v_charset_8bit, {0,}, CHARSET_8BIT}, +{ok_v_content_description_forwarded_message, {0,}, mx_CONTENT_DESC_FORWARDED_MESSAGE}, +{ok_v_content_description_quote_attachment, {0,}, mx_CONTENT_DESC_QUOTE_ATTACHMENT}, +{ok_v_content_description_smime_message, {0,}, mx_CONTENT_DESC_SMIME_MESSAGE}, +{ok_v_content_description_smime_signature, {0,}, mx_CONTENT_DESC_SMIME_SIG}, +{ok_v_DEAD, {0,}, VAL_DEAD}, +{ok_v_EDITOR, {0,}, VAL_EDITOR}, +{ok_v_errors_limit, {0,}, VAL_ERRORS_LIMIT}, +{ok_v_escape, {0,}, n_ESCAPE}, +{ok_v_ifs, {0,}, " \t\n"}, +{ok_v_indentprefix, {0,}, "\t"}, +{ok_v_line_editor_cpl_word_breaks, {0,}, n_LINE_EDITOR_CPL_WORD_BREAKS}, +{ok_v_LISTER, {0,}, VAL_LISTER}, +{ok_v_MAILCAPS, {0,}, VAL_MAILCAPS}, +{ok_v_MAILRC, {0,}, VAL_MAILRC}, +{ok_v_MBOX, {0,}, VAL_MBOX}, +{ok_v_mta, {0,}, VAL_MTA}, +{ok_v_mta_argv0, {0,}, VAL_MTA_ARGV0}, +{ok_v_NETRC, {0,}, VAL_NETRC}, +{ok_v_PAGER, {0,}, VAL_PAGER}, +{ok_v_quote_chars, {0,}, ">|}:"}, +{ok_v_SHELL, {0,}, VAL_SHELL}, +{ok_v_TMPDIR, {0,}, VAL_TMPDIR}, +{ok_v_toplines, {0,}, "5"}, +{ok_v_ttycharset, {0,}, CHARSET_8BIT}, +{ok_v_VISUAL, {0,}, VAL_VISUAL}, +}; +#define a_AMV_VAR_DEFVALS_CNT 28 + +#define a_AMV_VAR__SPECIAL_PARAM_MAP_IDX 0u +#define a_AMV_VAR__QM_MAP_IDX 1u +#define a_AMV_VAR__EM_MAP_IDX 2u + +# undef a_X +#endif /* !a__CREATE_OKEY_MAP_PL */ +#define a_AMV_VAR_REV_ILL 341u +#define a_AMV_VAR_REV_PRIME 619u +#define a_AMV_VAR_REV_LONGEST 6u +#define a_AMV_VAR_REV_WRAPAROUND 0 +static u16 const a_amv_var_revmap[a_AMV_VAR_REV_PRIME] = { +229u,176u,341u,341u,184u,341u,259u,294u,318u,341u, +2u,23u,267u,341u,341u,155u,341u,119u,122u,341u, +25u,341u,341u,341u,341u,48u,249u,315u,341u,341u, +341u,29u,228u,165u,341u,121u,196u,158u,250u,129u, +266u,341u,192u,220u,72u,302u,341u,341u,341u,341u, +231u,341u,341u,57u,65u,327u,341u,341u,341u,341u, +162u,131u,54u,341u,241u,341u,341u,341u,341u,341u, +341u,341u,86u,6u,341u,341u,341u,341u,40u,80u, +150u,113u,248u,312u,341u,341u,341u,341u,341u,341u, +170u,341u,341u,341u,341u,341u,171u,341u,43u,180u, +341u,73u,309u,341u,341u,341u,12u,106u,341u,341u, +341u,272u,341u,341u,341u,341u,341u,341u,341u,341u, +74u,157u,341u,251u,341u,93u,341u,341u,341u,246u, +289u,303u,341u,104u,32u,217u,316u,341u,66u,55u, +341u,20u,160u,199u,322u,341u,341u,99u,341u,317u, +222u,341u,69u,341u,341u,341u,4u,166u,255u,341u, +341u,335u,243u,169u,341u,112u,341u,341u,341u,341u, +341u,213u,276u,281u,341u,71u,194u,279u,197u,290u, +125u,323u,341u,91u,341u,341u,204u,341u,153u,297u, +84u,22u,328u,341u,341u,236u,154u,296u,16u,313u, +341u,341u,341u,174u,341u,24u,175u,264u,326u,172u, +83u,225u,341u,341u,123u,182u,202u,341u,95u,341u, +341u,341u,341u,134u,179u,319u,144u,306u,341u,341u, +341u,341u,341u,187u,224u,341u,237u,7u,341u,46u, +151u,161u,118u,211u,275u,307u,81u,341u,78u,341u, +11u,198u,186u,90u,140u,36u,109u,149u,214u,338u, +39u,341u,341u,15u,341u,341u,341u,341u,138u,102u, +208u,164u,341u,341u,341u,227u,223u,341u,254u,5u, +77u,256u,148u,341u,341u,85u,341u,240u,239u,341u, +341u,341u,269u,341u,341u,341u,82u,341u,341u,128u, +341u,341u,341u,341u,45u,76u,341u,341u,146u,263u, +341u,206u,288u,9u,301u,341u,341u,341u,341u,341u, +59u,132u,314u,341u,341u,92u,226u,200u,341u,341u, +341u,341u,341u,341u,203u,116u,147u,89u,265u,178u, +110u,75u,337u,341u,341u,341u,341u,310u,19u,341u, +70u,87u,168u,3u,341u,308u,195u,341u,341u,341u, +341u,341u,42u,115u,37u,139u,26u,300u,284u,341u, +341u,159u,205u,183u,30u,332u,341u,127u,152u,341u, +324u,17u,298u,341u,341u,341u,341u,341u,336u,341u, +53u,143u,8u,124u,133u,341u,341u,136u,341u,341u, +341u,60u,341u,188u,193u,341u,244u,56u,207u,242u, +114u,210u,218u,339u,341u,341u,341u,341u,341u,181u, +341u,321u,0u,341u,341u,341u,191u,341u,282u,341u, +62u,341u,142u,257u,292u,341u,341u,341u,341u,341u, +341u,107u,293u,341u,341u,341u,88u,341u,341u,221u, +235u,31u,331u,341u,341u,341u,100u,34u,341u,341u, +341u,333u,108u,341u,47u,185u,341u,341u,341u,103u, +212u,341u,341u,341u,341u,341u,341u,341u,341u,341u, +341u,126u,341u,341u,10u,21u,49u,341u,173u,61u, +117u,135u,201u,260u,277u,305u,320u,33u,120u,130u, +141u,268u,341u,51u,156u,44u,52u,58u,311u,341u, +341u,232u,341u,238u,247u,341u,341u,278u,245u,18u, +94u,163u,291u,340u,341u,68u,101u,330u,38u,341u, +341u,341u,341u,341u,341u,341u,341u,341u,177u,252u, +341u,341u,341u,341u,216u,262u,285u,341u,98u,280u, +341u,341u,219u,329u,274u,209u,234u,341u,167u,341u, +283u,14u,79u,50u,105u,35u,304u,341u,341u,253u, +28u,64u,341u,341u,215u,230u,111u,270u,271u,137u, +261u,190u,341u,341u,341u,341u,341u,341u,341u,341u, +341u,341u,67u,341u,325u,341u,341u,341u,273u,286u, +1u,96u,258u,295u,341u,233u,13u,341u,27u,341u, +299u,334u,63u,97u,341u,145u,189u,287u,41u +}; diff --git a/src/mx/gen-tcaps.h b/src/mx/gen-tcaps.h dissimilarity index 95% index 7ce63ec8..cec49225 100644 --- a/src/mx/gen-tcaps.h +++ b/src/mx/gen-tcaps.h @@ -1,150 +1,150 @@ -/*@ gen-tcaps.h, generated by make-tcap-map.pl. - *@ See termcap.c for more */ - -static char const a_termcap_namedat[] = { - /* [0]+8, mx_TERMCAP_CMD_te */ 't','e', 'r','m','c','u','p','\0', - /* [8]+8, mx_TERMCAP_CMD_ti */ 't','i', 's','m','c','u','p','\0', - /* [16]+7, mx_TERMCAP_CMD_ks */ 'k','s', 's','m','k','x','\0', - /* [23]+7, mx_TERMCAP_CMD_ke */ 'k','e', 'r','m','k','x','\0', - /* [30]+5, mx_TERMCAP_CMD_ce */ 'c','e', 'e','l','\0', - /* [35]+6, mx_TERMCAP_CMD_ch */ 'c','h', 'h','p','a','\0', - /* [41]+5, mx_TERMCAP_CMD_cr */ 'c','r', 'c','r','\0', - /* [46]+7, mx_TERMCAP_CMD_le */ 'l','e', 'c','u','b','1','\0', - /* [53]+7, mx_TERMCAP_CMD_nd */ 'n','d', 'c','u','f','1','\0', - /* [60]+5, mx_TERMCAP_CMD_cd */ 'c','d', 'e','d','\0', - /* [65]+7, mx_TERMCAP_CMD_ho */ 'h','o', 'h','o','m','e','\0', - /* [72]+8, mx_TERMCAP_CMD_cl */ 'c','l', 'c','l','e','a','r','\0', - /* [80]+5, mx_TERMCAP_QUERY_am */ 'a','m', 'a','m','\0', - /* [85]+6, mx_TERMCAP_QUERY_sam */ 'Y','E', 's','a','m','\0', - /* [91]+7, mx_TERMCAP_QUERY_xenl */ 'x','n', 'x','e','n','l','\0', - /* [98]+9, mx_TERMCAP_QUERY_colors */ 'C','o', 'c','o','l','o','r','s','\0', -#ifdef mx_HAVE_KEY_BINDINGS - /* [107]+6, mx_TERMCAP_QUERY_key_backspace */ 'k','b', 'k','b','s','\0', - /* [113]+8, mx_TERMCAP_QUERY_key_dc */ 'k','D', 'k','d','c','h','1','\0', - /* [121]+6, mx_TERMCAP_QUERY_key_sdc */ '*','4', 'k','D','C','\0', - /* [127]+6, mx_TERMCAP_QUERY_key_eol */ 'k','E', 'k','e','l','\0', - /* [133]+7, mx_TERMCAP_QUERY_key_exit */ '@','9', 'k','e','x','t','\0', - /* [140]+8, mx_TERMCAP_QUERY_key_ic */ 'k','I', 'k','i','c','h','1','\0', - /* [148]+6, mx_TERMCAP_QUERY_key_sic */ '#','3', 'k','I','C','\0', - /* [154]+8, mx_TERMCAP_QUERY_key_home */ 'k','h', 'k','h','o','m','e','\0', - /* [162]+7, mx_TERMCAP_QUERY_key_shome */ '#','2', 'k','H','O','M','\0', - /* [169]+7, mx_TERMCAP_QUERY_key_end */ '@','7', 'k','e','n','d','\0', - /* [176]+7, mx_TERMCAP_QUERY_key_send */ '*','7', 'k','E','N','D','\0', - /* [183]+6, mx_TERMCAP_QUERY_key_npage */ 'k','N', 'k','n','p','\0', - /* [189]+6, mx_TERMCAP_QUERY_key_ppage */ 'k','P', 'k','p','p','\0', - /* [195]+8, mx_TERMCAP_QUERY_key_left */ 'k','l', 'k','c','u','b','1','\0', - /* [203]+7, mx_TERMCAP_QUERY_key_sleft */ '#','4', 'k','L','F','T','\0', - /* [210]+8, mx_TERMCAP_QUERY_xkey_aleft */ '\0','\0', 'k','L','F','T','3','\0', - /* [218]+8, mx_TERMCAP_QUERY_xkey_cleft */ '\0','\0', 'k','L','F','T','5','\0', - /* [226]+8, mx_TERMCAP_QUERY_key_right */ 'k','r', 'k','c','u','f','1','\0', - /* [234]+7, mx_TERMCAP_QUERY_key_sright */ '%','i', 'k','R','I','T','\0', - /* [241]+8, mx_TERMCAP_QUERY_xkey_aright */ '\0','\0', 'k','R','I','T','3','\0', - /* [249]+8, mx_TERMCAP_QUERY_xkey_cright */ '\0','\0', 'k','R','I','T','5','\0', - /* [257]+8, mx_TERMCAP_QUERY_key_down */ 'k','d', 'k','c','u','d','1','\0', - /* [265]+6, mx_TERMCAP_QUERY_xkey_sdown */ '\0','\0', 'k','D','N','\0', - /* [271]+7, mx_TERMCAP_QUERY_xkey_adown */ '\0','\0', 'k','D','N','3','\0', - /* [278]+7, mx_TERMCAP_QUERY_xkey_cdown */ '\0','\0', 'k','D','N','5','\0', - /* [285]+8, mx_TERMCAP_QUERY_key_up */ 'k','u', 'k','c','u','u','1','\0', - /* [293]+6, mx_TERMCAP_QUERY_xkey_sup */ '\0','\0', 'k','U','P','\0', - /* [299]+7, mx_TERMCAP_QUERY_xkey_aup */ '\0','\0', 'k','U','P','3','\0', - /* [306]+7, mx_TERMCAP_QUERY_xkey_cup */ '\0','\0', 'k','U','P','5','\0', - /* [313]+6, mx_TERMCAP_QUERY_kf0 */ 'k','0', 'k','f','0','\0', - /* [319]+6, mx_TERMCAP_QUERY_kf1 */ 'k','1', 'k','f','1','\0', - /* [325]+6, mx_TERMCAP_QUERY_kf2 */ 'k','2', 'k','f','2','\0', - /* [331]+6, mx_TERMCAP_QUERY_kf3 */ 'k','3', 'k','f','3','\0', - /* [337]+6, mx_TERMCAP_QUERY_kf4 */ 'k','4', 'k','f','4','\0', - /* [343]+6, mx_TERMCAP_QUERY_kf5 */ 'k','5', 'k','f','5','\0', - /* [349]+6, mx_TERMCAP_QUERY_kf6 */ 'k','6', 'k','f','6','\0', - /* [355]+6, mx_TERMCAP_QUERY_kf7 */ 'k','7', 'k','f','7','\0', - /* [361]+6, mx_TERMCAP_QUERY_kf8 */ 'k','8', 'k','f','8','\0', - /* [367]+6, mx_TERMCAP_QUERY_kf9 */ 'k','9', 'k','f','9','\0', - /* [373]+7, mx_TERMCAP_QUERY_kf10 */ 'k',';', 'k','f','1','0','\0', - /* [380]+7, mx_TERMCAP_QUERY_kf11 */ 'F','1', 'k','f','1','1','\0', - /* [387]+7, mx_TERMCAP_QUERY_kf12 */ 'F','2', 'k','f','1','2','\0', - /* [394]+7, mx_TERMCAP_QUERY_kf13 */ 'F','3', 'k','f','1','3','\0', - /* [401]+7, mx_TERMCAP_QUERY_kf14 */ 'F','4', 'k','f','1','4','\0', - /* [408]+7, mx_TERMCAP_QUERY_kf15 */ 'F','5', 'k','f','1','5','\0', - /* [415]+7, mx_TERMCAP_QUERY_kf16 */ 'F','6', 'k','f','1','6','\0', - /* [422]+7, mx_TERMCAP_QUERY_kf17 */ 'F','7', 'k','f','1','7','\0', - /* [429]+7, mx_TERMCAP_QUERY_kf18 */ 'F','8', 'k','f','1','8','\0', - /* [436]+7, mx_TERMCAP_QUERY_kf19 */ 'F','9', 'k','f','1','9','\0', -#endif /* mx_HAVE_KEY_BINDINGS */ -}; - -static struct a_termcap_control const a_termcap_control[] = { -# ifdef mx_HAVE_TERMCAP - {/* 0. mx_TERMCAP_CMD_te */ mx_TERMCAP_CAPTYPE_STRING, 0}, - {/* 1. mx_TERMCAP_CMD_ti */ mx_TERMCAP_CAPTYPE_STRING, 8}, - {/* 2. mx_TERMCAP_CMD_ks */ mx_TERMCAP_CAPTYPE_STRING, 16}, - {/* 3. mx_TERMCAP_CMD_ke */ mx_TERMCAP_CAPTYPE_STRING, 23}, -# endif -# ifdef mx_HAVE_MLE - {/* 4. mx_TERMCAP_CMD_ce */ mx_TERMCAP_CAPTYPE_STRING, 30}, - {/* 5. mx_TERMCAP_CMD_ch */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_ARG_IDX1, 35}, - {/* 6. mx_TERMCAP_CMD_cr */ mx_TERMCAP_CAPTYPE_STRING, 41}, - {/* 7. mx_TERMCAP_CMD_le */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_ARG_CNT, 46}, - {/* 8. mx_TERMCAP_CMD_nd */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_ARG_CNT, 53}, -# ifdef mx_HAVE_TERMCAP - {/* 9. mx_TERMCAP_CMD_cd */ mx_TERMCAP_CAPTYPE_STRING, 60}, - {/* 10. mx_TERMCAP_CMD_ho */ mx_TERMCAP_CAPTYPE_STRING, 65}, -# endif - {/* 11. mx_TERMCAP_CMD_cl */ mx_TERMCAP_CAPTYPE_STRING, 72}, -# endif - {/* 12. mx_TERMCAP_QUERY_am */ mx_TERMCAP_CAPTYPE_BOOL|a_TERMCAP_F_QUERY, 80}, - {/* 13. mx_TERMCAP_QUERY_sam */ mx_TERMCAP_CAPTYPE_BOOL|a_TERMCAP_F_QUERY, 85}, - {/* 14. mx_TERMCAP_QUERY_xenl */ mx_TERMCAP_CAPTYPE_BOOL|a_TERMCAP_F_QUERY, 91}, -# ifdef mx_HAVE_COLOUR - {/* 15. mx_TERMCAP_QUERY_colors */ mx_TERMCAP_CAPTYPE_NUMERIC|a_TERMCAP_F_QUERY, 98}, -# endif -# ifdef mx_HAVE_KEY_BINDINGS - {/* 16. mx_TERMCAP_QUERY_key_backspace */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 107}, - {/* 17. mx_TERMCAP_QUERY_key_dc */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 113}, - {/* 18. mx_TERMCAP_QUERY_key_sdc */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 121}, - {/* 19. mx_TERMCAP_QUERY_key_eol */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 127}, - {/* 20. mx_TERMCAP_QUERY_key_exit */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 133}, - {/* 21. mx_TERMCAP_QUERY_key_ic */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 140}, - {/* 22. mx_TERMCAP_QUERY_key_sic */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 148}, - {/* 23. mx_TERMCAP_QUERY_key_home */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 154}, - {/* 24. mx_TERMCAP_QUERY_key_shome */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 162}, - {/* 25. mx_TERMCAP_QUERY_key_end */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 169}, - {/* 26. mx_TERMCAP_QUERY_key_send */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 176}, - {/* 27. mx_TERMCAP_QUERY_key_npage */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 183}, - {/* 28. mx_TERMCAP_QUERY_key_ppage */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 189}, - {/* 29. mx_TERMCAP_QUERY_key_left */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 195}, - {/* 30. mx_TERMCAP_QUERY_key_sleft */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 203}, - {/* 31. mx_TERMCAP_QUERY_xkey_aleft */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 210}, - {/* 32. mx_TERMCAP_QUERY_xkey_cleft */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 218}, - {/* 33. mx_TERMCAP_QUERY_key_right */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 226}, - {/* 34. mx_TERMCAP_QUERY_key_sright */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 234}, - {/* 35. mx_TERMCAP_QUERY_xkey_aright */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 241}, - {/* 36. mx_TERMCAP_QUERY_xkey_cright */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 249}, - {/* 37. mx_TERMCAP_QUERY_key_down */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 257}, - {/* 38. mx_TERMCAP_QUERY_xkey_sdown */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 265}, - {/* 39. mx_TERMCAP_QUERY_xkey_adown */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 271}, - {/* 40. mx_TERMCAP_QUERY_xkey_cdown */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 278}, - {/* 41. mx_TERMCAP_QUERY_key_up */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 285}, - {/* 42. mx_TERMCAP_QUERY_xkey_sup */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 293}, - {/* 43. mx_TERMCAP_QUERY_xkey_aup */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 299}, - {/* 44. mx_TERMCAP_QUERY_xkey_cup */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 306}, - {/* 45. mx_TERMCAP_QUERY_kf0 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 313}, - {/* 46. mx_TERMCAP_QUERY_kf1 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 319}, - {/* 47. mx_TERMCAP_QUERY_kf2 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 325}, - {/* 48. mx_TERMCAP_QUERY_kf3 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 331}, - {/* 49. mx_TERMCAP_QUERY_kf4 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 337}, - {/* 50. mx_TERMCAP_QUERY_kf5 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 343}, - {/* 51. mx_TERMCAP_QUERY_kf6 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 349}, - {/* 52. mx_TERMCAP_QUERY_kf7 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 355}, - {/* 53. mx_TERMCAP_QUERY_kf8 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 361}, - {/* 54. mx_TERMCAP_QUERY_kf9 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 367}, - {/* 55. mx_TERMCAP_QUERY_kf10 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 373}, - {/* 56. mx_TERMCAP_QUERY_kf11 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 380}, - {/* 57. mx_TERMCAP_QUERY_kf12 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 387}, - {/* 58. mx_TERMCAP_QUERY_kf13 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 394}, - {/* 59. mx_TERMCAP_QUERY_kf14 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 401}, - {/* 60. mx_TERMCAP_QUERY_kf15 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 408}, - {/* 61. mx_TERMCAP_QUERY_kf16 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 415}, - {/* 62. mx_TERMCAP_QUERY_kf17 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 422}, - {/* 63. mx_TERMCAP_QUERY_kf18 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 429}, - {/* 64. mx_TERMCAP_QUERY_kf19 */ mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 436}, -# endif /* mx_HAVE_KEY_BINDINGS */ -}; +/*@ gen-tcaps.h, generated by make-tcap-map.pl. + *@ See termcap.c for more */ + +static char const a_termcap_namedat[] = { +'t','e', 'r','m','c','u','p','\0', +'t','i', 's','m','c','u','p','\0', +'k','s', 's','m','k','x','\0', +'k','e', 'r','m','k','x','\0', +'c','e', 'e','l','\0', +'c','h', 'h','p','a','\0', +'c','r', 'c','r','\0', +'l','e', 'c','u','b','1','\0', +'n','d', 'c','u','f','1','\0', +'c','d', 'e','d','\0', +'h','o', 'h','o','m','e','\0', +'c','l', 'c','l','e','a','r','\0', +'a','m', 'a','m','\0', +'Y','E', 's','a','m','\0', +'x','n', 'x','e','n','l','\0', +'C','o', 'c','o','l','o','r','s','\0', +#ifdef mx_HAVE_KEY_BINDINGS +'k','b', 'k','b','s','\0', +'k','D', 'k','d','c','h','1','\0', +'*','4', 'k','D','C','\0', +'k','E', 'k','e','l','\0', +'@','9', 'k','e','x','t','\0', +'k','I', 'k','i','c','h','1','\0', +'#','3', 'k','I','C','\0', +'k','h', 'k','h','o','m','e','\0', +'#','2', 'k','H','O','M','\0', +'@','7', 'k','e','n','d','\0', +'*','7', 'k','E','N','D','\0', +'k','N', 'k','n','p','\0', +'k','P', 'k','p','p','\0', +'k','l', 'k','c','u','b','1','\0', +'#','4', 'k','L','F','T','\0', +'\0','\0', 'k','L','F','T','3','\0', +'\0','\0', 'k','L','F','T','5','\0', +'k','r', 'k','c','u','f','1','\0', +'%','i', 'k','R','I','T','\0', +'\0','\0', 'k','R','I','T','3','\0', +'\0','\0', 'k','R','I','T','5','\0', +'k','d', 'k','c','u','d','1','\0', +'\0','\0', 'k','D','N','\0', +'\0','\0', 'k','D','N','3','\0', +'\0','\0', 'k','D','N','5','\0', +'k','u', 'k','c','u','u','1','\0', +'\0','\0', 'k','U','P','\0', +'\0','\0', 'k','U','P','3','\0', +'\0','\0', 'k','U','P','5','\0', +'k','0', 'k','f','0','\0', +'k','1', 'k','f','1','\0', +'k','2', 'k','f','2','\0', +'k','3', 'k','f','3','\0', +'k','4', 'k','f','4','\0', +'k','5', 'k','f','5','\0', +'k','6', 'k','f','6','\0', +'k','7', 'k','f','7','\0', +'k','8', 'k','f','8','\0', +'k','9', 'k','f','9','\0', +'k',';', 'k','f','1','0','\0', +'F','1', 'k','f','1','1','\0', +'F','2', 'k','f','1','2','\0', +'F','3', 'k','f','1','3','\0', +'F','4', 'k','f','1','4','\0', +'F','5', 'k','f','1','5','\0', +'F','6', 'k','f','1','6','\0', +'F','7', 'k','f','1','7','\0', +'F','8', 'k','f','1','8','\0', +'F','9', 'k','f','1','9','\0', +#endif /* mx_HAVE_KEY_BINDINGS */ +}; + +static struct a_termcap_control const a_termcap_control[] = { +# ifdef mx_HAVE_TERMCAP +{mx_TERMCAP_CAPTYPE_STRING, 0}, +{mx_TERMCAP_CAPTYPE_STRING, 8}, +{mx_TERMCAP_CAPTYPE_STRING, 16}, +{mx_TERMCAP_CAPTYPE_STRING, 23}, +# endif +# ifdef mx_HAVE_MLE +{mx_TERMCAP_CAPTYPE_STRING, 30}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_ARG_IDX1, 35}, +{mx_TERMCAP_CAPTYPE_STRING, 41}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_ARG_CNT, 46}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_ARG_CNT, 53}, +# ifdef mx_HAVE_TERMCAP +{mx_TERMCAP_CAPTYPE_STRING, 60}, +{mx_TERMCAP_CAPTYPE_STRING, 65}, +# endif +{mx_TERMCAP_CAPTYPE_STRING, 72}, +# endif +{mx_TERMCAP_CAPTYPE_BOOL|a_TERMCAP_F_QUERY, 80}, +{mx_TERMCAP_CAPTYPE_BOOL|a_TERMCAP_F_QUERY, 85}, +{mx_TERMCAP_CAPTYPE_BOOL|a_TERMCAP_F_QUERY, 91}, +# ifdef mx_HAVE_COLOUR +{mx_TERMCAP_CAPTYPE_NUMERIC|a_TERMCAP_F_QUERY, 98}, +# endif +# ifdef mx_HAVE_KEY_BINDINGS +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 107}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 113}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 121}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 127}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 133}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 140}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 148}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 154}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 162}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 169}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 176}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 183}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 189}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 195}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 203}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 210}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 218}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 226}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 234}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 241}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 249}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 257}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 265}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 271}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 278}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 285}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 293}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 299}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 306}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 313}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 319}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 325}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 331}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 337}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 343}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 349}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 355}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 361}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 367}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 373}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 380}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 387}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 394}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 401}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 408}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 415}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 422}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 429}, +{mx_TERMCAP_CAPTYPE_STRING|a_TERMCAP_F_QUERY, 436}, +# endif /* mx_HAVE_KEY_BINDINGS */ +}; diff --git a/src/su/.main.cc b/src/su/.main.cc deleted file mode 100644 index 35b2abfb..00000000 --- a/src/su/.main.cc +++ /dev/null @@ -1,636 +0,0 @@ -// Very primitive C++ compile and run instantiator for SU C++ wrappers. - -// Sometimes we need a loop limit, e.g., when putting elements in containers -#define a_LOOP_NO 1000 - -// Call funs which produce statistical output -#define a_STATS(X) //X - -// Memory trace on program exit? -//#define a_TRACE - -#include -su_USECASE_MX_DISABLED - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -NSPC_USE(su) - -#define a_ERR() \ - do {log::write(log::alert, "%u\n", __LINE__); ++a_errors;} while(0) - -static uz a_errors; - -//static void a_cs(void); FIXME -static void a_cs_dict(void); - static void a__cs_dict(u32 addflags); - static void a__cs_dict_case(cs_dict *cdp, char const *k[3]); -static void a_icodec(void); -static void a_mem_bag(void); -static void a_prime(void); -static void a_sort(void); -static void a_utf(void); - -int main(void){ - state::set_program("SU/C++"); - state::set(state::debug); - - log::set_level(log::debug); - if(log::get_show_level()) - a_ERR(); - log::set_show_level(TRU1); - if(!log::get_show_level()) - a_ERR(); - - if(log::get_show_pid()) - a_ERR(); - log::set_show_pid(TRU1); - if(!log::get_show_pid()) - a_ERR(); - - log::write(log::info, "Redemption songs\n"); - - /// Basics (isolated) - - a_prime(); - a_utf(); - - /// Basics (building upon other basics) - - a_icodec(); - a_mem_bag(); - a_sort(); - - /// Extended - - a_cs_dict(); - -#ifdef a_TRACE - mem::trace(); -#endif - log::write(log::info, (a_errors == 0 ? "These songs of freedom\n" - : "Not to be heard\n")); - return (a_errors != 0); -} - -static void -a_cs_dict(void){ - a__cs_dict(cs_dict::f_none); - a__cs_dict(cs_dict::f_pow2_spaced); -} - -static void -a__cs_dict(u32 addflags){ - { - cs_dict cd(NIL, addflags); - char const *k[3]; - - k[0] = "k1"; - k[1] = "k2"; - k[2] = "k3"; - - a__cs_dict_case(&cd, k); - - if(cd.is_empty()) - a_ERR(); - - cs_dict cd2(cd); - if(cd2.count() != cd.count()) - a_ERR(); - for(cs_dict::view cdv(cd2); cdv; ++cdv) - if(!cd.has_key(cdv.key())) - a_ERR(); - else if(cdv.data() != cd.lookup(cdv.key())) - a_ERR(); - - cd2 = cd; - if(cd2.count() != cd.count()) - a_ERR(); - for(cs_dict::view cdv(cd2); cdv; ++cdv) - if(!cd.has_key(cdv.key())) - a_ERR(); - else if(cdv.data() != cd.lookup(cdv.key())) - a_ERR(); - } - { - cs_dict cd(auto_type_toolbox::get_instance(), addflags); - - cs_dict::view cdv(cd); - if(cdv.reset_insert("K1", "V1")) - a_ERR(); - else if(cdv.reset_insert("K2", "V2")) - a_ERR(); - else if(cdv.reset_insert("K3", "V3")) - a_ERR(); - else{ - if(cd.is_empty()) - a_ERR(); - - cs_dict cd2(cd); - if(cd2.count() != cd.count()) - a_ERR(); - for(cs_dict::view cdv(cd2); cdv; ++cdv) - if(!cd.has_key(cdv.key())) - a_ERR(); - else if(cs::cmp(cdv.data(), cd.lookup(cdv.key()))) - a_ERR(); - else if(cdv.data() == cd.lookup(cdv.key())) - a_ERR(); - - cd2 = cd; - if(cd2.count() != cd.count()) - a_ERR(); - for(cs_dict::view cdv(cd2); cdv; ++cdv) - if(!cd.has_key(cdv.key())) - a_ERR(); - else if(cs::cmp(cdv.data(), cd.lookup(cdv.key()))) - a_ERR(); - else if(cdv.data() == cd.lookup(cdv.key())) - a_ERR(); - } - } - - // Now for the real thing - - { - cs_dict cd(NIL, cd.f_case | addflags); - char const *k[3]; - - k[0] = "K1"; - k[1] = "K2"; - k[2] = "K3"; - - a__cs_dict_case(&cd, k); - } - - /// Let's do some flag stuff and "big data" - u32 u32; - - char buf[ienc::buffer_size], *cp; - - cs_dict cdu(NIL, addflags); - cs_dict cdo(auto_type_toolbox::get_instance()); - - cdo.set_treshold_shift(4).add_flags(cdo.f_head_resort | addflags); - - for(u32 = 0; u32++ < a_LOOP_NO;){ - if((cp = ienc::convert(buf, u32)) == NIL){ - a_ERR(); - break; - } - if(cdu.insert(cp, R(NSPC(su)up*,u32)) != 0) - a_ERR(); - if(cdo.insert(cp, cp) != 0) - a_ERR(); - } - if(cdu.count() != a_LOOP_NO) - a_ERR(); - if(cdo.count() != a_LOOP_NO) - a_ERR(); - - // (value really duped?) - u32 = 0; - for(cs_dict::view cdov(cdo); cdov; ++u32, ++cdov){ - if(cs::cmp(cdov.key(), cdov.data())) - a_ERR(); - if(!cdu.has_key(cdov.key())) - a_ERR(); - else if((cp = ienc::convert(buf, R(NSPC(su)up,cdu.lookup(cdov.key()))) - ) == NIL) - a_ERR(); - else if(cs::cmp(cdov.key(), cp)) - a_ERR(); - } - if(u32 != a_LOOP_NO) - a_ERR(); - - a_STATS( cdo.statistics(); ) - - cdo.clear().add_flags(cdu.f_frozen); - for(u32 = 0; u32++ < a_LOOP_NO;){ - if((cp = ienc::convert(buf, u32)) == NIL){ - a_ERR(); - break; - } - if(cdo.insert(cp, cp) != 0) - a_ERR(); - } - if(cdo.count() != a_LOOP_NO) - a_ERR(); - - u32 = 0; - for(cs_dict::view cdov(cdo); cdov; ++u32, ++cdov) - if(cs::cmp(cdov.key(), cdov.data())) - a_ERR(); - if(u32 != a_LOOP_NO) - a_ERR(); - - a_STATS( cdo.statistics(); ) - - if(cdo.set_treshold_shift(2).balance().count() != a_LOOP_NO) - a_ERR(); - - a_STATS( cdo.statistics(); ) - - u32 = 0; - for(cs_dict::view cdov(cdo); cdov; ++u32, ++cdov) - if(cs::cmp(cdov.key(), cdov.data())) - a_ERR(); - if(u32 != a_LOOP_NO) - a_ERR(); - - { - cs_dict cdo2(cdo); - if(cdo2.count() != cdo.count()) - a_ERR(); - } - { - static type_toolbox const xtb = su_TYPE_TOOLBOX_I9R( - (type_toolbox::clone_fun)0x1, - (type_toolbox::delete_fun)0x2, - (type_toolbox::assign_fun)0x3, - NIL, NIL); - typedef cs_dict csd; - - csd *cdo2 = su_NEW(csd)(&xtb); - if(cdo2->assign(cdo) != 0) - a_ERR(); - if(cdo2->count() != cdo.count()) - a_ERR(); - su_DEL(cdo2); - } - { - cs_dict cdo2(auto_type_toolbox::get_instance()); - if(cdo2.assign_elems(cdo) != 0) - a_ERR(); - if(cdo2.count() != cdo.count()) - a_ERR(); - } -} - -static void -a__cs_dict_case(cs_dict *cdp, char const *k[3]){ - // basics - if(!cdp->is_empty()) - a_ERR(); - if(cdp->toolbox() != NIL) - a_ERR(); - - s32 s32 = cdp->insert(k[0], "v1"); - if(s32 != 0) - a_ERR(); - s32 = cdp->insert(k[0], "v1-no"); - if(s32 != -1) - a_ERR(); - s32 = cdp->replace("k1", "v1-yes"); - if(s32 != -1) - a_ERR(); - s32 = cdp->insert(k[1], "v2"); - if(s32 != 0) - a_ERR(); - s32 = cdp->insert(k[2], "v3"); - if(s32 != 0) - a_ERR(); - - if(cdp->count() != 3) - a_ERR(); - if(cdp->is_empty()) - a_ERR(); - - if(!cdp->remove(k[1])) - a_ERR(); - - if(!cdp->has_key(k[0])) - a_ERR(); - char const *ccp = cdp->lookup(k[0]); - if(ccp == NIL) - a_ERR(); - else if(cs::cmp(ccp, "v1-yes")) - a_ERR(); - if(cdp->has_key(k[1])) - a_ERR(); - ccp = cdp->lookup("k2"); - if(ccp != NIL) - a_ERR(); - if(!cdp->has_key(k[2])) - a_ERR(); - ccp = cdp->lookup("k3"); - if(ccp == NIL) - a_ERR(); - else if(cs::cmp(ccp, "v3")) - a_ERR(); - - { - cs_dict cd2(*cdp); - - if(cd2.count() != 2) - a_ERR(); - if(!cdp->clear_elems().is_empty()) - a_ERR(); - - if(!cd2.has_key(k[0])) - a_ERR(); - ccp = cd2.lookup("k1"); - if(ccp == NIL) - a_ERR(); - else if(cs::cmp(ccp, "v1-yes")) - a_ERR(); - - if(!cd2.has_key(k[2])) - a_ERR(); - ccp = cd2.lookup("k3"); - if(ccp == NIL) - a_ERR(); - else if(cs::cmp(ccp, "v3")) - a_ERR(); - - if(cdp->assign_elems(cd2) != 0) - a_ERR(); - } - - s32 = cdp->insert(k[1], "v2"); - if(s32 != 0) - a_ERR(); - ccp = cdp->lookup("k2"); - if(ccp == NIL) - a_ERR(); - else if(cs::cmp(ccp, "v2")) - a_ERR(); - - // view - cs_dict::view cdv(*cdp), cdv2(cdv); - u32 u32; - for(u32 = 0; cdv; ++u32, ++cdv2, ++cdv){ - char const *xk, *v; - - if(!cs::cmp(cdv.key(), xk = "k1")) - v = "v1-yes"; - else if(!cs::cmp(cdv.key(), xk = "k2")) - v = "v2"; - else if(!cs::cmp(cdv.key(), xk = "k3")) - v = "v3"; - else{ - a_ERR(); - continue; - } - if(cs::cmp(cdv.key(), cdv2.key())) - a_ERR(); - - if(!cdp->has_key(xk)) - a_ERR(); - - if(cs::cmp(v, cdv.data())) - a_ERR(); - if(cs::cmp(cdv.data(), cdv2.data())) - a_ERR(); - } - if(cdv2) - a_ERR(); - if(u32 != 3) - a_ERR(); - - if(!cdv.find(k[1])) - a_ERR(); - if(cdv.remove().find("k2")) - a_ERR(); - - for(u32 = 0, cdv.begin(); cdv.is_valid(); ++u32, ++cdv){ - char const *xk, *v; - - if(!cs::cmp(cdv.key(), xk = "k1")) - v = "v1-yes"; - else if(!cs::cmp(cdv.key(), xk = "k3")) - v = "v3"; - else{ - a_ERR(); - continue; - } - if(!cdp->has_key(xk)) - a_ERR(); - - if(cs::cmp(v, cdv.data())) - a_ERR(); - - if(!cdv.has_next() && u32 < 1) - a_ERR(); - } - if(u32 != 2) - a_ERR(); - - if(!cdv.find(k[2])) - a_ERR(); - if(cdv.set_data("v3-newnewnew") != 0) - a_ERR(); - if(cdp->count() != 2) - a_ERR(); - if(cs::cmp(cdv.data(), "v3-newnewnew")) - a_ERR(); - if(cs::cmp(*cdv, "v3-newnewnew")) - a_ERR(); - - /* View insertion */ - if(cdv.reset_insert("vk1", "vv1")) - a_ERR(); - if(!cdv.is_valid()) - a_ERR(); - else{ - if(cdp->count() != 3) - a_ERR(); - if(cs::cmp(cdv.key(), "vk1")) - a_ERR(); - if(cs::cmp(cdv.data(), "vv1")) - a_ERR(); - } - if(cdv.reset_insert("vk1", "vv2") != -1) - a_ERR(); - if(!cdv.is_valid()) - a_ERR(); - else{ - if(cdp->count() != 3) - a_ERR(); - if(cs::cmp(cdv.key(), "vk1")) - a_ERR(); - if(cs::cmp(cdv.data(), "vv1")) - a_ERR(); - } - if(cdv.reset_replace("vk1", "vv2") != -1) - a_ERR(); - if(!cdv.is_valid()) - a_ERR(); - else{ - if(cdp->count() != 3) - a_ERR(); - if(cs::cmp(cdv.key(), "vk1")) - a_ERR(); - if(cs::cmp(cdv.data(), "vv2")) - a_ERR(); - } - if(cdv.reset_replace("vk2", "vv3") != 0) - a_ERR(); - if(!cdv.is_valid()) - a_ERR(); - else{ - if(cdp->count() != 4) - a_ERR(); - if(cs::cmp(cdv.key(), "vk2")) - a_ERR(); - if(cs::cmp(cdv.data(), "vv3")) - a_ERR(); - } - if(cdv.reset_replace("vk2", "vv4") != -1) - a_ERR(); - if(!cdv.is_valid()) - a_ERR(); - else{ - if(cdp->count() != 4) - a_ERR(); - if(cs::cmp(cdv.key(), "vk2")) - a_ERR(); - if(cs::cmp(cdv.data(), "vv4")) - a_ERR(); - } -} - -static void -a_icodec(void){ - char buf[ienc::buffer_size]; - - u32 u32 = 0xAFFEDEADu; - char const *ccp; - if((ccp = ienc::convert(buf, u32)) == NIL) - a_ERR(); - if(cs::cmp(ccp, "2952715949")) - a_ERR(); - if((idec::convert(&u32, ccp, max::uz, 0, idec::mode_limit_32bit, &ccp - ) & (idec::state_emask | idec::state_consumed) - ) != idec::state_consumed) - a_ERR(); - if(*ccp != '\0') - a_ERR(); - if(u32 != 0xAFFEDEADu) - a_ERR(); - if((ccp = ienc::convert(buf, u32, 0x10)) == NIL) - a_ERR(); - else if(cs::cmp(ccp, "0xAFFEDEAD")) - a_ERR(); - else if((idec::convert(&u32, ccp, max::uz, 0, idec::mode_limit_32bit, &ccp - ) & (idec::state_emask | idec::state_consumed) - ) != idec::state_consumed) - a_ERR(); - else if(*ccp != '\0') - a_ERR(); - if(u32 != 0xAFFEDEADu) - a_ERR(); - - u64 u64 = (S(NSPC(su)u64,u32) << 32) | 0xABBABEEF; - if((ccp = ienc::convert(buf, u64)) == NIL) - a_ERR(); - else if(cs::cmp(ccp, "12681818438213746415")) - a_ERR(); - else if((idec::convert(&u64, ccp, max::uz, 0, idec::mode_none, &ccp - ) & (idec::state_emask | idec::state_consumed) - ) != idec::state_consumed) - a_ERR(); - else if(*ccp != '\0') - a_ERR(); - if(u64 != su_U64_C(0xAFFEDEADABBABEEF)) - a_ERR(); - if((ccp = ienc::convert(buf, u64, 0x10)) == NIL) - a_ERR(); - else if(cs::cmp(ccp, "0xAFFEDEADABBABEEF")) - a_ERR(); - else if((idec::convert(&u64, ccp, max::uz, 0, idec::mode_none, &ccp - ) & (idec::state_emask | idec::state_consumed) - ) != idec::state_consumed) - a_ERR(); - else if(*ccp != '\0') - a_ERR(); - if(u64 != su_U64_C(0xAFFEDEADABBABEEF)) - a_ERR(); -} - -static void -a_mem_bag(void){ // TODO only instantiation test yet -#ifdef su_HAVE_MEM_BAG - mem_bag *mb; - - mb = su_NEW(mem_bag); - -# ifdef su_HAVE_MEM_BAG_AUTO - mb->auto_allocate(10); -# endif - -# ifdef su_HAVE_MEM_BAG_LOFI - void *lvp = mb->lofi_allocate(10); - - mb->lofi_free(lvp); -# endif - - su_DEL(&mb->reset()); -#endif // su_HAVE_MEM_BAG -} - -static void -a_prime(void){ - u32 u32 = prime::lookup_next(0); - if(u32 != prime::lookup_min) - a_ERR(); - u64 u64 = prime::get_next(u32); - if(u32 == u64 || (u32 == 2 && u64 != 3)) - a_ERR(); - - u32 = prime::lookup_former(max::u32); - if(u32 != prime::lookup_max) - a_ERR(); - u64 = prime::get_former(u32 + 1); - if(u32 != u64) - a_ERR(); -} - -static void -a_sort(void){ - char const *arr_sorted[] = { - "albert", "berta", "david", "emil", - "friedrich", "gustav", "heinrich", "isidor" - }, *arr_mixed[] = { - "gustav", "david", "isidor", "friedrich", - "berta", "albert", "heinrich", "emil" - }; - - sort::shell(arr_mixed, NELEM(arr_mixed), &cs::cmp); - - for(uz i = NELEM(arr_sorted); i-- != 0;) - if(cs::cmp(arr_sorted[i], arr_mixed[i])) - a_ERR(); -} - -static void -a_utf(void){ - char buf[utf8::buffer_size]; - - char const *ccp = utf8::replacer; - uz i = sizeof(utf8::replacer) -1; - u32 u32 = utf8::convert_to_32(&ccp, &i); - if(u32 != utf32::replacer) - a_ERR(); - if(i != 0 || *ccp != '\0') - a_ERR(); - - i = utf32::convert_to_8(u32, buf); - if(i != 3 || buf[i] != '\0') - a_ERR(); - if(cs::cmp(buf, utf8::replacer)) - a_ERR(); -} - -#include -// s-it-mode diff --git a/src/su/.makefile b/src/su/.makefile deleted file mode 100644 index 392aea05..00000000 --- a/src/su/.makefile +++ /dev/null @@ -1,55 +0,0 @@ -#@ .makefile, solely for creating the C++ .main.cc test program -#@ With CC=tcc, AR=tcc ARFLAGS=-ar! - -su_USECASE_MX_DISABLED = - -awk?=awk -getconf?=getconf - -CXXFLAGS+=-Wall -pedantic -Dsu_HAVE_DEVEL -Dsu_HAVE_DEBUG -CFLAGS+=-Wall -pedantic -Dsu_HAVE_DEVEL -Dsu_HAVE_DEBUG - -CSRC = avopt.c core-code.c core-errors.c \ - cs-alloc.c cs-ctype.c cs-dict.c cs-find.c cs-misc.c \ - cs-rfind.c cs-tbox.c cs-tools.c \ - icodec-dec.c icodec-enc.c \ - mem-alloc.c mem-bag.c mem-tools.c \ - prime.c sort.c utf.c -CXXSRC = cxx-core.cc \ - .main.cc - -## 8< >8 - -.SUFFIXES: .o .c .cc .y -.cc.o: - $(CXX) -Dsu_USECASE_SU -I../../src -I../../include \ - $(CXXFLAGS) -o $(@) -c $(<) -.c.o: - $(CC) -Dsu_USECASE_SU -I../../src -I../../include \ - $(CFLAGS) -o $(@) -c $(<) -.cc .c .y: ; - -COBJ = $(CSRC:.c=.o) -CXXOBJ = $(CXXSRC:.cc=.o) -OBJ = $(COBJ) $(CXXOBJ) - -all: .main -clean: - rm -f ../../include/su/gen-config.h .main .tmp* .clib.a $(OBJ) - -$(COBJ): $(CSRC) ../../include/su/gen-config.h -.clib.a: $(COBJ) - $(AR) $(ARFLAGS) $(@) $(COBJ) -$(CXXOBJ): $(CLIB) ../../include/su/gen-config.h -.main: $(CXXOBJ) .clib.a - $(CXX) $(LDFLAGS) -o $(@) $(CXXOBJ) .clib.a - -../../include/su/gen-config.h: - SRCDIR=`dirname \`pwd\``/ TARGET="$(@)" awk="$(awk)" \ - $(SHELL) ../../mk/su-make-errors.sh config > .tmp.c &&\ - $(CC) -o .tmp .tmp.c &&\ - ./.tmp > $(@) &&\ - rm -f ./.tmp* &&\ - echo '#define su_PAGE_SIZE '"`$(getconf) PAGESIZE`" >> $(@) - -# s-mk-mode diff --git a/src/su/cxx-core.cc b/src/su/cxx-core.cc deleted file mode 100644 index ac1e20cb..00000000 --- a/src/su/cxx-core.cc +++ /dev/null @@ -1,63 +0,0 @@ -/*@ C++ injection point of most things which need it. - * - * Copyright (c) 2019 - 2020 Steffen (Daode) Nurpmeso . - * SPDX-License-Identifier: ISC - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, 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. - */ -#undef su_FILE -#define su_FILE su_cxx_core -#define su_SOURCE - -#include "su/code.h" -su_USECASE_MX_DISABLED - -#include - -#include "su/cs.h" -#include "su/utf.h" - -#include "su/code-in.h" -NSPC_USE(su) - -// code.h - -STA void -log::write(BITENUM_IS(u32,level) lvl, char const *fmt, ...){ // XXX unroll - va_list va; - NYD_IN; - - va_start(va, fmt); - su_log_vwrite(lvl, fmt, &va); - va_end(va); - NYD_OU; -} - -// cs.h - -STA type_toolbox const * const cs::type_toolbox = - R(NSPC(su)type_toolbox const*,&su_cs_toolbox); -STA type_toolbox const * const cs::const_type_toolbox = - R(NSPC(su)type_toolbox const*,&su_cs_toolbox); - -STA type_toolbox const * const cs::type_toolbox_case = - R(NSPC(su)type_toolbox const*,&su_cs_toolbox_case); -STA type_toolbox const * const cs::const_type_toolbox_case = - R(NSPC(su)type_toolbox const*,&su_cs_toolbox_case); - -// utf.h - -STA char const utf8::replacer[sizeof su_UTF8_REPLACER] = su_UTF8_REPLACER; - -#include "su/code-ou.h" -/* s-it-mode */ diff --git a/src/su/gen-cs-ctype.h b/src/su/gen-cs-ctype.h dissimilarity index 96% index 2aefebdd..83ddc770 100644 --- a/src/su/gen-cs-ctype.h +++ b/src/su/gen-cs-ctype.h @@ -1,170 +1,165 @@ -/*@ src/su/gen-cs-ctype.h, generated by su-make-cs-ctype.sh. - *@ See cs-ctype.c for more */ - -CTAV(su_CS_CTYPE_NONE == 0); -#undef a_X -#define a_X(X) su_CONCAT(su_CS_CTYPE_,X) -u16 const su__cs_ctype[S8_MAX + 1] = { - /* 0x00=? */ a_X(CNTRL), - /* 0x01=? */ a_X(CNTRL), - /* 0x02=? */ a_X(CNTRL), - /* 0x03=? */ a_X(CNTRL), - /* 0x04=? */ a_X(CNTRL), - /* 0x05=? */ a_X(CNTRL), - /* 0x06=? */ a_X(CNTRL), - /* 0x07=? */ a_X(CNTRL), - /* 0x08=? */ a_X(CNTRL), - /* 0x09=? */ a_X(BLANK) | a_X(CNTRL) | a_X(SPACE) | a_X(WHITE), - /* 0x0A=? */ a_X(CNTRL) | a_X(SPACE) | a_X(WHITE), - /* 0x0B=? */ a_X(CNTRL) | a_X(SPACE), - /* 0x0C=? */ a_X(CNTRL) | a_X(SPACE), - /* 0x0D=? */ a_X(CNTRL) | a_X(SPACE), - /* 0x0E=? */ a_X(CNTRL), - /* 0x0F=? */ a_X(CNTRL), - /* 0x10=? */ a_X(CNTRL), - /* 0x11=? */ a_X(CNTRL), - /* 0x12=? */ a_X(CNTRL), - /* 0x13=? */ a_X(CNTRL), - /* 0x14=? */ a_X(CNTRL), - /* 0x15=? */ a_X(CNTRL), - /* 0x16=? */ a_X(CNTRL), - /* 0x17=? */ a_X(CNTRL), - /* 0x18=? */ a_X(CNTRL), - /* 0x19=? */ a_X(CNTRL), - /* 0x1A=? */ a_X(CNTRL), - /* 0x1B=? */ a_X(CNTRL), - /* 0x1C=? */ a_X(CNTRL), - /* 0x1D=? */ a_X(CNTRL), - /* 0x1E=? */ a_X(CNTRL), - /* 0x1F=? */ a_X(CNTRL), - /* 0x20= */ a_X(BLANK) | a_X(PRINT) | a_X(SPACE) | a_X(WHITE), - /* 0x21=! */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x22=" */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x23=# */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x24=$ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x25=% */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x26=& */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x27=' */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x28=( */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x29=) */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x2A=* */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x2B=+ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x2C=, */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x2D=- */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x2E=. */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x2F=/ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x30=0 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x31=1 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x32=2 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x33=3 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x34=4 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x35=5 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x36=6 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x37=7 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x38=8 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x39=9 */ a_X(ALNUM) | a_X(DIGIT) | a_X(GRAPH) | a_X(PRINT) | a_X(XDIGIT), - /* 0x3A=: */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x3B=; */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x3C=< */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x3D== */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x3E=> */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x3F=? */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x40=@ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x41=A */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER) | a_X(XDIGIT), - /* 0x42=B */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER) | a_X(XDIGIT), - /* 0x43=C */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER) | a_X(XDIGIT), - /* 0x44=D */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER) | a_X(XDIGIT), - /* 0x45=E */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER) | a_X(XDIGIT), - /* 0x46=F */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER) | a_X(XDIGIT), - /* 0x47=G */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x48=H */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x49=I */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x4A=J */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x4B=K */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x4C=L */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x4D=M */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x4E=N */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x4F=O */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x50=P */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x51=Q */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x52=R */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x53=S */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x54=T */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x55=U */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x56=V */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x57=W */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x58=X */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x59=Y */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x5A=Z */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(PRINT) | a_X(UPPER), - /* 0x5B=[ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x5C=\ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x5D=] */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x5E=^ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x5F=_ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x60=` */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x61=a */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT) | a_X(XDIGIT), - /* 0x62=b */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT) | a_X(XDIGIT), - /* 0x63=c */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT) | a_X(XDIGIT), - /* 0x64=d */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT) | a_X(XDIGIT), - /* 0x65=e */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT) | a_X(XDIGIT), - /* 0x66=f */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT) | a_X(XDIGIT), - /* 0x67=g */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x68=h */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x69=i */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x6A=j */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x6B=k */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x6C=l */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x6D=m */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x6E=n */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x6F=o */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x70=p */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x71=q */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x72=r */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x73=s */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x74=t */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x75=u */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x76=v */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x77=w */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x78=x */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x79=y */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x7A=z */ a_X(ALNUM) | a_X(ALPHA) | a_X(GRAPH) | a_X(LOWER) | a_X(PRINT), - /* 0x7B={ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x7C=| */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x7D=} */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x7E=~ */ a_X(GRAPH) | a_X(PRINT) | a_X(PUNCT), - /* 0x7F=? */ a_X(CNTRL), -}; -#undef a_X - -u8 const su__cs_tolower[S8_MAX + 1] = { - '\x00','\x01','\x02','\x03','\x04','\x05','\x06','\x07','\x08','\x09', - '\x0A','\x0B','\x0C','\x0D','\x0E','\x0F','\x10','\x11','\x12','\x13', - '\x14','\x15','\x16','\x17','\x18','\x19','\x1A','\x1B','\x1C','\x1D', - '\x1E','\x1F','\x20','\x21','\x22','\x23','\x24','\x25','\x26','\x27', - '\x28','\x29','\x2A','\x2B','\x2C','\x2D','\x2E','\x2F','\x30','\x31', - '\x32','\x33','\x34','\x35','\x36','\x37','\x38','\x39','\x3A','\x3B', - '\x3C','\x3D','\x3E','\x3F','\x40','\x61','\x62','\x63','\x64','\x65', - '\x66','\x67','\x68','\x69','\x6A','\x6B','\x6C','\x6D','\x6E','\x6F', - '\x70','\x71','\x72','\x73','\x74','\x75','\x76','\x77','\x78','\x79', - '\x7A','\x5B','\x5C','\x5D','\x5E','\x5F','\x60','\x61','\x62','\x63', - '\x64','\x65','\x66','\x67','\x68','\x69','\x6A','\x6B','\x6C','\x6D', - '\x6E','\x6F','\x70','\x71','\x72','\x73','\x74','\x75','\x76','\x77', - '\x78','\x79','\x7A','\x7B','\x7C','\x7D','\x7E','\x7F', -}; - -u8 const su__cs_toupper[S8_MAX + 1] = { - '\x00','\x01','\x02','\x03','\x04','\x05','\x06','\x07','\x08','\x09', - '\x0A','\x0B','\x0C','\x0D','\x0E','\x0F','\x10','\x11','\x12','\x13', - '\x14','\x15','\x16','\x17','\x18','\x19','\x1A','\x1B','\x1C','\x1D', - '\x1E','\x1F','\x20','\x21','\x22','\x23','\x24','\x25','\x26','\x27', - '\x28','\x29','\x2A','\x2B','\x2C','\x2D','\x2E','\x2F','\x30','\x31', - '\x32','\x33','\x34','\x35','\x36','\x37','\x38','\x39','\x3A','\x3B', - '\x3C','\x3D','\x3E','\x3F','\x40','\x41','\x42','\x43','\x44','\x45', - '\x46','\x47','\x48','\x49','\x4A','\x4B','\x4C','\x4D','\x4E','\x4F', - '\x50','\x51','\x52','\x53','\x54','\x55','\x56','\x57','\x58','\x59', - '\x5A','\x5B','\x5C','\x5D','\x5E','\x5F','\x60','\x41','\x42','\x43', - '\x44','\x45','\x46','\x47','\x48','\x49','\x4A','\x4B','\x4C','\x4D', - '\x4E','\x4F','\x50','\x51','\x52','\x53','\x54','\x55','\x56','\x57', - '\x58','\x59','\x5A','\x7B','\x7C','\x7D','\x7E','\x7F', -}; - +/*@ src/su/gen-cs-ctype.h, generated by su-make-cs-ctype.sh. + *@ See cs-ctype.c for more */ + +CTAV(su_CS_CTYPE_NONE == 0); +#undef a_X +#define a_X(X) su_CONCAT(su_CS_CTYPE_,X) +u16 const su__cs_ctype[S8_MAX + 1] = { +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(BLANK)|a_X(CNTRL)|a_X(SPACE)|a_X(WHITE), +a_X(CNTRL)|a_X(SPACE)|a_X(WHITE), +a_X(CNTRL)|a_X(SPACE), +a_X(CNTRL)|a_X(SPACE), +a_X(CNTRL)|a_X(SPACE), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(CNTRL), +a_X(BLANK)|a_X(PRINT)|a_X(SPACE)|a_X(WHITE), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(DIGIT)|a_X(GRAPH)|a_X(PRINT)|a_X(XDIGIT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(PRINT)|a_X(UPPER), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT)|a_X(XDIGIT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(ALNUM)|a_X(ALPHA)|a_X(GRAPH)|a_X(LOWER)|a_X(PRINT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(GRAPH)|a_X(PRINT)|a_X(PUNCT), +a_X(CNTRL), +}; +#undef a_X +u8 const su__cs_tolower[S8_MAX + 1] = { +'\x00','\x01','\x02','\x03','\x04','\x05','\x06','\x07','\x08','\x09','\x0A', +'\x0B','\x0C','\x0D','\x0E','\x0F','\x10','\x11','\x12','\x13','\x14','\x15', +'\x16','\x17','\x18','\x19','\x1A','\x1B','\x1C','\x1D','\x1E','\x1F','\x20', +'\x21','\x22','\x23','\x24','\x25','\x26','\x27','\x28','\x29','\x2A','\x2B', +'\x2C','\x2D','\x2E','\x2F','\x30','\x31','\x32','\x33','\x34','\x35','\x36', +'\x37','\x38','\x39','\x3A','\x3B','\x3C','\x3D','\x3E','\x3F','\x40','\x61', +'\x62','\x63','\x64','\x65','\x66','\x67','\x68','\x69','\x6A','\x6B','\x6C', +'\x6D','\x6E','\x6F','\x70','\x71','\x72','\x73','\x74','\x75','\x76','\x77', +'\x78','\x79','\x7A','\x5B','\x5C','\x5D','\x5E','\x5F','\x60','\x61','\x62', +'\x63','\x64','\x65','\x66','\x67','\x68','\x69','\x6A','\x6B','\x6C','\x6D', +'\x6E','\x6F','\x70','\x71','\x72','\x73','\x74','\x75','\x76','\x77','\x78', +'\x79','\x7A','\x7B','\x7C','\x7D','\x7E','\x7F', +}; +u8 const su__cs_toupper[S8_MAX + 1] = { +'\x00','\x01','\x02','\x03','\x04','\x05','\x06','\x07','\x08','\x09','\x0A', +'\x0B','\x0C','\x0D','\x0E','\x0F','\x10','\x11','\x12','\x13','\x14','\x15', +'\x16','\x17','\x18','\x19','\x1A','\x1B','\x1C','\x1D','\x1E','\x1F','\x20', +'\x21','\x22','\x23','\x24','\x25','\x26','\x27','\x28','\x29','\x2A','\x2B', +'\x2C','\x2D','\x2E','\x2F','\x30','\x31','\x32','\x33','\x34','\x35','\x36', +'\x37','\x38','\x39','\x3A','\x3B','\x3C','\x3D','\x3E','\x3F','\x40','\x41', +'\x42','\x43','\x44','\x45','\x46','\x47','\x48','\x49','\x4A','\x4B','\x4C', +'\x4D','\x4E','\x4F','\x50','\x51','\x52','\x53','\x54','\x55','\x56','\x57', +'\x58','\x59','\x5A','\x5B','\x5C','\x5D','\x5E','\x5F','\x60','\x41','\x42', +'\x43','\x44','\x45','\x46','\x47','\x48','\x49','\x4A','\x4B','\x4C','\x4D', +'\x4E','\x4F','\x50','\x51','\x52','\x53','\x54','\x55','\x56','\x57','\x58', +'\x59','\x5A','\x7B','\x7C','\x7D','\x7E','\x7F', +}; diff --git a/src/su/gen-errors.h b/src/su/gen-errors.h dissimilarity index 96% index df773e6d..812be335 100644 --- a/src/su/gen-errors.h +++ b/src/su/gen-errors.h @@ -1,454 +1,292 @@ -/*@ gen-errors.h, generated by su-make-errors.sh. - *@ See core-errors.c for more */ - -#ifdef su_SOURCE -static char const a_corerr_names[] = { - /* 0. [0]+4 NONE */ - 'N','O','N','E','\0', - /* 1. [5]+4 2BIG */ - '2','B','I','G','\0', - /* 2. [10]+5 ACCES */ - 'A','C','C','E','S','\0', - /* 3. [16]+9 ADDRINUSE */ - 'A','D','D','R','I','N','U','S','E','\0', - /* 4. [26]+12 ADDRNOTAVAIL */ - 'A','D','D','R','N','O','T','A','V','A','I','L','\0', - /* 5. [39]+11 AFNOSUPPORT */ - 'A','F','N','O','S','U','P','P','O','R','T','\0', - /* 6. [51]+5 AGAIN */ - 'A','G','A','I','N','\0', - /* 7. [57]+7 ALREADY */ - 'A','L','R','E','A','D','Y','\0', - /* 8. [65]+4 BADF */ - 'B','A','D','F','\0', - /* 9. [70]+6 BADMSG */ - 'B','A','D','M','S','G','\0', - /* 10. [77]+4 BUSY */ - 'B','U','S','Y','\0', - /* 11. [82]+8 CANCELED */ - 'C','A','N','C','E','L','E','D','\0', - /* 12. [91]+5 CHILD */ - 'C','H','I','L','D','\0', - /* 13. [97]+11 CONNABORTED */ - 'C','O','N','N','A','B','O','R','T','E','D','\0', - /* 14. [109]+11 CONNREFUSED */ - 'C','O','N','N','R','E','F','U','S','E','D','\0', - /* 15. [121]+9 CONNRESET */ - 'C','O','N','N','R','E','S','E','T','\0', - /* 16. [131]+6 DEADLK */ - 'D','E','A','D','L','K','\0', - /* 17. [138]+11 DESTADDRREQ */ - 'D','E','S','T','A','D','D','R','R','E','Q','\0', - /* 18. [150]+3 DOM */ - 'D','O','M','\0', - /* 19. [154]+5 DQUOT */ - 'D','Q','U','O','T','\0', - /* 20. [160]+5 EXIST */ - 'E','X','I','S','T','\0', - /* 21. [166]+5 FAULT */ - 'F','A','U','L','T','\0', - /* 22. [172]+4 FBIG */ - 'F','B','I','G','\0', - /* 23. [177]+11 HOSTUNREACH */ - 'H','O','S','T','U','N','R','E','A','C','H','\0', - /* 24. [189]+4 IDRM */ - 'I','D','R','M','\0', - /* 25. [194]+5 ILSEQ */ - 'I','L','S','E','Q','\0', - /* 26. [200]+10 INPROGRESS */ - 'I','N','P','R','O','G','R','E','S','S','\0', - /* 27. [211]+4 INTR */ - 'I','N','T','R','\0', - /* 28. [216]+5 INVAL */ - 'I','N','V','A','L','\0', - /* 29. [222]+2 IO */ - 'I','O','\0', - /* 30. [225]+6 ISCONN */ - 'I','S','C','O','N','N','\0', - /* 31. [232]+5 ISDIR */ - 'I','S','D','I','R','\0', - /* 32. [238]+4 LOOP */ - 'L','O','O','P','\0', - /* 33. [243]+5 MFILE */ - 'M','F','I','L','E','\0', - /* 34. [249]+5 MLINK */ - 'M','L','I','N','K','\0', - /* 35. [255]+7 MSGSIZE */ - 'M','S','G','S','I','Z','E','\0', - /* 36. [263]+8 MULTIHOP */ - 'M','U','L','T','I','H','O','P','\0', - /* 37. [272]+11 NAMETOOLONG */ - 'N','A','M','E','T','O','O','L','O','N','G','\0', - /* 38. [284]+7 NETDOWN */ - 'N','E','T','D','O','W','N','\0', - /* 39. [292]+8 NETRESET */ - 'N','E','T','R','E','S','E','T','\0', - /* 40. [301]+10 NETUNREACH */ - 'N','E','T','U','N','R','E','A','C','H','\0', - /* 41. [312]+5 NFILE */ - 'N','F','I','L','E','\0', - /* 42. [318]+6 NOBUFS */ - 'N','O','B','U','F','S','\0', - /* 43. [325]+6 NODATA */ - 'N','O','D','A','T','A','\0', - /* 44. [332]+5 NODEV */ - 'N','O','D','E','V','\0', - /* 45. [338]+5 NOENT */ - 'N','O','E','N','T','\0', - /* 46. [344]+6 NOEXEC */ - 'N','O','E','X','E','C','\0', - /* 47. [351]+5 NOLCK */ - 'N','O','L','C','K','\0', - /* 48. [357]+6 NOLINK */ - 'N','O','L','I','N','K','\0', - /* 49. [364]+5 NOMEM */ - 'N','O','M','E','M','\0', - /* 50. [370]+5 NOMSG */ - 'N','O','M','S','G','\0', - /* 51. [376]+10 NOPROTOOPT */ - 'N','O','P','R','O','T','O','O','P','T','\0', - /* 52. [387]+5 NOSPC */ - 'N','O','S','P','C','\0', - /* 53. [393]+4 NOSR */ - 'N','O','S','R','\0', - /* 54. [398]+5 NOSTR */ - 'N','O','S','T','R','\0', - /* 55. [404]+5 NOSYS */ - 'N','O','S','Y','S','\0', - /* 56. [410]+7 NOTCONN */ - 'N','O','T','C','O','N','N','\0', - /* 57. [418]+6 NOTDIR */ - 'N','O','T','D','I','R','\0', - /* 58. [425]+8 NOTEMPTY */ - 'N','O','T','E','M','P','T','Y','\0', - /* 59. [434]+9 NOTOBACCO */ - 'N','O','T','O','B','A','C','C','O','\0', - /* 60. [444]+7 NOTSOCK */ - 'N','O','T','S','O','C','K','\0', - /* 61. [452]+6 NOTSUP */ - 'N','O','T','S','U','P','\0', - /* 62. [459]+5 NOTTY */ - 'N','O','T','T','Y','\0', - /* 63. [465]+4 NXIO */ - 'N','X','I','O','\0', - /* 64. [470]+9 OPNOTSUPP */ - 'O','P','N','O','T','S','U','P','P','\0', - /* 65. [480]+8 OVERFLOW */ - 'O','V','E','R','F','L','O','W','\0', - /* 66. [489]+4 PERM */ - 'P','E','R','M','\0', - /* 67. [494]+4 PIPE */ - 'P','I','P','E','\0', - /* 68. [499]+5 PROTO */ - 'P','R','O','T','O','\0', - /* 69. [505]+14 PROTONOSUPPORT */ - 'P','R','O','T','O','N','O','S','U','P','P','O','R','T','\0', - /* 70. [520]+9 PROTOTYPE */ - 'P','R','O','T','O','T','Y','P','E','\0', - /* 71. [530]+5 RANGE */ - 'R','A','N','G','E','\0', - /* 72. [536]+4 ROFS */ - 'R','O','F','S','\0', - /* 73. [541]+5 SPIPE */ - 'S','P','I','P','E','\0', - /* 74. [547]+4 SRCH */ - 'S','R','C','H','\0', - /* 75. [552]+5 STALE */ - 'S','T','A','L','E','\0', - /* 76. [558]+4 TIME */ - 'T','I','M','E','\0', - /* 77. [563]+8 TIMEDOUT */ - 'T','I','M','E','D','O','U','T','\0', - /* 78. [572]+6 TXTBSY */ - 'T','X','T','B','S','Y','\0', - /* 79. [579]+10 WOULDBLOCK */ - 'W','O','U','L','D','B','L','O','C','K','\0', - /* 80. [590]+4 XDEV */ - 'X','D','E','V','\0', -}; - -# ifdef su_HAVE_DOCSTRINGS -# undef a_X -# define a_X(X) -static char const a_corerr_docs[] = { - /* 0. [0]+8 NONE */ a_X(N_("No error")) - 'N','o',' ','e','r','r','o','r','\0', - /* 1. [9]+22 2BIG */ a_X(N_("Argument list too long")) - 'A','r','g','u','m','e','n','t',' ','l','i','s','t',' ','t','o','o',' ','l','o','n','g','\0', - /* 2. [32]+17 ACCES */ a_X(N_("Permission denied")) - 'P','e','r','m','i','s','s','i','o','n',' ','d','e','n','i','e','d','\0', - /* 3. [50]+22 ADDRINUSE */ a_X(N_("Address already in use")) - 'A','d','d','r','e','s','s',' ','a','l','r','e','a','d','y',' ','i','n',' ','u','s','e','\0', - /* 4. [73]+31 ADDRNOTAVAIL */ a_X(N_("Cannot assign requested address")) - 'C','a','n','n','o','t',' ','a','s','s','i','g','n',' ','r','e','q','u','e','s','t','e','d',' ','a','d','d','r','e','s','s','\0', - /* 5. [105]+47 AFNOSUPPORT */ a_X(N_("Address family not supported by protocol family")) - 'A','d','d','r','e','s','s',' ','f','a','m','i','l','y',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d',' ','b','y',' ','p','r','o','t','o','c','o','l',' ','f','a','m','i','l','y','\0', - /* 6. [153]+32 AGAIN */ a_X(N_("Resource temporarily unavailable")) - 'R','e','s','o','u','r','c','e',' ','t','e','m','p','o','r','a','r','i','l','y',' ','u','n','a','v','a','i','l','a','b','l','e','\0', - /* 7. [186]+29 ALREADY */ a_X(N_("Operation already in progress")) - 'O','p','e','r','a','t','i','o','n',' ','a','l','r','e','a','d','y',' ','i','n',' ','p','r','o','g','r','e','s','s','\0', - /* 8. [216]+19 BADF */ a_X(N_("Bad file descriptor")) - 'B','a','d',' ','f','i','l','e',' ','d','e','s','c','r','i','p','t','o','r','\0', - /* 9. [236]+11 BADMSG */ a_X(N_("Bad message")) - 'B','a','d',' ','m','e','s','s','a','g','e','\0', - /* 10. [248]+11 BUSY */ a_X(N_("Device busy")) - 'D','e','v','i','c','e',' ','b','u','s','y','\0', - /* 11. [260]+18 CANCELED */ a_X(N_("Operation canceled")) - 'O','p','e','r','a','t','i','o','n',' ','c','a','n','c','e','l','e','d','\0', - /* 12. [279]+18 CHILD */ a_X(N_("No child processes")) - 'N','o',' ','c','h','i','l','d',' ','p','r','o','c','e','s','s','e','s','\0', - /* 13. [298]+32 CONNABORTED */ a_X(N_("Software caused connection abort")) - 'S','o','f','t','w','a','r','e',' ','c','a','u','s','e','d',' ','c','o','n','n','e','c','t','i','o','n',' ','a','b','o','r','t','\0', - /* 14. [331]+18 CONNREFUSED */ a_X(N_("Connection refused")) - 'C','o','n','n','e','c','t','i','o','n',' ','r','e','f','u','s','e','d','\0', - /* 15. [350]+24 CONNRESET */ a_X(N_("Connection reset by peer")) - 'C','o','n','n','e','c','t','i','o','n',' ','r','e','s','e','t',' ','b','y',' ','p','e','e','r','\0', - /* 16. [375]+25 DEADLK */ a_X(N_("Resource deadlock avoided")) - 'R','e','s','o','u','r','c','e',' ','d','e','a','d','l','o','c','k',' ','a','v','o','i','d','e','d','\0', - /* 17. [401]+28 DESTADDRREQ */ a_X(N_("Destination address required")) - 'D','e','s','t','i','n','a','t','i','o','n',' ','a','d','d','r','e','s','s',' ','r','e','q','u','i','r','e','d','\0', - /* 18. [430]+32 DOM */ a_X(N_("Numerical argument out of domain")) - 'N','u','m','e','r','i','c','a','l',' ','a','r','g','u','m','e','n','t',' ','o','u','t',' ','o','f',' ','d','o','m','a','i','n','\0', - /* 19. [463]+19 DQUOT */ a_X(N_("Disc quota exceeded")) - 'D','i','s','c',' ','q','u','o','t','a',' ','e','x','c','e','e','d','e','d','\0', - /* 20. [483]+11 EXIST */ a_X(N_("File exists")) - 'F','i','l','e',' ','e','x','i','s','t','s','\0', - /* 21. [495]+11 FAULT */ a_X(N_("Bad address")) - 'B','a','d',' ','a','d','d','r','e','s','s','\0', - /* 22. [507]+14 FBIG */ a_X(N_("File too large")) - 'F','i','l','e',' ','t','o','o',' ','l','a','r','g','e','\0', - /* 23. [522]+16 HOSTUNREACH */ a_X(N_("No route to host")) - 'N','o',' ','r','o','u','t','e',' ','t','o',' ','h','o','s','t','\0', - /* 24. [539]+18 IDRM */ a_X(N_("Identifier removed")) - 'I','d','e','n','t','i','f','i','e','r',' ','r','e','m','o','v','e','d','\0', - /* 25. [558]+21 ILSEQ */ a_X(N_("Illegal byte sequence")) - 'I','l','l','e','g','a','l',' ','b','y','t','e',' ','s','e','q','u','e','n','c','e','\0', - /* 26. [580]+25 INPROGRESS */ a_X(N_("Operation now in progress")) - 'O','p','e','r','a','t','i','o','n',' ','n','o','w',' ','i','n',' ','p','r','o','g','r','e','s','s','\0', - /* 27. [606]+23 INTR */ a_X(N_("Interrupted system call")) - 'I','n','t','e','r','r','u','p','t','e','d',' ','s','y','s','t','e','m',' ','c','a','l','l','\0', - /* 28. [630]+16 INVAL */ a_X(N_("Invalid argument")) - 'I','n','v','a','l','i','d',' ','a','r','g','u','m','e','n','t','\0', - /* 29. [647]+18 IO */ a_X(N_("Input/output error")) - 'I','n','p','u','t','/','o','u','t','p','u','t',' ','e','r','r','o','r','\0', - /* 30. [666]+27 ISCONN */ a_X(N_("Socket is already connected")) - 'S','o','c','k','e','t',' ','i','s',' ','a','l','r','e','a','d','y',' ','c','o','n','n','e','c','t','e','d','\0', - /* 31. [694]+14 ISDIR */ a_X(N_("Is a directory")) - 'I','s',' ','a',' ','d','i','r','e','c','t','o','r','y','\0', - /* 32. [709]+33 LOOP */ a_X(N_("Too many levels of symbolic links")) - 'T','o','o',' ','m','a','n','y',' ','l','e','v','e','l','s',' ','o','f',' ','s','y','m','b','o','l','i','c',' ','l','i','n','k','s','\0', - /* 33. [743]+19 MFILE */ a_X(N_("Too many open files")) - 'T','o','o',' ','m','a','n','y',' ','o','p','e','n',' ','f','i','l','e','s','\0', - /* 34. [763]+14 MLINK */ a_X(N_("Too many links")) - 'T','o','o',' ','m','a','n','y',' ','l','i','n','k','s','\0', - /* 35. [778]+16 MSGSIZE */ a_X(N_("Message too long")) - 'M','e','s','s','a','g','e',' ','t','o','o',' ','l','o','n','g','\0', - /* 36. [795]+18 MULTIHOP */ a_X(N_("Multihop attempted")) - 'M','u','l','t','i','h','o','p',' ','a','t','t','e','m','p','t','e','d','\0', - /* 37. [814]+18 NAMETOOLONG */ a_X(N_("File name too long")) - 'F','i','l','e',' ','n','a','m','e',' ','t','o','o',' ','l','o','n','g','\0', - /* 38. [833]+15 NETDOWN */ a_X(N_("Network is down")) - 'N','e','t','w','o','r','k',' ','i','s',' ','d','o','w','n','\0', - /* 39. [849]+35 NETRESET */ a_X(N_("Network dropped connection on reset")) - 'N','e','t','w','o','r','k',' ','d','r','o','p','p','e','d',' ','c','o','n','n','e','c','t','i','o','n',' ','o','n',' ','r','e','s','e','t','\0', - /* 40. [885]+22 NETUNREACH */ a_X(N_("Network is unreachable")) - 'N','e','t','w','o','r','k',' ','i','s',' ','u','n','r','e','a','c','h','a','b','l','e','\0', - /* 41. [908]+29 NFILE */ a_X(N_("Too many open files in system")) - 'T','o','o',' ','m','a','n','y',' ','o','p','e','n',' ','f','i','l','e','s',' ','i','n',' ','s','y','s','t','e','m','\0', - /* 42. [938]+25 NOBUFS */ a_X(N_("No buffer space available")) - 'N','o',' ','b','u','f','f','e','r',' ','s','p','a','c','e',' ','a','v','a','i','l','a','b','l','e','\0', - /* 43. [964]+17 NODATA */ a_X(N_("No data available")) - 'N','o',' ','d','a','t','a',' ','a','v','a','i','l','a','b','l','e','\0', - /* 44. [982]+33 NODEV */ a_X(N_("Operation not supported by device")) - 'O','p','e','r','a','t','i','o','n',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d',' ','b','y',' ','d','e','v','i','c','e','\0', - /* 45. [1016]+32 NOENT */ a_X(N_("No such entry, file or directory")) - 'N','o',' ','s','u','c','h',' ','e','n','t','r','y',',',' ','f','i','l','e',' ','o','r',' ','d','i','r','e','c','t','o','r','y','\0', - /* 46. [1049]+17 NOEXEC */ a_X(N_("Exec format error")) - 'E','x','e','c',' ','f','o','r','m','a','t',' ','e','r','r','o','r','\0', - /* 47. [1067]+18 NOLCK */ a_X(N_("No locks available")) - 'N','o',' ','l','o','c','k','s',' ','a','v','a','i','l','a','b','l','e','\0', - /* 48. [1086]+21 NOLINK */ a_X(N_("Link has been severed")) - 'L','i','n','k',' ','h','a','s',' ','b','e','e','n',' ','s','e','v','e','r','e','d','\0', - /* 49. [1108]+22 NOMEM */ a_X(N_("Cannot allocate memory")) - 'C','a','n','n','o','t',' ','a','l','l','o','c','a','t','e',' ','m','e','m','o','r','y','\0', - /* 50. [1131]+26 NOMSG */ a_X(N_("No message of desired type")) - 'N','o',' ','m','e','s','s','a','g','e',' ','o','f',' ','d','e','s','i','r','e','d',' ','t','y','p','e','\0', - /* 51. [1158]+22 NOPROTOOPT */ a_X(N_("Protocol not available")) - 'P','r','o','t','o','c','o','l',' ','n','o','t',' ','a','v','a','i','l','a','b','l','e','\0', - /* 52. [1181]+23 NOSPC */ a_X(N_("No space left on device")) - 'N','o',' ','s','p','a','c','e',' ','l','e','f','t',' ','o','n',' ','d','e','v','i','c','e','\0', - /* 53. [1205]+23 NOSR */ a_X(N_("Out of streams resource")) - 'O','u','t',' ','o','f',' ','s','t','r','e','a','m','s',' ','r','e','s','o','u','r','c','e','\0', - /* 54. [1229]+19 NOSTR */ a_X(N_("Device not a stream")) - 'D','e','v','i','c','e',' ','n','o','t',' ','a',' ','s','t','r','e','a','m','\0', - /* 55. [1249]+24 NOSYS */ a_X(N_("Function not implemented")) - 'F','u','n','c','t','i','o','n',' ','n','o','t',' ','i','m','p','l','e','m','e','n','t','e','d','\0', - /* 56. [1274]+23 NOTCONN */ a_X(N_("Socket is not connected")) - 'S','o','c','k','e','t',' ','i','s',' ','n','o','t',' ','c','o','n','n','e','c','t','e','d','\0', - /* 57. [1298]+15 NOTDIR */ a_X(N_("Not a directory")) - 'N','o','t',' ','a',' ','d','i','r','e','c','t','o','r','y','\0', - /* 58. [1314]+19 NOTEMPTY */ a_X(N_("Directory not empty")) - 'D','i','r','e','c','t','o','r','y',' ','n','o','t',' ','e','m','p','t','y','\0', - /* 59. [1334]+36 NOTOBACCO */ a_X(N_("No tobacco, snorkeling on empty pipe")) - 'N','o',' ','t','o','b','a','c','c','o',',',' ','s','n','o','r','k','e','l','i','n','g',' ','o','n',' ','e','m','p','t','y',' ','p','i','p','e','\0', - /* 60. [1371]+30 NOTSOCK */ a_X(N_("Socket operation on non-socket")) - 'S','o','c','k','e','t',' ','o','p','e','r','a','t','i','o','n',' ','o','n',' ','n','o','n','-','s','o','c','k','e','t','\0', - /* 61. [1402]+23 NOTSUP */ a_X(N_("Operation not supported")) - 'O','p','e','r','a','t','i','o','n',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d','\0', - /* 62. [1426]+30 NOTTY */ a_X(N_("Inappropriate ioctl for device")) - 'I','n','a','p','p','r','o','p','r','i','a','t','e',' ','i','o','c','t','l',' ','f','o','r',' ','d','e','v','i','c','e','\0', - /* 63. [1457]+21 NXIO */ a_X(N_("Device not configured")) - 'D','e','v','i','c','e',' ','n','o','t',' ','c','o','n','f','i','g','u','r','e','d','\0', - /* 64. [1479]+23 OPNOTSUPP */ a_X(N_("Operation not supported")) - 'O','p','e','r','a','t','i','o','n',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d','\0', - /* 65. [1503]+41 OVERFLOW */ a_X(N_("Value too large to be stored in data type")) - 'V','a','l','u','e',' ','t','o','o',' ','l','a','r','g','e',' ','t','o',' ','b','e',' ','s','t','o','r','e','d',' ','i','n',' ','d','a','t','a',' ','t','y','p','e','\0', - /* 66. [1545]+23 PERM */ a_X(N_("Operation not permitted")) - 'O','p','e','r','a','t','i','o','n',' ','n','o','t',' ','p','e','r','m','i','t','t','e','d','\0', - /* 67. [1569]+11 PIPE */ a_X(N_("Broken pipe")) - 'B','r','o','k','e','n',' ','p','i','p','e','\0', - /* 68. [1581]+14 PROTO */ a_X(N_("Protocol error")) - 'P','r','o','t','o','c','o','l',' ','e','r','r','o','r','\0', - /* 69. [1596]+22 PROTONOSUPPORT */ a_X(N_("Protocol not supported")) - 'P','r','o','t','o','c','o','l',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d','\0', - /* 70. [1619]+30 PROTOTYPE */ a_X(N_("Protocol wrong type for socket")) - 'P','r','o','t','o','c','o','l',' ','w','r','o','n','g',' ','t','y','p','e',' ','f','o','r',' ','s','o','c','k','e','t','\0', - /* 71. [1650]+16 RANGE */ a_X(N_("Result too large")) - 'R','e','s','u','l','t',' ','t','o','o',' ','l','a','r','g','e','\0', - /* 72. [1667]+20 ROFS */ a_X(N_("Read-only filesystem")) - 'R','e','a','d','-','o','n','l','y',' ','f','i','l','e','s','y','s','t','e','m','\0', - /* 73. [1688]+12 SPIPE */ a_X(N_("Invalid seek")) - 'I','n','v','a','l','i','d',' ','s','e','e','k','\0', - /* 74. [1701]+15 SRCH */ a_X(N_("No such process")) - 'N','o',' ','s','u','c','h',' ','p','r','o','c','e','s','s','\0', - /* 75. [1717]+21 STALE */ a_X(N_("Stale NFS file handle")) - 'S','t','a','l','e',' ','N','F','S',' ','f','i','l','e',' ','h','a','n','d','l','e','\0', - /* 76. [1739]+13 TIME */ a_X(N_("Timer expired")) - 'T','i','m','e','r',' ','e','x','p','i','r','e','d','\0', - /* 77. [1753]+19 TIMEDOUT */ a_X(N_("Operation timed out")) - 'O','p','e','r','a','t','i','o','n',' ','t','i','m','e','d',' ','o','u','t','\0', - /* 78. [1773]+14 TXTBSY */ a_X(N_("Text file busy")) - 'T','e','x','t',' ','f','i','l','e',' ','b','u','s','y','\0', - /* 79. [1788]+21 WOULDBLOCK */ a_X(N_("Operation would block")) - 'O','p','e','r','a','t','i','o','n',' ','w','o','u','l','d',' ','b','l','o','c','k','\0', - /* 80. [1810]+17 XDEV */ a_X(N_("Cross-device link")) - 'C','r','o','s','s','-','d','e','v','i','c','e',' ','l','i','n','k','\0', -}; -# undef a_X -# endif /* su_HAVE_DOCSTRINGS */ - -# undef a_X -# ifndef __CREATE_ERRORS_SH -# define a_X(X) X -# else -# define a_X(X) 0 -# endif -static struct a_corerr_map const a_corerr_map[] = { - {233011709u, 0u, 0u, a_X(su_ERR_NONE)}, - {338119313u, 5u, 9u, a_X(su_ERR_2BIG)}, - {2760110381u, 10u, 32u, a_X(su_ERR_ACCES)}, - {3973621059u, 16u, 50u, a_X(su_ERR_ADDRINUSE)}, - {4228849030u, 26u, 73u, a_X(su_ERR_ADDRNOTAVAIL)}, - {1437911301u, 39u, 105u, a_X(su_ERR_AFNOSUPPORT)}, - {1876217389u, 51u, 153u, a_X(su_ERR_AGAIN)}, - {2638797879u, 57u, 186u, a_X(su_ERR_ALREADY)}, - {1628681718u, 65u, 216u, a_X(su_ERR_BADF)}, - {3563543249u, 70u, 236u, a_X(su_ERR_BADMSG)}, - {332518208u, 77u, 248u, a_X(su_ERR_BUSY)}, - {1622129131u, 82u, 260u, a_X(su_ERR_CANCELED)}, - {3508732648u, 91u, 279u, a_X(su_ERR_CHILD)}, - {3696001689u, 97u, 298u, a_X(su_ERR_CONNABORTED)}, - {1535510636u, 109u, 331u, a_X(su_ERR_CONNREFUSED)}, - {323416381u, 121u, 350u, a_X(su_ERR_CONNRESET)}, - {265908508u, 131u, 375u, a_X(su_ERR_DEADLK)}, - {1947834517u, 138u, 401u, a_X(su_ERR_DESTADDRREQ)}, - {689055206u, 150u, 430u, a_X(su_ERR_DOM)}, - {2103109256u, 154u, 463u, a_X(su_ERR_DQUOT)}, - {690634405u, 160u, 483u, a_X(su_ERR_EXIST)}, - {1325100503u, 166u, 495u, a_X(su_ERR_FAULT)}, - {191906582u, 172u, 507u, a_X(su_ERR_FBIG)}, - {3136618891u, 177u, 522u, a_X(su_ERR_HOSTUNREACH)}, - {597011636u, 189u, 539u, a_X(su_ERR_IDRM)}, - {3837265952u, 194u, 558u, a_X(su_ERR_ILSEQ)}, - {164315250u, 200u, 580u, a_X(su_ERR_INPROGRESS)}, - {295637505u, 211u, 606u, a_X(su_ERR_INTR)}, - {4001353557u, 216u, 630u, a_X(su_ERR_INVAL)}, - {1727311571u, 222u, 647u, a_X(su_ERR_IO)}, - {1873054828u, 225u, 666u, a_X(su_ERR_ISCONN)}, - {2112607642u, 232u, 694u, a_X(su_ERR_ISDIR)}, - {409311535u, 238u, 709u, a_X(su_ERR_LOOP)}, - {3633286620u, 243u, 743u, a_X(su_ERR_MFILE)}, - {2195249641u, 249u, 763u, a_X(su_ERR_MLINK)}, - {4096082673u, 255u, 778u, a_X(su_ERR_MSGSIZE)}, - {3526377641u, 263u, 795u, a_X(su_ERR_MULTIHOP)}, - {663564256u, 272u, 814u, a_X(su_ERR_NAMETOOLONG)}, - {2628143458u, 284u, 833u, a_X(su_ERR_NETDOWN)}, - {2913781409u, 292u, 849u, a_X(su_ERR_NETRESET)}, - {3902971798u, 301u, 885u, a_X(su_ERR_NETUNREACH)}, - {459859315u, 312u, 908u, a_X(su_ERR_NFILE)}, - {3446690680u, 318u, 938u, a_X(su_ERR_NOBUFS)}, - {4178159620u, 325u, 964u, a_X(su_ERR_NODATA)}, - {4238350791u, 332u, 982u, a_X(su_ERR_NODEV)}, - {1268523872u, 338u, 1016u, a_X(su_ERR_NOENT)}, - {2076180286u, 344u, 1049u, a_X(su_ERR_NOEXEC)}, - {1161014149u, 351u, 1067u, a_X(su_ERR_NOLCK)}, - {1880207780u, 357u, 1086u, a_X(su_ERR_NOLINK)}, - {2297471775u, 364u, 1108u, a_X(su_ERR_NOMEM)}, - {288687459u, 370u, 1131u, a_X(su_ERR_NOMSG)}, - {3588403549u, 376u, 1158u, a_X(su_ERR_NOPROTOOPT)}, - {2608265568u, 387u, 1181u, a_X(su_ERR_NOSPC)}, - {1014226748u, 393u, 1205u, a_X(su_ERR_NOSR)}, - {2306425920u, 398u, 1229u, a_X(su_ERR_NOSTR)}, - {2157612882u, 404u, 1249u, a_X(su_ERR_NOSYS)}, - {1106981846u, 410u, 1274u, a_X(su_ERR_NOTCONN)}, - {3361152810u, 418u, 1298u, a_X(su_ERR_NOTDIR)}, - {1159928508u, 425u, 1314u, a_X(su_ERR_NOTEMPTY)}, - {1391828806u, 434u, 1334u, a_X(su_ERR_NOTOBACCO)}, - {3263554828u, 444u, 1371u, a_X(su_ERR_NOTSOCK)}, - {151164965u, 452u, 1402u, a_X(su_ERR_NOTSUP)}, - {3870455042u, 459u, 1426u, a_X(su_ERR_NOTTY)}, - {273388482u, 465u, 1457u, a_X(su_ERR_NXIO)}, - {727228813u, 470u, 1479u, a_X(su_ERR_OPNOTSUPP)}, - {2142687439u, 480u, 1503u, a_X(su_ERR_OVERFLOW)}, - {1727042864u, 489u, 1545u, a_X(su_ERR_PERM)}, - {1752074821u, 494u, 1569u, a_X(su_ERR_PIPE)}, - {385670576u, 499u, 1581u, a_X(su_ERR_PROTO)}, - {3066850062u, 505u, 1596u, a_X(su_ERR_PROTONOSUPPORT)}, - {1908988597u, 520u, 1619u, a_X(su_ERR_PROTOTYPE)}, - {833145061u, 530u, 1650u, a_X(su_ERR_RANGE)}, - {2868169750u, 536u, 1667u, a_X(su_ERR_ROFS)}, - {2514504004u, 541u, 1688u, a_X(su_ERR_SPIPE)}, - {1572477186u, 547u, 1701u, a_X(su_ERR_SRCH)}, - {1954937632u, 552u, 1717u, a_X(su_ERR_STALE)}, - {3112234335u, 558u, 1739u, a_X(su_ERR_TIME)}, - {1794618926u, 563u, 1753u, a_X(su_ERR_TIMEDOUT)}, - {1586215649u, 572u, 1773u, a_X(su_ERR_TXTBSY)}, - {1014021045u, 579u, 1788u, a_X(su_ERR_WOULDBLOCK)}, - {1748691063u, 590u, 1810u, a_X(su_ERR_XDEV)}, -}; -# undef a_X -#endif /* su_SOURCE */ - -#ifdef su_SOURCE /* Lock-out compile-time-tools */ -# define a_CORERR_REV_ILL 81u -# define a_CORERR_REV_PRIME 149u -# define a_CORERR_REV_LONGEST 4u -# define a_CORERR_REV_WRAPAROUND 0 -static u8 const a_corerr_revmap[a_CORERR_REV_PRIME] = { - 81u, 70u, 6u, 81u, 63u, 36u, 45u, 52u, 81u, 81u, - 34u, 81u, 81u, 58u, 81u, 81u, 29u, 4u, 81u, 41u, - 1u, 68u, 81u, 81u, 48u, 74u, 81u, 81u, 81u, 81u, - 81u, 81u, 42u, 19u, 81u, 20u, 81u, 81u, 81u, 12u, - 47u, 81u, 32u, 64u, 51u, 81u, 81u, 81u, 44u, 27u, - 62u, 69u, 77u, 81u, 56u, 55u, 79u, 37u, 81u, 81u, - 81u, 72u, 5u, 67u, 81u, 81u, 81u, 81u, 81u, 13u, - 81u, 81u, 81u, 81u, 23u, 24u, 14u, 81u, 81u, 81u, - 60u, 81u, 57u, 81u, 81u, 81u, 81u, 18u, 54u, 40u, - 71u, 65u, 78u, 81u, 80u, 22u, 9u, 81u, 49u, 81u, - 81u, 81u, 81u, 11u, 38u, 66u, 3u, 81u, 50u, 43u, - 15u, 2u, 35u, 76u, 25u, 30u, 31u, 8u, 75u, 73u, - 81u, 81u, 81u, 10u, 81u, 81u, 81u, 81u, 16u, 28u, - 81u, 7u, 17u, 46u, 81u, 81u, 26u, 81u, 39u, 53u, - 59u, 81u, 81u, 33u, 21u, 0u, 61u, 81u, 81u -}; -#endif /* su_SOURCE */ +/*@ gen-errors.h, generated by su-make-errors.sh. + *@ See core-errors.c for more */ + +#ifdef su_SOURCE +static char const a_corerr_names[] = { +'N','O','N','E','\0', +'2','B','I','G','\0', +'A','C','C','E','S','\0', +'A','D','D','R','I','N','U','S','E','\0', +'A','D','D','R','N','O','T','A','V','A','I','L','\0', +'A','F','N','O','S','U','P','P','O','R','T','\0', +'A','G','A','I','N','\0', +'A','L','R','E','A','D','Y','\0', +'B','A','D','F','\0', +'B','A','D','M','S','G','\0', +'B','U','S','Y','\0', +'C','A','N','C','E','L','E','D','\0', +'C','H','I','L','D','\0', +'C','O','N','N','A','B','O','R','T','E','D','\0', +'C','O','N','N','R','E','F','U','S','E','D','\0', +'C','O','N','N','R','E','S','E','T','\0', +'D','E','A','D','L','K','\0', +'D','E','S','T','A','D','D','R','R','E','Q','\0', +'D','O','M','\0', +'D','Q','U','O','T','\0', +'E','X','I','S','T','\0', +'F','A','U','L','T','\0', +'F','B','I','G','\0', +'H','O','S','T','U','N','R','E','A','C','H','\0', +'I','D','R','M','\0', +'I','L','S','E','Q','\0', +'I','N','P','R','O','G','R','E','S','S','\0', +'I','N','T','R','\0', +'I','N','V','A','L','\0', +'I','O','\0', +'I','S','C','O','N','N','\0', +'I','S','D','I','R','\0', +'L','O','O','P','\0', +'M','F','I','L','E','\0', +'M','L','I','N','K','\0', +'M','S','G','S','I','Z','E','\0', +'M','U','L','T','I','H','O','P','\0', +'N','A','M','E','T','O','O','L','O','N','G','\0', +'N','E','T','D','O','W','N','\0', +'N','E','T','R','E','S','E','T','\0', +'N','E','T','U','N','R','E','A','C','H','\0', +'N','F','I','L','E','\0', +'N','O','B','U','F','S','\0', +'N','O','D','A','T','A','\0', +'N','O','D','E','V','\0', +'N','O','E','N','T','\0', +'N','O','E','X','E','C','\0', +'N','O','L','C','K','\0', +'N','O','L','I','N','K','\0', +'N','O','M','E','M','\0', +'N','O','M','S','G','\0', +'N','O','P','R','O','T','O','O','P','T','\0', +'N','O','S','P','C','\0', +'N','O','S','R','\0', +'N','O','S','T','R','\0', +'N','O','S','Y','S','\0', +'N','O','T','C','O','N','N','\0', +'N','O','T','D','I','R','\0', +'N','O','T','E','M','P','T','Y','\0', +'N','O','T','O','B','A','C','C','O','\0', +'N','O','T','S','O','C','K','\0', +'N','O','T','S','U','P','\0', +'N','O','T','T','Y','\0', +'N','X','I','O','\0', +'O','P','N','O','T','S','U','P','P','\0', +'O','V','E','R','F','L','O','W','\0', +'P','E','R','M','\0', +'P','I','P','E','\0', +'P','R','O','T','O','\0', +'P','R','O','T','O','N','O','S','U','P','P','O','R','T','\0', +'P','R','O','T','O','T','Y','P','E','\0', +'R','A','N','G','E','\0', +'R','O','F','S','\0', +'S','P','I','P','E','\0', +'S','R','C','H','\0', +'S','T','A','L','E','\0', +'T','I','M','E','\0', +'T','I','M','E','D','O','U','T','\0', +'T','X','T','B','S','Y','\0', +'W','O','U','L','D','B','L','O','C','K','\0', +'X','D','E','V','\0', +}; + +# ifdef su_HAVE_DOCSTRINGS +# undef a_X +# define a_X(X) +static char const a_corerr_docs[] = { +'N','o',' ','e','r','r','o','r','\0', +'A','r','g','u','m','e','n','t',' ','l','i','s','t',' ','t','o','o',' ','l','o','n','g','\0', +'P','e','r','m','i','s','s','i','o','n',' ','d','e','n','i','e','d','\0', +'A','d','d','r','e','s','s',' ','a','l','r','e','a','d','y',' ','i','n',' ','u','s','e','\0', +'C','a','n','n','o','t',' ','a','s','s','i','g','n',' ','r','e','q','u','e','s','t','e','d',' ','a','d','d','r','e','s','s','\0', +'A','d','d','r','e','s','s',' ','f','a','m','i','l','y',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d',' ','b','y',' ','p','r','o','t','o','c','o','l',' ','f','a','m','i','l','y','\0', +'R','e','s','o','u','r','c','e',' ','t','e','m','p','o','r','a','r','i','l','y',' ','u','n','a','v','a','i','l','a','b','l','e','\0', +'O','p','e','r','a','t','i','o','n',' ','a','l','r','e','a','d','y',' ','i','n',' ','p','r','o','g','r','e','s','s','\0', +'B','a','d',' ','f','i','l','e',' ','d','e','s','c','r','i','p','t','o','r','\0', +'B','a','d',' ','m','e','s','s','a','g','e','\0', +'D','e','v','i','c','e',' ','b','u','s','y','\0', +'O','p','e','r','a','t','i','o','n',' ','c','a','n','c','e','l','e','d','\0', +'N','o',' ','c','h','i','l','d',' ','p','r','o','c','e','s','s','e','s','\0', +'S','o','f','t','w','a','r','e',' ','c','a','u','s','e','d',' ','c','o','n','n','e','c','t','i','o','n',' ','a','b','o','r','t','\0', +'C','o','n','n','e','c','t','i','o','n',' ','r','e','f','u','s','e','d','\0', +'C','o','n','n','e','c','t','i','o','n',' ','r','e','s','e','t',' ','b','y',' ','p','e','e','r','\0', +'R','e','s','o','u','r','c','e',' ','d','e','a','d','l','o','c','k',' ','a','v','o','i','d','e','d','\0', +'D','e','s','t','i','n','a','t','i','o','n',' ','a','d','d','r','e','s','s',' ','r','e','q','u','i','r','e','d','\0', +'N','u','m','e','r','i','c','a','l',' ','a','r','g','u','m','e','n','t',' ','o','u','t',' ','o','f',' ','d','o','m','a','i','n','\0', +'D','i','s','c',' ','q','u','o','t','a',' ','e','x','c','e','e','d','e','d','\0', +'F','i','l','e',' ','e','x','i','s','t','s','\0', +'B','a','d',' ','a','d','d','r','e','s','s','\0', +'F','i','l','e',' ','t','o','o',' ','l','a','r','g','e','\0', +'N','o',' ','r','o','u','t','e',' ','t','o',' ','h','o','s','t','\0', +'I','d','e','n','t','i','f','i','e','r',' ','r','e','m','o','v','e','d','\0', +'I','l','l','e','g','a','l',' ','b','y','t','e',' ','s','e','q','u','e','n','c','e','\0', +'O','p','e','r','a','t','i','o','n',' ','n','o','w',' ','i','n',' ','p','r','o','g','r','e','s','s','\0', +'I','n','t','e','r','r','u','p','t','e','d',' ','s','y','s','t','e','m',' ','c','a','l','l','\0', +'I','n','v','a','l','i','d',' ','a','r','g','u','m','e','n','t','\0', +'I','n','p','u','t','/','o','u','t','p','u','t',' ','e','r','r','o','r','\0', +'S','o','c','k','e','t',' ','i','s',' ','a','l','r','e','a','d','y',' ','c','o','n','n','e','c','t','e','d','\0', +'I','s',' ','a',' ','d','i','r','e','c','t','o','r','y','\0', +'T','o','o',' ','m','a','n','y',' ','l','e','v','e','l','s',' ','o','f',' ','s','y','m','b','o','l','i','c',' ','l','i','n','k','s','\0', +'T','o','o',' ','m','a','n','y',' ','o','p','e','n',' ','f','i','l','e','s','\0', +'T','o','o',' ','m','a','n','y',' ','l','i','n','k','s','\0', +'M','e','s','s','a','g','e',' ','t','o','o',' ','l','o','n','g','\0', +'M','u','l','t','i','h','o','p',' ','a','t','t','e','m','p','t','e','d','\0', +'F','i','l','e',' ','n','a','m','e',' ','t','o','o',' ','l','o','n','g','\0', +'N','e','t','w','o','r','k',' ','i','s',' ','d','o','w','n','\0', +'N','e','t','w','o','r','k',' ','d','r','o','p','p','e','d',' ','c','o','n','n','e','c','t','i','o','n',' ','o','n',' ','r','e','s','e','t','\0', +'N','e','t','w','o','r','k',' ','i','s',' ','u','n','r','e','a','c','h','a','b','l','e','\0', +'T','o','o',' ','m','a','n','y',' ','o','p','e','n',' ','f','i','l','e','s',' ','i','n',' ','s','y','s','t','e','m','\0', +'N','o',' ','b','u','f','f','e','r',' ','s','p','a','c','e',' ','a','v','a','i','l','a','b','l','e','\0', +'N','o',' ','d','a','t','a',' ','a','v','a','i','l','a','b','l','e','\0', +'O','p','e','r','a','t','i','o','n',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d',' ','b','y',' ','d','e','v','i','c','e','\0', +'N','o',' ','s','u','c','h',' ','e','n','t','r','y',',',' ','f','i','l','e',' ','o','r',' ','d','i','r','e','c','t','o','r','y','\0', +'E','x','e','c',' ','f','o','r','m','a','t',' ','e','r','r','o','r','\0', +'N','o',' ','l','o','c','k','s',' ','a','v','a','i','l','a','b','l','e','\0', +'L','i','n','k',' ','h','a','s',' ','b','e','e','n',' ','s','e','v','e','r','e','d','\0', +'C','a','n','n','o','t',' ','a','l','l','o','c','a','t','e',' ','m','e','m','o','r','y','\0', +'N','o',' ','m','e','s','s','a','g','e',' ','o','f',' ','d','e','s','i','r','e','d',' ','t','y','p','e','\0', +'P','r','o','t','o','c','o','l',' ','n','o','t',' ','a','v','a','i','l','a','b','l','e','\0', +'N','o',' ','s','p','a','c','e',' ','l','e','f','t',' ','o','n',' ','d','e','v','i','c','e','\0', +'O','u','t',' ','o','f',' ','s','t','r','e','a','m','s',' ','r','e','s','o','u','r','c','e','\0', +'D','e','v','i','c','e',' ','n','o','t',' ','a',' ','s','t','r','e','a','m','\0', +'F','u','n','c','t','i','o','n',' ','n','o','t',' ','i','m','p','l','e','m','e','n','t','e','d','\0', +'S','o','c','k','e','t',' ','i','s',' ','n','o','t',' ','c','o','n','n','e','c','t','e','d','\0', +'N','o','t',' ','a',' ','d','i','r','e','c','t','o','r','y','\0', +'D','i','r','e','c','t','o','r','y',' ','n','o','t',' ','e','m','p','t','y','\0', +'N','o',' ','t','o','b','a','c','c','o',',',' ','s','n','o','r','k','e','l','i','n','g',' ','o','n',' ','e','m','p','t','y',' ','p','i','p','e','\0', +'S','o','c','k','e','t',' ','o','p','e','r','a','t','i','o','n',' ','o','n',' ','n','o','n','-','s','o','c','k','e','t','\0', +'O','p','e','r','a','t','i','o','n',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d','\0', +'I','n','a','p','p','r','o','p','r','i','a','t','e',' ','i','o','c','t','l',' ','f','o','r',' ','d','e','v','i','c','e','\0', +'D','e','v','i','c','e',' ','n','o','t',' ','c','o','n','f','i','g','u','r','e','d','\0', +'O','p','e','r','a','t','i','o','n',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d','\0', +'V','a','l','u','e',' ','t','o','o',' ','l','a','r','g','e',' ','t','o',' ','b','e',' ','s','t','o','r','e','d',' ','i','n',' ','d','a','t','a',' ','t','y','p','e','\0', +'O','p','e','r','a','t','i','o','n',' ','n','o','t',' ','p','e','r','m','i','t','t','e','d','\0', +'B','r','o','k','e','n',' ','p','i','p','e','\0', +'P','r','o','t','o','c','o','l',' ','e','r','r','o','r','\0', +'P','r','o','t','o','c','o','l',' ','n','o','t',' ','s','u','p','p','o','r','t','e','d','\0', +'P','r','o','t','o','c','o','l',' ','w','r','o','n','g',' ','t','y','p','e',' ','f','o','r',' ','s','o','c','k','e','t','\0', +'R','e','s','u','l','t',' ','t','o','o',' ','l','a','r','g','e','\0', +'R','e','a','d','-','o','n','l','y',' ','f','i','l','e','s','y','s','t','e','m','\0', +'I','n','v','a','l','i','d',' ','s','e','e','k','\0', +'N','o',' ','s','u','c','h',' ','p','r','o','c','e','s','s','\0', +'S','t','a','l','e',' ','N','F','S',' ','f','i','l','e',' ','h','a','n','d','l','e','\0', +'T','i','m','e','r',' ','e','x','p','i','r','e','d','\0', +'O','p','e','r','a','t','i','o','n',' ','t','i','m','e','d',' ','o','u','t','\0', +'T','e','x','t',' ','f','i','l','e',' ','b','u','s','y','\0', +'O','p','e','r','a','t','i','o','n',' ','w','o','u','l','d',' ','b','l','o','c','k','\0', +'C','r','o','s','s','-','d','e','v','i','c','e',' ','l','i','n','k','\0', +}; +# undef a_X +# endif /* su_HAVE_DOCSTRINGS */ + +# undef a_X +# ifndef __CREATE_ERRORS_SH +# define a_X(X) X +# else +# define a_X(X) 0 +# endif +static struct a_corerr_map const a_corerr_map[] = { +{233011709u, 0u, 0u, a_X(su_ERR_NONE)}, +{338119313u, 5u, 9u, a_X(su_ERR_2BIG)}, +{2760110381u, 10u, 32u, a_X(su_ERR_ACCES)}, +{3973621059u, 16u, 50u, a_X(su_ERR_ADDRINUSE)}, +{4228849030u, 26u, 73u, a_X(su_ERR_ADDRNOTAVAIL)}, +{1437911301u, 39u, 105u, a_X(su_ERR_AFNOSUPPORT)}, +{1876217389u, 51u, 153u, a_X(su_ERR_AGAIN)}, +{2638797879u, 57u, 186u, a_X(su_ERR_ALREADY)}, +{1628681718u, 65u, 216u, a_X(su_ERR_BADF)}, +{3563543249u, 70u, 236u, a_X(su_ERR_BADMSG)}, +{332518208u, 77u, 248u, a_X(su_ERR_BUSY)}, +{1622129131u, 82u, 260u, a_X(su_ERR_CANCELED)}, +{3508732648u, 91u, 279u, a_X(su_ERR_CHILD)}, +{3696001689u, 97u, 298u, a_X(su_ERR_CONNABORTED)}, +{1535510636u, 109u, 331u, a_X(su_ERR_CONNREFUSED)}, +{323416381u, 121u, 350u, a_X(su_ERR_CONNRESET)}, +{265908508u, 131u, 375u, a_X(su_ERR_DEADLK)}, +{1947834517u, 138u, 401u, a_X(su_ERR_DESTADDRREQ)}, +{689055206u, 150u, 430u, a_X(su_ERR_DOM)}, +{2103109256u, 154u, 463u, a_X(su_ERR_DQUOT)}, +{690634405u, 160u, 483u, a_X(su_ERR_EXIST)}, +{1325100503u, 166u, 495u, a_X(su_ERR_FAULT)}, +{191906582u, 172u, 507u, a_X(su_ERR_FBIG)}, +{3136618891u, 177u, 522u, a_X(su_ERR_HOSTUNREACH)}, +{597011636u, 189u, 539u, a_X(su_ERR_IDRM)}, +{3837265952u, 194u, 558u, a_X(su_ERR_ILSEQ)}, +{164315250u, 200u, 580u, a_X(su_ERR_INPROGRESS)}, +{295637505u, 211u, 606u, a_X(su_ERR_INTR)}, +{4001353557u, 216u, 630u, a_X(su_ERR_INVAL)}, +{1727311571u, 222u, 647u, a_X(su_ERR_IO)}, +{1873054828u, 225u, 666u, a_X(su_ERR_ISCONN)}, +{2112607642u, 232u, 694u, a_X(su_ERR_ISDIR)}, +{409311535u, 238u, 709u, a_X(su_ERR_LOOP)}, +{3633286620u, 243u, 743u, a_X(su_ERR_MFILE)}, +{2195249641u, 249u, 763u, a_X(su_ERR_MLINK)}, +{4096082673u, 255u, 778u, a_X(su_ERR_MSGSIZE)}, +{3526377641u, 263u, 795u, a_X(su_ERR_MULTIHOP)}, +{663564256u, 272u, 814u, a_X(su_ERR_NAMETOOLONG)}, +{2628143458u, 284u, 833u, a_X(su_ERR_NETDOWN)}, +{2913781409u, 292u, 849u, a_X(su_ERR_NETRESET)}, +{3902971798u, 301u, 885u, a_X(su_ERR_NETUNREACH)}, +{459859315u, 312u, 908u, a_X(su_ERR_NFILE)}, +{3446690680u, 318u, 938u, a_X(su_ERR_NOBUFS)}, +{4178159620u, 325u, 964u, a_X(su_ERR_NODATA)}, +{4238350791u, 332u, 982u, a_X(su_ERR_NODEV)}, +{1268523872u, 338u, 1016u, a_X(su_ERR_NOENT)}, +{2076180286u, 344u, 1049u, a_X(su_ERR_NOEXEC)}, +{1161014149u, 351u, 1067u, a_X(su_ERR_NOLCK)}, +{1880207780u, 357u, 1086u, a_X(su_ERR_NOLINK)}, +{2297471775u, 364u, 1108u, a_X(su_ERR_NOMEM)}, +{288687459u, 370u, 1131u, a_X(su_ERR_NOMSG)}, +{3588403549u, 376u, 1158u, a_X(su_ERR_NOPROTOOPT)}, +{2608265568u, 387u, 1181u, a_X(su_ERR_NOSPC)}, +{1014226748u, 393u, 1205u, a_X(su_ERR_NOSR)}, +{2306425920u, 398u, 1229u, a_X(su_ERR_NOSTR)}, +{2157612882u, 404u, 1249u, a_X(su_ERR_NOSYS)}, +{1106981846u, 410u, 1274u, a_X(su_ERR_NOTCONN)}, +{3361152810u, 418u, 1298u, a_X(su_ERR_NOTDIR)}, +{1159928508u, 425u, 1314u, a_X(su_ERR_NOTEMPTY)}, +{1391828806u, 434u, 1334u, a_X(su_ERR_NOTOBACCO)}, +{3263554828u, 444u, 1371u, a_X(su_ERR_NOTSOCK)}, +{151164965u, 452u, 1402u, a_X(su_ERR_NOTSUP)}, +{3870455042u, 459u, 1426u, a_X(su_ERR_NOTTY)}, +{273388482u, 465u, 1457u, a_X(su_ERR_NXIO)}, +{727228813u, 470u, 1479u, a_X(su_ERR_OPNOTSUPP)}, +{2142687439u, 480u, 1503u, a_X(su_ERR_OVERFLOW)}, +{1727042864u, 489u, 1545u, a_X(su_ERR_PERM)}, +{1752074821u, 494u, 1569u, a_X(su_ERR_PIPE)}, +{385670576u, 499u, 1581u, a_X(su_ERR_PROTO)}, +{3066850062u, 505u, 1596u, a_X(su_ERR_PROTONOSUPPORT)}, +{1908988597u, 520u, 1619u, a_X(su_ERR_PROTOTYPE)}, +{833145061u, 530u, 1650u, a_X(su_ERR_RANGE)}, +{2868169750u, 536u, 1667u, a_X(su_ERR_ROFS)}, +{2514504004u, 541u, 1688u, a_X(su_ERR_SPIPE)}, +{1572477186u, 547u, 1701u, a_X(su_ERR_SRCH)}, +{1954937632u, 552u, 1717u, a_X(su_ERR_STALE)}, +{3112234335u, 558u, 1739u, a_X(su_ERR_TIME)}, +{1794618926u, 563u, 1753u, a_X(su_ERR_TIMEDOUT)}, +{1586215649u, 572u, 1773u, a_X(su_ERR_TXTBSY)}, +{1014021045u, 579u, 1788u, a_X(su_ERR_WOULDBLOCK)}, +{1748691063u, 590u, 1810u, a_X(su_ERR_XDEV)}, +}; +# undef a_X +#endif /* su_SOURCE */ + +#ifdef su_SOURCE /* Lock-out compile-time-tools */ +# define a_CORERR_REV_ILL 81u +# define a_CORERR_REV_PRIME 149u +# define a_CORERR_REV_LONGEST 4u +# define a_CORERR_REV_WRAPAROUND 0 +static u8 const a_corerr_revmap[a_CORERR_REV_PRIME] = { +81u,70u,6u,81u,63u,36u,45u,52u,81u,81u, +34u,81u,81u,58u,81u,81u,29u,4u,81u,41u, +1u,68u,81u,81u,48u,74u,81u,81u,81u,81u, +81u,81u,42u,19u,81u,20u,81u,81u,81u,12u, +47u,81u,32u,64u,51u,81u,81u,81u,44u,27u, +62u,69u,77u,81u,56u,55u,79u,37u,81u,81u, +81u,72u,5u,67u,81u,81u,81u,81u,81u,13u, +81u,81u,81u,81u,23u,24u,14u,81u,81u,81u, +60u,81u,57u,81u,81u,81u,81u,18u,54u,40u, +71u,65u,78u,81u,80u,22u,9u,81u,49u,81u, +81u,81u,81u,11u,38u,66u,3u,81u,50u,43u, +15u,2u,35u,76u,25u,30u,31u,8u,75u,73u, +81u,81u,81u,10u,81u,81u,81u,81u,16u,28u, +81u,7u,17u,46u,81u,81u,26u,81u,39u,53u, +59u,81u,81u,33u,21u,0u,61u,81u,81u +}; +#endif /* su_SOURCE */ -- 2.11.4.GIT