Arquivos
hhvm/hphp/runtime/base/program_functions.h
T
mwilliams 71859e5566 Add support for .hhas files in systemlib
Will be needed for array_filter/array_map etc

This sets things up so that if we define a builtin in systemlib, we rename
the corresponding c++ builtin with the prefix __builtin_, so its still available
(in case the php builtin wants to delegate some edge cases, and to make
it easy to run comparisons between the php and c++ implementations).

Also did a little reorganization to get rid of Func::isPHPBuiltin,
and use an Attr to identify functions as builtins. C++ builtins can
still be identified by checking the Func::info() method. This is needed
to allow builtin methods defined in php (such as array_map) to lookup their
arguments in the correct context.
2013-05-30 17:33:02 -07:00

95 linhas
3.6 KiB
C++

/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_PROGRAM_FUNCTIONS_H_
#define incl_HPHP_PROGRAM_FUNCTIONS_H_
#include "hphp/util/base.h"
#include "hphp/runtime/base/types.h"
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
/**
* Main entry point of the entire program.
*/
int execute_program(int argc, char **argv);
void execute_command_line_begin(int argc, char **argv, int xhprof);
void execute_command_line_end(int xhprof, bool coverage, const char *program);
/**
* Setting up environment variables.
*/
void process_env_variables(Variant &variables);
/**
* Inserting a variable into specified symbol table.
*
* "overwrite" parameter is only for cookies:
* According to rfc2965, more specific paths are listed above the less
* specific ones. If we encounter a duplicate cookie name, we should
* skip it, since it is not possible to have the same (plain text)
* cookie name for the same path and we should not overwrite more
* specific cookies with the less specific ones.
*/
void register_variable(Variant &variables, char *name, CVarRef value,
bool overwrite = true);
String canonicalize_path(CStrRef path, const char* root, int rootLen);
/**
* Translate hex encode stack into both C++ and PHP frames.
*/
std::string translate_stack(const char *hexencoded,
bool with_frame_numbers = true);
time_t start_time();
///////////////////////////////////////////////////////////////////////////////
// C++ ffi
class ExecutionContext;
void pcre_init();
void pcre_reinit();
void hphp_process_init() ATTRIBUTE_COLD;
void hphp_session_init();
ExecutionContext* hphp_context_init();
bool hphp_invoke_simple(const std::string &filename, bool warmupOnly = false);
bool hphp_invoke(ExecutionContext *context, const std::string &cmd,
bool func, CArrRef funcParams, VRefParam funcRet,
const std::string &reqInitFunc, const std::string &reqInitDoc,
bool &error, std::string &errorMsg,
bool once = true, bool warmupOnly = false,
bool richErrorMsg = false);
void hphp_context_exit(ExecutionContext *context, bool psp,
bool shutdown = true, const char *program = nullptr);
void hphp_thread_exit();
void hphp_session_exit();
void hphp_process_exit() ATTRIBUTE_COLD;
bool hphp_is_warmup_enabled();
std::string get_systemlib(std::string* hhas = nullptr);
// Generated by hphp/util/generate_buildinfo.sh.
extern const char* const kCompilerId;
///////////////////////////////////////////////////////////////////////////////
}
#endif // incl_HPHP_PROGRAM_FUNCTIONS_H_