Rename files in runtime/base, part 6
[hiphop-php.git] / hphp / runtime / base / program-functions.h
blob1f4b731de7d04f8aaece171513b4125c3ffe8900
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_PROGRAM_FUNCTIONS_H_
18 #define incl_HPHP_PROGRAM_FUNCTIONS_H_
20 #include "hphp/util/base.h"
21 #include "hphp/runtime/base/types.h"
23 namespace HPHP {
24 ///////////////////////////////////////////////////////////////////////////////
26 /**
27 * Main entry point of the entire program.
29 int execute_program(int argc, char **argv);
30 void execute_command_line_begin(int argc, char **argv, int xhprof);
31 void execute_command_line_end(int xhprof, bool coverage, const char *program);
33 /**
34 * Setting up environment variables.
36 void process_env_variables(Variant &variables);
38 /**
39 * Inserting a variable into specified symbol table.
41 * "overwrite" parameter is only for cookies:
42 * According to rfc2965, more specific paths are listed above the less
43 * specific ones. If we encounter a duplicate cookie name, we should
44 * skip it, since it is not possible to have the same (plain text)
45 * cookie name for the same path and we should not overwrite more
46 * specific cookies with the less specific ones.
48 void register_variable(Variant &variables, char *name, CVarRef value,
49 bool overwrite = true);
51 String canonicalize_path(CStrRef path, const char* root, int rootLen);
53 /**
54 * Translate hex encode stack into both C++ and PHP frames.
56 std::string translate_stack(const char *hexencoded,
57 bool with_frame_numbers = true);
59 time_t start_time();
61 ///////////////////////////////////////////////////////////////////////////////
62 // C++ ffi
64 class ExecutionContext;
66 void pcre_init();
67 void pcre_reinit();
68 void hphp_process_init() ATTRIBUTE_COLD;
69 void hphp_session_init();
71 ExecutionContext* hphp_context_init();
72 bool hphp_invoke_simple(const std::string &filename, bool warmupOnly = false);
73 bool hphp_invoke(ExecutionContext *context, const std::string &cmd,
74 bool func, CArrRef funcParams, VRefParam funcRet,
75 const std::string &reqInitFunc, const std::string &reqInitDoc,
76 bool &error, std::string &errorMsg,
77 bool once = true, bool warmupOnly = false,
78 bool richErrorMsg = false);
79 void hphp_context_exit(ExecutionContext *context, bool psp,
80 bool shutdown = true, const char *program = nullptr);
82 void hphp_thread_exit();
83 void hphp_session_exit();
84 void hphp_process_exit() ATTRIBUTE_COLD;
85 bool hphp_is_warmup_enabled();
86 std::string get_systemlib(std::string* hhas = nullptr);
88 // Generated by hphp/util/generate_buildinfo.sh.
89 extern const char* const kCompilerId;
91 ///////////////////////////////////////////////////////////////////////////////
94 #endif // incl_HPHP_PROGRAM_FUNCTIONS_H_