Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:31:42

0001 // Copyright 2024 The Abseil Authors
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //     https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 
0015 #ifndef ABSL_DEBUGGING_INTERNAL_DECODE_RUST_PUNYCODE_H_
0016 #define ABSL_DEBUGGING_INTERNAL_DECODE_RUST_PUNYCODE_H_
0017 
0018 #include "absl/base/config.h"
0019 #include "absl/base/nullability.h"
0020 
0021 namespace absl {
0022 ABSL_NAMESPACE_BEGIN
0023 namespace debugging_internal {
0024 
0025 struct DecodeRustPunycodeOptions {
0026   const char* punycode_begin;
0027   const char* punycode_end;
0028   char* out_begin;
0029   char* out_end;
0030 };
0031 
0032 // Given Rust Punycode in `punycode_begin .. punycode_end`, writes the
0033 // corresponding UTF-8 plaintext into `out_begin .. out_end`, followed by a NUL
0034 // character, and returns a pointer to that final NUL on success.  On failure
0035 // returns a null pointer, and the contents of `out_begin .. out_end` are
0036 // unspecified.
0037 //
0038 // Failure occurs in precisely these cases:
0039 //   - Any input byte does not match [0-9a-zA-Z_].
0040 //   - The first input byte is an underscore, but no other underscore appears in
0041 //     the input.
0042 //   - The delta sequence does not represent a valid sequence of code-point
0043 //     insertions.
0044 //   - The plaintext would contain more than 256 code points.
0045 //
0046 // DecodeRustPunycode is async-signal-safe with bounded runtime and a small
0047 // stack footprint, making it suitable for use in demangling Rust symbol names
0048 // from a signal handler.
0049 absl::Nullable<char*> DecodeRustPunycode(DecodeRustPunycodeOptions options);
0050 
0051 }  // namespace debugging_internal
0052 ABSL_NAMESPACE_END
0053 }  // namespace absl
0054 
0055 #endif  // ABSL_DEBUGGING_INTERNAL_DECODE_RUST_PUNYCODE_H_