|
Ninja
|
#include <stdint.h>#include <stdarg.h>#include <string>#include <vector>

Go to the source code of this file.
Macros | |
| #define | __has_cpp_attribute(x) 0 |
| #define | NINJA_FALLTHROUGH |
| #define | NORETURN |
Functions | |
| void | CanonicalizePath (char *path, size_t *len, uint64_t *slash_bits) |
| void | CanonicalizePath (std::string *path, uint64_t *slash_bits) |
| Canonicalize a path like "foo/../bar.h" into just "bar.h". More... | |
| void | Error (const char *msg, va_list ap) |
| void | Error (const char *msg,...) |
| Log an error message. More... | |
| NORETURN void | Fatal (const char *msg,...) |
| Log a fatal message and exit. More... | |
| double | GetLoadAverage () |
| int | GetProcessorCount () |
| void | GetShellEscapedString (const std::string &input, std::string *result) |
| Appends |input| to |*result|, escaping according to the whims of either Bash, or Win32's CommandLineToArgvW(). More... | |
| void | GetWin32EscapedString (const std::string &input, std::string *result) |
| std::string | GetWorkingDirectory () |
| a wrapper for getcwd() More... | |
| void | Info (const char *msg, va_list ap) |
| void | Info (const char *msg,...) |
| Log an informational message. More... | |
| bool | islatinalpha (int c) |
| int | platformAwareUnlink (const char *filename) |
| int | ReadFile (const std::string &path, std::string *contents, std::string *err) |
| Read a file to a string (in text mode: with CRLF conversion on Windows). More... | |
| void | SetCloseOnExec (int fd) |
| Mark a file descriptor to not be inherited on exec()s. More... | |
| const char * | SpellcheckString (const char *text,...) |
| Like SpellcheckStringV, but takes a NULL-terminated list. More... | |
| const char * | SpellcheckStringV (const std::string &text, const std::vector< const char * > &words) |
| Given a misspelled string and a list of correct spellings, returns the closest match or NULL if there is no close enough match. More... | |
| std::string | StripAnsiEscapeCodes (const std::string &in) |
| Removes all Ansi escape codes (http://www.termsys.demon.co.uk/vtansi.htm). More... | |
| bool | Truncate (const std::string &path, size_t size, std::string *err) |
| Truncates a file to the given size. More... | |
| void | Warning (const char *msg, va_list ap) |
| void | Warning (const char *msg,...) |
| Log a warning message. More... | |
| void CanonicalizePath | ( | char * | path, |
| size_t * | len, | ||
| uint64_t * | slash_bits | ||
| ) |
Definition at line 141 of file util.cc.
References IsPathSeparator(), and NINJA_FALLTHROUGH.
| void CanonicalizePath | ( | std::string * | path, |
| uint64_t * | slash_bits | ||
| ) |
Canonicalize a path like "foo/../bar.h" into just "bar.h".
|slash_bits| has bits set starting from lowest for a backslash that was normalized to a forward slash. (only used on Windows)
| void Error | ( | const char * | msg, |
| va_list | ap | ||
| ) |
Definition at line 98 of file util.cc.
Referenced by Cleaner::CleanRule(), Cleaner::CleanRules(), Cleaner::CleanTarget(), Cleaner::CleanTargets(), Error(), Cleaner::FileExists(), RealDiskInterface::MakeDir(), DiskInterface::MakeDirs(), Lexer::ReadEvalString(), RealDiskInterface::RemoveFile(), and RealDiskInterface::WriteFile().
| void Error | ( | const char * | msg, |
| ... | |||
| ) |
| NORETURN void Fatal | ( | const char * | msg, |
| ... | |||
| ) |
Log a fatal message and exit.
Definition at line 67 of file util.cc.
Referenced by CheckNinjaVersion(), ScopedTempDir::Cleanup(), ScopedTempDir::CreateAndEnter(), Builder::ExtractDeps(), StatusPrinter::FormatProgressStatus(), GetWorkingDirectory(), IncludesNormalize::IncludesNormalize(), EdgeEnv::LookupVariable(), main(), MSVCHelperMain(), Subprocess::OnPipeReady(), CLWrapper::Run(), Subprocess::Start(), SubprocessSet::SubprocessSet(), Subprocess::TryFinish(), and SubprocessSet::~SubprocessSet().
| double GetLoadAverage | ( | ) |
Definition at line 981 of file util.cc.
Referenced by RealCommandRunner::CanRunMore().
| int GetProcessorCount | ( | ) |
| void GetShellEscapedString | ( | const std::string & | input, |
| std::string * | result | ||
| ) |
Appends |input| to |*result|, escaping according to the whims of either Bash, or Win32's CommandLineToArgvW().
Appends the string directly to |result| without modification if we can determine that it contains no problematic characters.
| void GetWin32EscapedString | ( | const std::string & | input, |
| std::string * | result | ||
| ) |
| std::string GetWorkingDirectory | ( | ) |
| void Info | ( | const char * | msg, |
| va_list | ap | ||
| ) |
| void Info | ( | const char * | msg, |
| ... | |||
| ) |
| bool islatinalpha | ( | int | c | ) |
Definition at line 566 of file util.cc.
Referenced by StripAnsiEscapeCodes().
| int platformAwareUnlink | ( | const char * | filename | ) |
Definition at line 1025 of file util.cc.
Referenced by DepsLog::Load(), BuildLog::Load(), main(), BuildLog::Recompact(), DepsLog::Recompact(), BuildLog::Restat(), and ScopedFilePath::~ScopedFilePath().
| int ReadFile | ( | const std::string & | path, |
| std::string * | contents, | ||
| std::string * | err | ||
| ) |
Read a file to a string (in text mode: with CRLF conversion on Windows).
Returns -errno and fills in err on error.
| void SetCloseOnExec | ( | int | fd | ) |
Mark a file descriptor to not be inherited on exec()s.
Definition at line 480 of file util.cc.
Referenced by BuildLog::OpenForWriteIfNeeded(), DepsLog::OpenForWriteIfNeeded(), and Subprocess::Start().
| const char* SpellcheckString | ( | const char * | text, |
| ... | |||
| ) |
Like SpellcheckStringV, but takes a NULL-terminated list.
Definition at line 517 of file util.cc.
References SpellcheckStringV().
| const char* SpellcheckStringV | ( | const std::string & | text, |
| const std::vector< const char * > & | words | ||
| ) |
Given a misspelled string and a list of correct spellings, returns the closest match or NULL if there is no close enough match.
| std::string StripAnsiEscapeCodes | ( | const std::string & | in | ) |
Removes all Ansi escape codes (http://www.termsys.demon.co.uk/vtansi.htm).
| bool Truncate | ( | const std::string & | path, |
| size_t | size, | ||
| std::string * | err | ||
| ) |
Truncates a file to the given size.
| void Warning | ( | const char * | msg, |
| va_list | ap | ||
| ) |
Definition at line 85 of file util.cc.
Referenced by GraphViz::AddTarget(), CheckNinjaVersion(), ManifestParser::ParseEdge(), and Warning().