lean4-htt/src/runtime
Leonardo de Moura 13c532d0d4 fix(*): truncation bugs
- Lean strings (like std::string) may contain null characters. The
  codebase was ignoring this issue.

- We now have a wrapper `string_ref` for wrapping Lean string objects in
  C++. This wrapper also implements correctly the coercions std::string <-> string_ref.
  Remark: I also found a few places where the code relies on the
  following property which is not true
  Forall s : std::string, std::string(s.c_str()) == s

- `name` object wrapper was assuming that all numerals were small
  `nat` values. This is true in most cases, but the system would
  crash when processing if it is a big number.

- The commit tries to make sure runtime/util/kernel are correct.
  Modules that will be deleted contain many `TODO` comments
  indicating they may crash and/or produce incorrect results
  when strings contain null characters and numerals are big.

cc @kha

@kha: I thought about using `string` instead of `string_ref`.
We consistently use `std::string`. So, it should be fine, but I
was concerned about code readability.

After we bootstrap Lean4, we will be able to delete `lean::list`
template, and rename `lean::list_ref` to `lean::list`.

I am going to add `pair_ref` for wrapping Lean pair objects.
If we use `lean::string` instead of `lean::string_ref`, then
we should also use `lean::pair` instead of `lean::pair_ref`.
But, there is a problem in this case since we have
https://github.com/leanprover/lean4/blob/master/src/util/pair.h#L13
:(
2018-06-15 16:05:11 -07:00
..
apply.cpp chore(runtime/lean_obj): remove lean_ prefix 2018-05-20 10:13:44 -07:00
apply.h chore(runtime): lean_obj.* ==> object.* 2018-05-20 10:17:15 -07:00
CMakeLists.txt chore(runtime): lean_obj.* ==> object.* 2018-05-20 10:17:15 -07:00
compiler_hints.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
debug.cpp refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
debug.h refactor(*): use C++11 std::current_exception and std::rethrow_exception 2018-06-07 16:28:54 -07:00
exception.cpp refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
exception.h refactor(*): use C++11 std::current_exception and std::rethrow_exception 2018-06-07 16:28:54 -07:00
extensible_object.h feat(runtime): add object serializer 2018-05-22 16:34:41 -07:00
flet.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
init_module.cpp fix(runtime): add init_module 2018-05-14 20:38:21 -07:00
init_module.h fix(runtime): add init_module 2018-05-14 20:38:21 -07:00
int64.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
interrupt.cpp refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
interrupt.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
memory.cpp refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
memory.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
mpq.cpp refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
mpq.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
mpz.cpp chore(*): remove redundant code 2018-05-22 16:46:04 -07:00
mpz.h chore(*): remove redundant code 2018-05-22 16:46:04 -07:00
object.cpp fix(*): truncation bugs 2018-06-15 16:05:11 -07:00
object.h fix(runtime,util,kernel): should not use strcmp to compare Lean string objects 2018-06-15 16:05:11 -07:00
optional.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
serializer.cpp fix(runtime,util,kernel): should not use strcmp to compare Lean string objects 2018-06-15 16:05:11 -07:00
serializer.h chore(runtime/serializer): compilation warning 2018-05-29 08:04:42 -07:00
sstream.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
stackinfo.cpp refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
stackinfo.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
thread.cpp refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
thread.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
utf8.cpp fix(*): truncation bugs 2018-06-15 16:05:11 -07:00
utf8.h fix(*): truncation bugs 2018-06-15 16:05:11 -07:00