Commit Graph

742 Commits (master)

Author SHA1 Message Date
Daniel Kolesa 4a992d64b5 move back to sane string range comparison operator defs 2018-01-06 01:17:18 +01:00
Daniel Kolesa 7912e699d5 remove char_traits usage 2018-01-06 01:08:19 +01:00
Daniel Kolesa fa5ae71202 perform validity check when decoding utf-32 into itself 2018-01-06 00:52:50 +01:00
Daniel Kolesa ed82fa0233 unified length handling for all encodings 2018-01-06 00:42:14 +01:00
Daniel Kolesa aeb5023b30 relax the rules of zero-argument utf::length 2018-01-06 00:27:04 +01:00
Daniel Kolesa e5162233d4 add missing inline 2018-01-06 00:17:47 +01:00
Daniel Kolesa 51d7a62bee eliminate -Wweak-vtables warnings 2018-01-05 22:48:38 +01:00
Daniel Kolesa 770ed476ca sink-writing decode 2018-01-05 22:16:18 +01:00
Daniel Kolesa 58ccfbe276 direct encoding funcs to u8/u16/uw from any other UTF 2018-01-05 21:49:00 +01:00
Daniel Kolesa daea42666e add range-based advancing encode funcs 2018-01-05 21:16:46 +01:00
Daniel Kolesa 61ed0ce71f printing of utf-16 and wide strings in format 2018-01-05 20:02:14 +01:00
Daniel Kolesa 200919d96f add funcs to deal with decoding/encoding of wchar_t values/sequences 2018-01-05 19:26:30 +01:00
Daniel Kolesa be25d42660 refactor unicode impl 2018-01-05 18:55:34 +01:00
Daniel Kolesa 44854072f7 prevent usage on potential broken platforms/toolchains 2018-01-05 03:05:17 +01:00
Daniel Kolesa d74736d8f4 add utf-16 decoding/encoding support 2018-01-05 02:18:36 +01:00
Daniel Kolesa 723c06c612 various warning fixes with -Weverything 2018-01-03 17:13:38 +01:00
Daniel Kolesa fd4b26046c noexcept the ctype funcs 2018-01-03 02:12:23 +01:00
Daniel Kolesa ad149ff0f6 unicode-aware case-insensitive string compares 2018-01-03 01:22:07 +01:00
Daniel Kolesa a0337c401e implement all the unicode ctype funcs, generate the tables 2018-01-02 22:23:18 +01:00
Daniel Kolesa 7c2bfa45df overload more Unicode stuff for UTF-32 slices 2018-01-02 00:30:58 +01:00
Daniel Kolesa dd2515de6c add a utility func to construct a container using a range 2018-01-01 21:06:25 +01:00
Daniel Kolesa b75f5f4881 implement utf-32 string printing in format 2018-01-01 20:59:39 +01:00
Daniel Kolesa c35f7377bf encode characters into utf-8 in format with our API 2018-01-01 03:11:00 +01:00
Daniel Kolesa 0857edfef4 add a function to encode utf-32 to utf-8 2018-01-01 01:02:49 +01:00
Daniel Kolesa 278b6a6269 define string ranges over wchar/char16/char32 2017-12-31 23:42:46 +01:00
Daniel Kolesa c4f67b08b9 rename codepoint to decode 2017-12-31 20:06:36 +01:00
Daniel Kolesa b350eced7e move utf::length wrappper to header 2017-12-31 19:18:08 +01:00
Daniel Kolesa 48a7b45115 remove unneeded forward decl 2017-12-31 19:17:02 +01:00
Daniel Kolesa 1a07db8bac merge utf impl bits into one place 2017-12-31 19:16:16 +01:00
Daniel Kolesa d3cdbe2fcf expose unicode stuff through string slices 2017-12-31 19:12:51 +01:00
Daniel Kolesa fb2f9e3b0e add support for printing unicode and wide characters 2017-12-31 15:32:33 +01:00
Daniel Kolesa b2ee5c1bd0 add iter_codes to iterate a UTF-8 string by code points 2017-12-31 14:50:48 +01:00
Daniel Kolesa d6a13d8f97 expose multibyte-to-codepoint conversion 2017-12-31 03:26:15 +01:00
Daniel Kolesa 3c75d7db98 add some initial code for upcoming unicode support 2017-12-31 03:01:25 +01:00
Daniel Kolesa f7929a1b45 ditch char_traits in string stuff 2017-12-15 23:32:06 +01:00
Daniel Kolesa 84fc2bc9c4 do not rely on global locale when converting in format 2017-11-13 17:15:30 +01:00
Daniel Kolesa e5a21382af much better integer formatting (less stack space, better precision handling) 2017-11-13 02:13:42 +01:00
Daniel Kolesa baf0dd4ca6 MB_CUR_MAX is not a constant 2017-11-12 20:25:58 +01:00
Daniel Kolesa db28b66892 workaround the awful bullshit when formatting numbers under locale
Because of the C++ locale APIs and libstdc++ being worthless trash,
we need to resort to this kind of nonsense in order to avoid
gibberish when dealing with grouping and decimal separators.

