Re: [DTrace-devel] [PATCH v2 14/20] doc: Link to "Character Escape Sequences" table

Elena Zannoni
2025-10-23T19:32:31Z

Reviewed-by: Elena Zannoni <elena.zannoni@oracle.com>

On 10/21/25 9:22 PM, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> A link to this table did not work since it referenced an ID that did not
> exist. Add an anchor ID by the table and use it.
>
> While we're at it, convert the table from HTML to Markdown and break up
> some longer lines, improving readability and maintainability of the
> Markdown source file.
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
> ---
> ...dtrace-ref-TypesOperatorsandExpressions.md | 140 ++----------------
> .../dtrace_builtin_variable_reference.md | 11 +-
> 2 files changed, 20 insertions(+), 131 deletions(-)
>
> diff --git a/doc/userguide/reference/dtrace-ref-TypesOperatorsandExpressions.md b/doc/userguide/reference/dtrace-ref-TypesOperatorsandExpressions.md
> index c76d293c7..bb1c49949 100644
> --- a/doc/userguide/reference/dtrace-ref-TypesOperatorsandExpressions.md
> +++ b/doc/userguide/reference/dtrace-ref-TypesOperatorsandExpressions.md
> @@ -474,135 +474,18 @@ D type
>
> Character constants are written as a single character or escape sequence that's inside a pair of single quotes \(`'a'`\). Character constants are assigned the `int` type rather than `char` and are equivalent to an integer constant with a value that's determined by that character's value in the ASCII character set. See the `ascii(7)` manual page for a list of characters and their values. You can also use any of the special escape sequences that are listed in the following table. D uses the same escape sequences as those found in ANSI C.
>
> -
> -
> -Escape Sequence
> -
> -
> -
> -Represents
> -
> -
> -
> -Escape Sequence
> -
> -
> -
> -Represents
> -
> -
> -
> -`\a`
> -
> -
> -
> -alert
> -
> -
> -
> -`\\`
> -
> -
> -
> -backslash
> -
> -
> -
> -`\b`
> -
> -
> -
> -backspace
> -
> -
> -
> -`\?`
> -
> -
> -
> -question mark
> -
> -
> -
> -`\f`
> -
> -
> -
> -form feed
> -
> -
> -
> -`\'`
> -
> -
> -
> -single quote
> -
> -
> +**Table:** Character Escape Sequences
> +
> +| Escape Sequence | Represents | | Escape Sequence | Represents |
> +| :--- | :--- | --- | :--- | :--- |
> +| `\a` | alert | | `\\` | backslash |
> +| `\b` | backspace | | `\?` | question mark |
> +| `\f` | form feed | | `\'` | single quote |
> +| `\n` | newline | | `\"` | double quote |
> +| `\r` | carriage return | | `\0`*oo* | octal value 0*oo* |
> +| `\t` | horizontal tab | | `\x`*hh* | hexadecimal value 0x*hh* |
> +| `\v` | vertical tab | | `\0` | null character |
>
> -`\n`
> -
> -
> -
> -newline
> -
> -
> -
> -`\"`
> -
> -
> -
> -double quote
> -
> -
> -
> -`\r`
> -
> -
> -
> -carriage return
> -
> -
> -
> -`\0*oo*`
> -
> -
> -
> -octal value 0*oo*
> -
> -
> -
> -`\t`
> -
> -
> -
> -horizontal tab
> -
> -
> -
> -`\x*hh*`
> -
> -
> -
> -hexadecimal value 0x*hh*
> -
> -
> -
> -`\v`
> -
> -
> -
> -vertical tab
> -
> -
> -
> -`\0`
> -
> -
> -
> -null character
> -
> -
> You can include more than one character specifier inside single quotes to create integers with individual bytes that are initialized according to the corresponding character specifiers. The bytes are read left-to-right from a character constant and assigned to the resulting integer in the order corresponding to the native endianness of the operating environment. Up to eight character specifiers can be included in a single character constant.
>
> Strings constants of any length can be composed by enclosing them in a pair of double quotes \(`"hello"`\). A string constant can't contain a literal newline character. To create strings containing newlines, use the `\n` escape sequence instead of a literal newline. String constants can contain any of the special character escape sequences that are shown for character constants before. Similar to ANSI C, strings are represented as arrays of characters that end with a null character \(`\0`\) that's implicitly added to each string constant you declare. String constants are assigned the special D type `string`. The D compiler provides a set of special features for comparing and tracing character arrays that are declared as strings.
> @@ -1407,4 +1290,3 @@ The D type namespace is initially populated with the D type intrinsics, such as
> When the D compiler encounters a type declaration that doesn't specify an explicit namespace using the back quote operator, the compiler searches the set of active type namespaces to find a match by using the specified type name. The C namespace is always searched first, followed by the D namespace. If the type name isn't found in either the C or D namespace, the type namespaces of the active kernel modules are searched in load address order, which doesn't guarantee any ordering properties among the loadable modules. To avoid type name conflicts with other kernel modules, use the scoping operator when accessing types that are defined in loadable kernel modules.
>
> The D compiler uses the compressed ANSI C debugging information that's provided with the core Linux kernel modules to access the types that are associated with the OS source code, without the need to access the corresponding C include files. Note that this symbolic debugging information might not be available for all kernel modules on the system. The D compiler reports an error if you try to access a type within the namespace of a module that lacks the compressed C debugging information that's intended for use with DTrace.
> -
> diff --git a/doc/userguide/reference/dtrace_builtin_variable_reference.md b/doc/userguide/reference/dtrace_builtin_variable_reference.md
> index 787137929..aecd2308c 100644
> --- a/doc/userguide/reference/dtrace_builtin_variable_reference.md
> +++ b/doc/userguide/reference/dtrace_builtin_variable_reference.md
> @@ -221,7 +221,15 @@ The macro argument values must match the form of an integer, identifier, or stri
> sudo ./foo '"a string argument"'
> ```
>
> -If you want D macro arguments to be interpreted as string tokens, even if they match the form of an integer or identifier, prefix the macro variable or argument name with two leading dollar signs, for example, `$$1`, which forces the D compiler to interpret the argument value as if it were a string surrounded by double quotes. All the usual D string escape sequences, per [Table 5](dtrace-ref-TypesOperatorsandExpressions.md#dt_t6_dlang), are expanded inside any string macro arguments, regardless of whether they're referenced by using the `$arg` or `$$arg` form of the macro. If the `defaultargs` option is set, unspecified arguments that are referenced with the `$$arg` form have the value of the empty string \(`""`\).
> +If you want D macro arguments to be interpreted as string tokens,
> +even if they match the form of an integer or identifier,
> +prefix the macro variable or argument name with two leading dollar signs,
> +for example, `$$1`, which forces the D compiler to interpret the argument value as if it were a string surrounded by double quotes.
> +All the usual D string escape sequences, in the table of [Character Escape Sequences](dtrace-ref-TypesOperatorsandExpressions.md#char_esc_seqs),
> +are expanded inside any string macro arguments,
> +regardless of whether they're referenced by using the `$arg` or `$$arg` form of the macro.
> +If the `defaultargs` option is set,
> +unspecified arguments that are referenced with the `$$arg` form have the value of the empty string \(`""`\).
>
> ### Target Process ID
>
> @@ -474,4 +482,3 @@ int64_t walltimestamp
> ```
>
> The built-in variable `walltimestamp` references the current number of nanoseconds since 00:00 Universal Coordinated Time, January 1, 1970.
> -