monotone

monotone Mtn Source Tree

Root/platform.hh

1#ifndef __PLATFORM_HH__
2#define __PLATFORM_HH__
3
4// copyright (C) 2002, 2003, 2004 graydon hoare <graydon@pobox.com>
5// all rights reserved.
6// licensed to the public under the terms of the GNU GPL (>= 2)
7// see the file COPYING for details
8
9// this describes functions to be found, alternatively, in win32/* or unix/*
10// directories.
11
12#include <string>
13
14#include "vocab.hh"
15#include "config.h"
16#include "paths.hh"
17
18void read_password(std::string const & prompt, char * buf, size_t bufsz);
19void get_system_flavour(std::string & ident);
20bool is_executable(const char *path);
21
22// For LUA
23int existsonpath(const char *exe);
24int make_executable(const char *path);
25pid_t process_spawn(const char * const argv[]);
26int process_wait(pid_t pid, int *res);
27int process_kill(pid_t pid, int signal);
28int process_sleep(unsigned int seconds);
29
30// for pipe creation on Win32
31#ifdef WIN32
32std::string munge_argv_into_cmdline(const char* const argv[]);
33#endif
34
35// for term selection
36bool have_smart_terminal();
37// this function cannot call W/P/L, because it is called by the tick printing
38// code.
39// return value of 0 means "unlimited"
40unsigned int terminal_width();
41
42// for "reckless mode" working copy change detection.
43// returns 'true' if it has generated a valid inodeprint; returns 'false' if
44// there was a problem, in which case we should act as if the inodeprint has
45// changed.
46bool inodeprint_file(file_path const & file, hexenc<inodeprint> & ip);
47
48// for netsync 'serve' pidfile support
49pid_t get_process_id();
50
51// filesystem stuff
52// FIXME: BUG: this returns a string in the filesystem charset/encoding
53std::string get_current_working_dir();
54// calls N() if fails
55void change_current_working_dir(any_path const & to);
56utf8 tilde_expand(utf8 const & path);
57system_path get_default_confdir();
58utf8 get_homedir();
59namespace path
60{
61 typedef enum { nonexistent, directory, file } status;
62};
63path::status get_path_status(any_path const & path);
64
65void rename_clobberingly(any_path const & from, any_path const & to);
66
67#ifdef WIN32
68// Win32 doesn't have wcswidth, so we supply our own implementation.
69extern "C" int wcswidth(const wchar_t * pwcs, size_t n);
70#endif
71
72#endif // __PLATFORM_HH__

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status