Libc++ gets this right (comes up with ASCII style representations
when requesting locale facets dealing with char type) but for some
dumb reason libstdc++ comes up with representations that are
garbage even when using a UTF-8 locale, so I guess we'll deal
with it this way for the time being...

That said, all of this code is probably broken on systems that
don't use Unicode and honestly I don't care.
2017-11-12 20:14:26 +01:00
Daniel Kolesa 84572dfd01 use C locale in I/O and format by default
Should probably get rid of state in locale-aware APIs, too.
2017-11-12 19:15:43 +01:00
Daniel Kolesa f882292f2a get rid of gcc specific workarounds 2017-11-10 20:19:25 +01:00
Daniel Kolesa 1893f4b941 gcc warning fix 2017-11-10 20:11:58 +01:00
Daniel Kolesa ec9ddb2aad yield current task in single-threaded coroutine scheduler on spawn
This schedules tasks more aggressively, letting side tasks always run.
2017-11-05 22:10:22 +01:00
Daniel Kolesa 67525af4e5 gcc/libstdc++ 7.x fixes 2017-11-03 12:56:34 +01:00
Daniel Kolesa 146da105b9 forward the writer out of get_line 2017-06-19 17:00:53 +02:00
Daniel Kolesa 2ce488002a use <> for includes everywhere 2017-06-19 16:59:36 +02:00
Daniel Kolesa 3034918496 move glob matching impl into a source file 2017-06-16 18:55:08 +02:00
Daniel Kolesa bee56e6a52 add glob example 2017-06-11 18:51:29 +02:00
Daniel Kolesa cca5952f93 fix the ** pattern not including itself's dir when used in dir position 2017-06-11 18:43:04 +02:00
Daniel Kolesa 511ea88161 proper handling of [!...] glob patterns 2017-06-11 18:17:44 +02:00
Daniel Kolesa 6b66e6ea69 document glob matching 2017-06-11 18:13:18 +02:00
Daniel Kolesa dd7f38d919 add char range glob pattern support 2017-06-11 00:02:16 +02:00
Daniel Kolesa 054f292393 avoid bad path formatting in a very ugly way 2017-06-10 21:17:58 +02:00
Daniel Kolesa 7ff454140a add api to check if filename matches glob pattern 2017-06-10 20:30:48 +02:00
Daniel Kolesa c9dafd1766 do not iterate non-directories 2017-06-10 20:26:34 +02:00
Daniel Kolesa 374194bba6 there is no need to match filename for ** 2017-06-10 20:10:56 +02:00
Daniel Kolesa eba541842c remove ordinary glob escaping (incompatible with windows, use [c]) 2017-06-10 19:18:24 +02:00
Daniel Kolesa a2f88815bf implement ? wildcard 2017-06-10 19:03:58 +02:00
Daniel Kolesa 009f36ba9f more glob fixes, also properly treat ** separately 2017-06-10 18:57:58 +02:00
Daniel Kolesa 5396f6b2a5 glob matching fixes 2017-06-10 18:21:11 +02:00
Daniel Kolesa 75b70e7227 initial basic glob matching support in filesystem.hh 2017-06-10 17:47:26 +02:00
Daniel Kolesa a414ec7544 better prepare for later wide-char argparse support 2017-06-05 18:57:40 +02:00
Daniel Kolesa 53f8a4e866 alias the argument value range 2017-06-04 15:34:46 +02:00
Daniel Kolesa 50692c3e29 remove the temp_cstr stuff 2017-06-02 18:33:56 +02:00
Daniel Kolesa 3df3ece0d2 add comparisons against standard strings 2017-06-01 21:50:31 +02:00
Daniel Kolesa a539d6c945 loosen up string range comparisons 2017-06-01 21:44:18 +02:00
Daniel Kolesa 7b05e3c648 mark argparse global funcs inline 2017-05-31 19:12:12 +02:00
Daniel Kolesa 460c288571 simplify arg_error 2017-05-29 17:53:59 +02:00
Daniel Kolesa 75c1c24a1c format_option cleanup 2017-05-28 16:20:34 +02:00
Daniel Kolesa e3acfa3005 move metavar fallback stuff into arg_optional 2017-05-28 16:16:13 +02:00
Daniel Kolesa e37a8e325e longest_name() on arg_optional 2017-05-28 16:12:05 +02:00
Daniel Kolesa fc490be718 remove get_ prefixes in argparse 2017-05-28 15:32:12 +02:00
Daniel Kolesa ded19b4234 support for required optional arguments + fix potential leak on error 2017-05-27 00:27:28 +02:00
Daniel Kolesa 73421a5902 add argparse examples 2017-05-26 22:00:51 +02:00
Daniel Kolesa 661b7b94cc reset optionals/positionals on new parse 2017-05-26 21:29:03 +02:00
Daniel Kolesa ad5429369b documentation for argparser 2017-05-26 21:20:53 +02:00
Daniel Kolesa 13736045d7 support for custom prefix characters 2017-05-26 18:10:04 +02:00
Daniel Kolesa 3dabe00469 remove the for_each_impl nonsense 2017-05-26 17:56:56 +02:00
Daniel Kolesa ecf00c4e00 remove useless arguments 2017-05-26 17:49:06 +02:00
Daniel Kolesa 84d60bd90e DRY 2017-05-26 01:04:51 +02:00
Daniel Kolesa aec6f4c172 display positional args first in groups in help listing 2017-05-26 00:54:44 +02:00
Daniel Kolesa 57e81555e9 get rid of iter() on desc container 2017-05-26 00:46:38 +02:00
Daniel Kolesa 4a1a064316 allow not iterating groups in for_each 2017-05-26 00:41:02 +02:00
Daniel Kolesa 1b7d01aad2 more cleanups 2017-05-25 19:28:12 +02:00
Daniel Kolesa 01679ed9be derive arg_group from arg_description_container 2017-05-25 19:25:06 +02:00
Daniel Kolesa 8391b03b37 support for positional and mutually exclusive args in groups 2017-05-25 19:17:42 +02:00
Daniel Kolesa 32197f600c remove iter() in groups 2017-05-25 19:01:52 +02:00
Daniel Kolesa 3b9a1b3384 add for_each on each type that will recursively iterate into groups 2017-05-25 18:44:33 +02:00
Daniel Kolesa c704813423 help fix 2017-05-24 22:10:20 +02:00
Daniel Kolesa 0e9deab322 initial support for mutually exclusive argument groups 2017-05-23 18:07:34 +02:00
Daniel Kolesa b0fa895a49 better handling of arg_value::REST 2017-05-22 18:32:18 +02:00
Daniel Kolesa d8aee86526 use positional arg to specify build target 2017-05-21 19:35:32 +02:00
Daniel Kolesa f3e367aff8 implement mandatory positional arguments 2017-05-21 19:10:14 +02:00
Daniel Kolesa 15d057b226 help printing for optional argument groups 2017-05-21 16:04:40 +02:00
Daniel Kolesa bf72ba0542 initial support for optional argument groups 2017-05-21 15:52:53 +02:00
Daniel Kolesa 42edcf1e94 more flexible arg finding mechanism 2017-05-21 15:40:52 +02:00
Daniel Kolesa 61fcdd4144 find_arg cleanup 2017-05-21 15:08:23 +02:00
Daniel Kolesa d1fbf02c42 add positional arg parsing 2017-05-21 02:55:25 +02:00
Daniel Kolesa 94605330fc support for several values passed to optional args 2017-05-20 16:32:50 +02:00
Daniel Kolesa 708aee4c44 do not return out of cb 2017-05-20 01:39:54 +02:00
Daniel Kolesa a84c1e5d84 add option to use posixly correct argument ordering 2017-05-20 01:38:04 +02:00
Daniel Kolesa bff30e3eb2 better handling of optional values for optional args 2017-05-20 01:32:53 +02:00
Daniel Kolesa e09caf37c8 simplify argparsing logic a bit 2017-05-20 01:22:19 +02:00
Daniel Kolesa 7fee6b7b05 add arg_store_format 2017-05-19 01:38:34 +02:00
Daniel Kolesa f35ebe6122 add argument usage limit feature 2017-05-18 03:54:27 +02:00
Daniel Kolesa 117a34b855 make sure the value requirement is always correct for optionals 2017-05-18 03:45:41 +02:00
Daniel Kolesa c8a22ab3a0 more helpful help formatting 2017-05-17 20:56:01 +02:00
Daniel Kolesa 4ac173901a remove unnecessary friend decls in argparse 2017-05-17 20:07:25 +02:00
Daniel Kolesa 43a0422786 make used a counter, not a bool 2017-05-17 00:38:12 +02:00
Daniel Kolesa 66e6f9d146 separate help formatting into its own structure 2017-05-16 19:49:18 +02:00
Daniel Kolesa d1ad559461 argparse parsing cleanup and nicer api 2017-05-16 19:25:20 +02:00
Daniel Kolesa ff4620d3f5 move the arg storage into its own container 2017-05-16 01:37:29 +02:00
Daniel Kolesa 65087c8e36 more reliable add_optional/positional/category (allow narrowing etc) 2017-05-16 01:32:18 +02:00
Daniel Kolesa 0ee5404612 always store values externally 2017-05-16 00:22:46 +02:00
Daniel Kolesa 061d988ef2 expand argparse storage options, add defaults, add outside storage 2017-05-16 00:06:16 +02:00
Daniel Kolesa 8ba1c83609 predefined funcs for common argparse actions 2017-05-15 21:10:41 +02:00
Daniel Kolesa ec426a30a1 argparse: action callback support, help string support 2017-05-15 19:55:26 +02:00
Daniel Kolesa 5373e3405c support for argparse action callbacks and value retrieval 2017-05-15 19:18:25 +02:00
Daniel Kolesa 922da4a808 split up arg classes better 2017-05-15 18:49:59 +02:00
Daniel Kolesa d1b69963cb basic help printing for argparse and other improvements 2017-05-14 16:24:19 +02:00
Daniel Kolesa c19d45b21a add initial skeleton for argument parser 2017-05-13 22:24:26 +02:00
Daniel Kolesa 45c8450209 envvar support in subprocess 2017-05-13 18:36:40 +02:00
Daniel Kolesa 2fc506d1bb fewer temporary allocations in subprocess 2017-05-13 17:02:39 +02:00
Daniel Kolesa 06687881c1 implement subprocess detach and validity checks 2017-05-13 00:00:44 +02:00
Daniel Kolesa 0925ff3350 clean up platform checks 2017-05-12 00:05:18 +02:00
Daniel Kolesa 005485f6a6 rename to subprocess_stream/error 2017-05-11 23:57:04 +02:00
Daniel Kolesa 5fc674e4d3 allow split_args to take a lambda 2017-05-11 23:49:51 +02:00
Daniel Kolesa d4edafa350 ref-qualified appender get() method 2017-05-11 23:31:15 +02:00
Daniel Kolesa cc18d2b736 add subprocess constructors that open as part of the construction 2017-05-11 19:36:17 +02:00
Daniel Kolesa 10caf39244 split win32 and posix code of context_stack and process into separate files 2017-05-10 00:30:23 +02:00
Daniel Kolesa 469c85639a some more platform checks 2017-05-10 00:02:37 +02:00
Daniel Kolesa 9e429189d7 more foolproof subprocess interface 2017-05-09 23:58:20 +02:00
Daniel Kolesa af951a243c use strings for subprocess errors 2017-05-09 20:33:45 +02:00
Daniel Kolesa 6b228ee6a8 documentation for subprocess 2017-05-08 21:23:15 +02:00
Daniel Kolesa ea7f4062b7 hide platform-specific data from subprocess 2017-05-08 20:32:36 +02:00
Daniel Kolesa 4966830d33 rename process_info to subprocess 2017-05-08 18:42:30 +02:00
Daniel Kolesa 4022897195 make sure process exec never leaks file descriptors 2017-05-08 17:10:09 +02:00
Daniel Kolesa ce1b94624a rename process_pipe 2017-05-08 04:13:07 +02:00
Daniel Kolesa 61fcfeee2e slight process api cleanup 2017-05-08 04:09:47 +02:00
Daniel Kolesa 1ecf921f1a initial impl of process calling api (posix only atm) 2017-05-08 03:51:45 +02:00
Daniel Kolesa 44d370183c custom close func support for filestreams 2017-05-08 01:07:32 +02:00
Daniel Kolesa f01992c952 add command line splitting api (posix, windows) and use it from build 2017-05-07 21:17:13 +02:00
Daniel Kolesa a191164700 make global constexpr variables inline 2017-05-06 15:09:44 +02:00
Daniel Kolesa fc6935151d more build cleanups and emplace for channels 2017-05-05 02:00:47 +02:00
Daniel Kolesa 9be0ad2a0e simplify example a bit more 2017-05-03 02:31:26 +02:00
Daniel Kolesa d6a2a3f07c include all examples in generated docs 2017-05-03 02:14:27 +02:00
Daniel Kolesa 0ae9838b83 doc fix 2017-05-03 01:52:28 +02:00
Daniel Kolesa 9f593eebd1 tids are non-copyable, only movable 2017-05-02 23:49:56 +02:00
Daniel Kolesa 2c62b82ec4 future-like objects representing tasks in concurrency 2017-05-02 21:42:31 +02:00
Daniel Kolesa 94814dc61e remove internal/win32.hh and put environ stuff into a source file 2017-05-02 00:15:01 +02:00