aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
AgeCommit message (Collapse)Author
2018-06-11Merge branch 'hasse/stdlib/pP_with_no_line_breaks/OTP-15103/ERL-607'Hans Bolinder
* hasse/stdlib/pP_with_no_line_breaks/OTP-15103/ERL-607: kernel: Use ~0p debugger: Use ~0p common_test: Use ~0p stdlib: Make pP insert no line breaks with field width zero
2018-06-08[logger] Change base OTP domain from [beam,erlang,otp] to [otp]Siri Hansen
2018-06-07stdlib: Move eval_str/1 from mod_esi to erl_evalHans Bolinder
See also https://bugs.erlang.org/browse/ERL-634. The utility program `erl_call' in erl_interface used to call lib:eval_str/1, which is no longer present in Erlang/OTP 21.0. The lib module was eliminated in OTP-15072, see also https://github.com/erlang/otp/pull/1786.
2018-06-07stdlib: Make pP insert no line breaks with field width zeroHans Bolinder
See also https://bugs.erlang.org/browse/ERL-607. A zero field width used to insert line breaks "everywhere", but with this patch no line breaks are inserted.
2018-06-05stdlib: Fix error reason for maps:with/withoutLukas Larsson
2018-06-05Merge branch 'dgud/stdlib/string-case-bin-bug'Dan Gudmundsson
* dgud/stdlib/string-case-bin-bug: Fix *case bugs for binaries
2018-06-04Merge branch 'hasse/dialyzer/improve_contract_warnings/OTP-14982'Hans Bolinder
* hasse/dialyzer/improve_contract_warnings/OTP-14982: erts: Improve contracts of zlib kernel: Improve contracts erts: Improve a contract stdlib: Improve a contract compiler: Improve a contract dialyzer: Refine the test for overspecified functions
2018-06-04Fix *case bugs for binariesDan Gudmundsson
Bad optimizing code introduced in 5c51e87bee9d
2018-06-04Merge branch 'lukas/stdlib/fix-io_o_request_raise/OTP-15101'Lukas Larsson
* lukas/stdlib/fix-io_o_request_raise/OTP-15101: stdlib: Fix io:put_chars/2 error
2018-05-30stdlib: Fix io:put_chars/2 errorLukas Larsson
Before this fix an error in io:put_chars/2 would signal a fault in io:put_chars/3 because of the way that raise is used and there is no such function.
2018-05-28stdlib: Improve a contractHans Bolinder
2018-05-23Merge branch 'ingela/gen-fsm-deprecation'Ingela Anderton Andin
* ingela/gen-fsm-deprecation: gen_fsm: should be deprecated eventually
2018-05-21Remove logger env vars for format_depth, max_size and utcSiri Hansen
These are replaced by new config handling and must not be used any more.
2018-05-21gen_fsm: should be deprecated eventuallyIngela Anderton Andin
2018-05-21Merge remote-tracking branch 'origin/ingela/ssl/deprecate-ssl-accept/OTP-15056'Ingela Anderton Andin
* origin/ingela/ssl/deprecate-ssl-accept/OTP-15056: ssl: Deprecate ssl:ssl_accept/[1,2,3]
2018-05-18ssl: Deprecate ssl:ssl_accept/[1,2,3]Ingela Anderton Andin
2018-05-18Merge branch 'sverker/ets-delete_all_objects-trap/OTP-15078'Sverker Eriksson
* sverker/ets-delete_all_objects-trap/OTP-15078: erts: Rename untrapping db_free_*empty*_table erts: Make ets:delete_all_objects yield on fixed table erts: Optimize ets delete all in fixed table erts: Refactor ets select iteration code erts: Cleanup ets code erts: Optimize ets hash object deallocactions erts: Refactor pseudo deleted ets objects erts: Make atomic ets:delete_all_objects yield erts: Fix reduction bump for ets:delete/1
2018-05-17Merge pull request #1810 from tomas-abrahamsson/bjorn/preprocessor-extensionsBjörn Gustavsson
Add ?OTP_RELEASE, -if and -elif to the preprocessor OTP-15087
2018-05-17Merge pull request #1817 from dgud/dgud/stdlib/string-opt-caseDan Gudmundsson
OTP-14988
2018-05-16Merge branch 'richcarl/eliminate_lib_module/PR-1786/OTP-15072'Hans Bolinder
* richcarl/eliminate_lib_module/PR-1786/OTP-15072: Fix minor issues Eliminate call to ct:get_progname() in ts_erl_config Use \n escape instead of integer 10 Move error formatting to erl_error.erl and delete lib.erl Move extended parse functions in lib.erl to erl_eval.erl Move lib:eval_str/1 into mod_esi.erl Remove lib:progname/0 Eliminate call to lib:progname/1 in slave.erl Add ct:get_progname/0 Remove lib:error_message/2 Remove lib:flush_receive/0 Remove lib:send/2 and lib:sendw/2 Move lib:nonl/1 into yecc.erl
2018-05-14Optimize string lowercase, uppercase and casefold for ASCII charactersDan Gudmundsson
2018-05-09Fix minor issuesRichard Carlsson
2018-05-09epp: Implement the -if and -elif preprocessor directivesBjörn Gustavsson
Libraries or applications that support more than one major release of OTP may need to use conditional compilation of Erlang source code. Here are few examples where it would be necessary or desirable: * To support a new data type or language feature only available in the latest major release (real-world examples: maps and the stacktrace syntax). * To avoid warnings for deprecated functions. * To avoid dialyzer warnings. Previously, to do conditional compilation, one would have to use a parse transform or some external tool such as 'autoconf'. To simplify conditional compilation, introduce the -if and -elif preprocessor directives, to allow code like this to be written: -if(?OTP_RELEASE =:= 21). %% Code that will only work in OTP 21. -else. %% Fallback code. -endif. What kind of expressions should be allowed after an -if? We certainly don't want to allow anything with a side effect, such as a '!' or a 'receive'. We also don't want it to be possible to call erlang:system_info/1, as that could make the code depedent on features of the run-time system that could change very easily (such as the number of schedulers). Requiring the expression to be a guard expression makes most sense. It is to explain in the documentation and easy for users to understand. For simplicity of implementation, only a single guard expression will be supported; that is, the ',' and ';' syntax for guards is not supported. To allow some useful conditions to be written, there is a special built-in function: defined(Symbol) tests whether the preprocessor symbol is defined, just like -ifdef. The reason for having this defined/1 is that the defined test can be combined with other tests, for example: 'defined(SOME_NAME) andalso ?OTP_RELEASE > 21'.
2018-05-08erts: Make atomic ets:delete_all_objects yieldSverker Eriksson
by using a cooperative strategy that will make any process accessing the table execute delelete_all_objects_continue until the table is empty. This is not an optimal solution as concurrent threads will still block on the table lock, but at least thread progress is made.
2018-05-08Merge pull request #1801 from dtip/update-global-name-specHans Bolinder
Update global name typespec
2018-05-07Merge pull request #1802 from michalmuskala/map-is-key-bifBjörn Gustavsson
Introduce is_map_key/2 guard BIF OTP-15037
2018-05-06epp: Add the pre-defined macro OTP_RELEASEBjörn Gustavsson
Add a new pre-defined macro called OTP_RELEASE that will expand to an integer being the OTP version. Thus, in OTP 19 the value will be the integer 19. The OTP_RELEASE macro is particularly useful in order to have different source code depending on new language features or new features in the type specification syntax. Those features are only introduced in major versions of OTP. To be truly useful, the -if preprocessor directive need to be implemented. That is the purpose of the next commit. Code that will need to work in both OTP 18 and OTP 19 can be structured in the following way: -ifdef(OTP_RELEASE). %% Code that only works in OTP 19 and later. -else. %% Code that will work in OTP 18. -endif.
2018-05-04Move error formatting to erl_error.erl and delete lib.erlRichard Carlsson
2018-05-04Move extended parse functions in lib.erl to erl_eval.erlRichard Carlsson
2018-05-04Move lib:eval_str/1 into mod_esi.erlRichard Carlsson
2018-05-04Remove lib:progname/0Richard Carlsson
2018-05-04Eliminate call to lib:progname/1 in slave.erlRichard Carlsson
2018-05-04Remove lib:error_message/2Richard Carlsson
2018-05-04Remove lib:flush_receive/0Richard Carlsson
2018-05-04Remove lib:send/2 and lib:sendw/2Richard Carlsson
2018-05-04Move lib:nonl/1 into yecc.erlRichard Carlsson
2018-04-29Introduce is_map_key/2 guard BIFMichał Muskała
This complements the `map_get/2` guard BIF introduced in #1784. Rationale. `map_get/2` allows accessing map fields in guards, but it might be problematic in more complex guard expressions, for example: foo(X) when map_get(a, X) =:= 1 or is_list(X) -> ... The `is_list/1` part of the guard could never succeed since the `map_get/2` guard would fail the whole guard expression. In this situation, this could be solved by using `;` instead of `or` to separate the guards, but it is not possible in every case. To solve this situation, this PR proposes a `is_map_key/2` guard that allows to check if a map has key inside a guard before trying to access that key. When combined with `is_map/1` this allows to construct a purely boolean guard expression testing a value of a key in a map. Implementation. Given the use case motivating the introduction of this function, the PR contains compiler optimisations that produce optimial code for the following guard expression: foo(X) when is_map(X) and is_map_key(a, X) and map_get(a, X) =:= 1 -> ok; foo(_) -> error. Given all three tests share the failure label, the `is_map_key/2` and `is_map/2` tests are optimised away. As with `map_get/2` the `is_map_key/2` BIF is allowed in match specs.
2018-04-27Update global name typespecDaniel Tipping
2018-04-27Merge branch 'siri/kernel/logger/OTP-13295'Siri Hansen
* siri/kernel/logger/OTP-13295: Add documentation of the built-in logger handlers Catch badarg in logger:get_format_depth/0 Add chars_limit option to logger_formatter Don't kill logger process until all other processes are dead Set call timeout for logger_server to infinity Update primary bootstrap Test cuddle for logger Update cth_log_redirect to a logger handler Start using logger internally in kernel and stdlib Remove error_logger process and add logger process Add logger
2018-04-27Merge branch 'hasse/stdlib/rfc3339_datetime/OTP-14764'Hans Bolinder
* hasse/stdlib/rfc3339_datetime/OTP-14764: stdlib: Add RFC 3339 functions to module calendar
2018-04-26Update appups in kernel, stdlib and sasl for OTP-21.0Siri Hansen
2018-04-26[stdlib/sys]: install one debug function more times (#1781)Pouriya
Allow installing multiple instances of sys debug function This commit solves a bug which allowed installing {Fun,State} as sys debug function even if Fun was already installed. This happened in the case when the current State of the debug fun was undefined. Also, the new format {Id,Fun,State} of debug functions can be installed, allowing multiple instances of the same fun.
2018-04-26Merge pull request #1759 from sunboshan/sys-fixSiri Hansen
[stdlib/sys.erl] Fix sys module's debug statistics not including the out message count when using gen_server:call/2. OTP-15047
2018-04-26stdlib: Add RFC 3339 functions to module calendarHans Bolinder
Functions for converting between RFC 3339 strings and system time are added. Options are lists, but we are considering using maps instead. If we change, it will happen after Erlang/OTP 21.0-rc1 is released.
2018-04-26Merge branch 'hasse/stdlib/calendar_systemtime/OTP-13413'Hans Bolinder
* hasse/stdlib/calendar_systemtime/OTP-13413: stdlib: Add system time functions to module calendar
2018-04-26Start using logger internally in kernel and stdlibSiri Hansen
2018-04-25stdlib: Modify the printing of map associations with wWpPHans Bolinder
Use the same depth for all (printed) elements of a map. Since the order of keys can vary when printing a map--maps:iterator/1 and maps:next/1 are used--it is more consistent to print all associations with the same depth. If the associations printed are limited by the depth, the selection of associations is arbitrary, as before.
2018-04-25stdlib: Introduce characters limit of formated stringsHans Bolinder
Inspiration from module lager_format. Also some improvements of Unicode handling. io_lib:format/3 and io_lib:fwrite/3 are new functions. The representation of the options is a list, but we are considering using a map instead. If we change, it will happen after Erlang/OTP 21.0-rc1 is released.
2018-04-25stdlib: Modify ~w/~W when number of characters is limitedHans Bolinder
A bug fix: limited maps end with "...", not "...=>...". A modification: wW separate pairs with " => ", not "=>". When the output is limited on number of characters, the term is balanced by wW the same way as is done with pP (see commit bc38638).
2018-04-25stdlib: io_lib{_pretty}: Avoid tuple_to_list when possibleHans Bolinder