Compiler implementation of the D programming language. Utility functions for DMD.
This modules defines some utility functions for DMD.
Normalize path by turning forward slashes into backslashes
const(char)* src
| Source path, using unix-style ('/') path separators |
Reads a file, terminate the program on error
Loc loc
| The line number information from where the call originates |
const(char)* filename
| Path to file |
Writes a file, terminate the program on error
Loc loc
| The line number information from where the call originates |
const(char)[] filename
| Path to file |
void[] data
| Full content of the file to be written |
Ensure the root path (the path minus the name) of the provided path exists, and terminate the process if it doesn't.
Loc loc
| The line number information from where the call originates |
const(char)[] name
| a path to check (the name is stripped) |
Takes a path, and escapes '(', ')' and backslashes
OutBuffer* buf
| Buffer to write the escaped path to |
const(char)* fname
| Path to escape |
Slices a \0
-terminated C-string, excluding the terminator
Compare two slices for equality, in a case-insensitive way
Comparison is based on char
and does not do decoding. As a result, it's only really accurate for plain ASCII strings.
const(char)[] s1
| string to compare |
const(char)[] s2
| string to compare |
true
if s1 == s2
regardless of caseCopy the content of src
into a C-string ('\0' terminated) then call dg
The intent of this function is to provide an allocation-less way to call a C function using a D slice. The function internally allocates a buffer if needed, but frees it on exit.
dg
is scope
. To keep the data around after dg
exits, one has to copy it. const(char)[] src
| Slice to use to call the C function |
dg | Delegate to call afterwards |
T
© 1999–2019 The D Language Foundation
Licensed under the Boost License 1.0.
https://dlang.org/phobos/dmd_utils.html