e0050af293
pass --enable-timing-info to print a nice table like this: ``` Name Start End Duration Percent Initialize 0.0000 0.0000 0.0000 0.0001 Semantic Analysis 0.0000 0.0421 0.0420 0.2109 Code Generation 0.0421 0.0620 0.0200 0.1003 LLVM Emit Object 0.0620 0.1852 0.1231 0.6180 Build Dependencies 0.1852 0.1974 0.0122 0.0615 LLVM Link 0.1974 0.1993 0.0018 0.0093 Generate .h 0.1993 0.1993 0.0000 0.0000 Total 0.0000 0.1993 0.1993 1.0000 ```
78 lines
1.8 KiB
C++
78 lines
1.8 KiB
C++
/*
|
|
* Copyright (c) 2015 Andrew Kelley
|
|
*
|
|
* This file is part of zig, which is MIT licensed.
|
|
* See http://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#ifndef ZIG_OS_HPP
|
|
#define ZIG_OS_HPP
|
|
|
|
#include "list.hpp"
|
|
#include "buffer.hpp"
|
|
#include "error.hpp"
|
|
|
|
#include <stdio.h>
|
|
|
|
enum TerminationId {
|
|
TerminationIdClean,
|
|
TerminationIdSignaled,
|
|
TerminationIdStopped,
|
|
TerminationIdUnknown,
|
|
};
|
|
|
|
struct Termination {
|
|
TerminationId how;
|
|
int code;
|
|
};
|
|
|
|
|
|
void os_init(void);
|
|
void os_spawn_process(const char *exe, ZigList<const char *> &args, Termination *term);
|
|
int os_exec_process(const char *exe, ZigList<const char *> &args,
|
|
Termination *term, Buf *out_stderr, Buf *out_stdout);
|
|
|
|
void os_path_dirname(Buf *full_path, Buf *out_dirname);
|
|
void os_path_split(Buf *full_path, Buf *out_dirname, Buf *out_basename);
|
|
void os_path_extname(Buf *full_path, Buf *out_basename, Buf *out_extname);
|
|
void os_path_join(Buf *dirname, Buf *basename, Buf *out_full_path);
|
|
int os_path_real(Buf *rel_path, Buf *out_abs_path);
|
|
void os_path_resolve(Buf *ref_path, Buf *target_path, Buf *out_abs_path);
|
|
bool os_path_is_absolute(Buf *path);
|
|
|
|
void os_write_file(Buf *full_path, Buf *contents);
|
|
int os_copy_file(Buf *src_path, Buf *dest_path);
|
|
|
|
int os_fetch_file(FILE *file, Buf *out_contents);
|
|
int os_fetch_file_path(Buf *full_path, Buf *out_contents);
|
|
|
|
int os_get_cwd(Buf *out_cwd);
|
|
|
|
bool os_stderr_tty(void);
|
|
|
|
int os_buf_to_tmp_file(Buf *contents, Buf *suffix, Buf *out_tmp_path);
|
|
int os_delete_file(Buf *path);
|
|
|
|
int os_file_exists(Buf *full_path, bool *result);
|
|
|
|
int os_rename(Buf *src_path, Buf *dest_path);
|
|
double os_get_time(void);
|
|
|
|
#if defined(__APPLE__)
|
|
#define ZIG_OS_DARWIN
|
|
#elif defined(_WIN32)
|
|
#define ZIG_OS_WINDOWS
|
|
#elif defined(__linux__)
|
|
#define ZIG_OS_LINUX
|
|
#else
|
|
#define ZIG_OS_UNKNOWN
|
|
#endif
|
|
|
|
#if defined(__x86_64__)
|
|
#define ZIG_ARCH_X86_64
|
|
#else
|
|
#define ZIG_ARCH_UNKNOWN
|
|
#endif
|
|
|
|
#endif
|