本文整理汇总了C++中MG函数的典型用法代码示例。如果您正苦于以下问题:C++ MG函数的具体用法?C++ MG怎么用?C++ MG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MG函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mlfi_close
/* {{{ mlfi_close()
*/
static sfsistat mlfi_close(SMFICTX *ctx)
{
int ret = SMFIS_CONTINUE;
zval function_name, retval;
int status;
TSRMLS_FETCH();
/* call userland */
INIT_ZVAL(function_name);
ZVAL_STRING(&function_name, "milter_close", 0);
/* set the milter context for possible use in API functions */
MG(ctx) = ctx;
MG(state) = MLFI_CLOSE;
status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);
MG(state) = MLFI_NONE;
if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
ret = Z_LVAL(retval);
}
php_request_shutdown((void *) 0);
return ret;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:29,代码来源:php_milter.c
示例2: mlfi_header
/* {{{ mlfi_header()
*/
static sfsistat mlfi_header(SMFICTX *ctx, char *headerf, char *headerv)
{
zval function_name, retval, *param[2];
int status;
TSRMLS_FETCH();
/* call userland */
INIT_ZVAL(function_name);
ALLOC_ZVAL(param[0]);
ALLOC_ZVAL(param[1]);
INIT_PZVAL(param[0]);
INIT_PZVAL(param[1]);
ZVAL_STRING(&function_name, "milter_header", 0);
ZVAL_STRING(param[0], headerf, 1);
ZVAL_STRING(param[1], headerv, 1);
/* set the milter context for possible use in API functions */
MG(ctx) = ctx;
MG(state) = MLFI_HEADER;
status = call_user_function(CG(function_table), NULL, &function_name, &retval, 2, param TSRMLS_CC);
MG(state) = MLFI_NONE;
zval_ptr_dtor(¶m[0]);
zval_ptr_dtor(¶m[1]);
if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
return Z_LVAL(retval);
}
return SMFIS_CONTINUE;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:37,代码来源:php_milter.c
示例3: mlfi_body
/* {{{ mlfi_body()
*/
static sfsistat mlfi_body(SMFICTX *ctx, u_char *bodyp, size_t len)
{
zval function_name, retval, *param[1];
int status;
TSRMLS_FETCH();
/* call userland */
INIT_ZVAL(function_name);
ALLOC_ZVAL(param[0]);
INIT_PZVAL(param[0]);
ZVAL_STRING(&function_name, "milter_body", 0);
ZVAL_STRINGL(param[0], (char*)bodyp, len, 1); /*alex*/
/* set the milter context for possible use in API functions */
MG(ctx) = ctx;
MG(state) = MLFI_BODY;
status = call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);
MG(state) = MLFI_NONE;
zval_ptr_dtor(param);
if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
return Z_LVAL(retval);
}
return SMFIS_CONTINUE;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:33,代码来源:php_milter.c
示例4: mlfi_connect
/* {{{ mlfi_connect()
*/
static sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
{
zend_file_handle file_handle;
zval function_name, retval, *param[1];
int status;
TSRMLS_FETCH();
/* request startup */
if (php_request_startup(TSRMLS_C)==FAILURE) {
SG(headers_sent) = 1;
SG(request_info).no_headers = 1;
php_request_shutdown((void *) 0);
return SMFIS_TEMPFAIL;
}
/* disable headers */
SG(headers_sent) = 1;
SG(request_info).no_headers = 1;
if (filename == NULL) {
php_printf("No input file specified");
return SMFIS_TEMPFAIL;
}
if (!(file_handle.handle.fp = VCWD_FOPEN(filename, "rb"))) {
php_printf("Could not open input file: %s\n", filename);
return SMFIS_TEMPFAIL;
}
file_handle.type = ZEND_HANDLE_FP;
file_handle.filename = filename;
file_handle.free_filename = 0;
file_handle.opened_path = NULL;
php_execute_script(&file_handle TSRMLS_CC);
/* call userland */
INIT_ZVAL(function_name);
ALLOC_ZVAL(param[0]);
INIT_PZVAL(param[0]);
ZVAL_STRING(&function_name, "milter_connect", 0);
ZVAL_STRING(param[0], hostname, 1);
/* set the milter context for possible use in API functions */
MG(ctx) = ctx;
MG(state) = MLFI_CONNECT;
status = call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);
MG(state) = MLFI_NONE;
zval_ptr_dtor(param);
if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
return Z_LVAL(retval);
}
return SMFIS_CONTINUE;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:62,代码来源:php_milter.c
示例5: mlfi_envfrom
/* {{{ mlfi_envform()
*/
static sfsistat mlfi_envfrom(SMFICTX *ctx, char **argv)
{
zval function_name, retval, *param[1];
int status;
TSRMLS_FETCH();
/* call userland */
INIT_ZVAL(function_name);
ALLOC_ZVAL(param[0]);
INIT_PZVAL(param[0]);
ZVAL_STRING(&function_name, "milter_envfrom", 0);
array_init(param[0]);
while (*argv) {
add_next_index_string(param[0], *argv, 1);
argv++;
}
/* set the milter context for possible use in API functions */
MG(ctx) = ctx;
MG(state) = MLFI_ENVFROM;
status = call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);
MG(state) = MLFI_NONE;
zval_ptr_dtor(param);
if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
return Z_LVAL(retval);
}
return SMFIS_CONTINUE;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:37,代码来源:php_milter.c
示例6: mlfi_init
/* {{{ Init Milter
*/
static int mlfi_init()
{
int ret = 0;
zend_file_handle file_handle;
zval function_name, retval;
int status;
TSRMLS_FETCH();
/* request startup */
if (php_request_startup(TSRMLS_C)==FAILURE) {
SG(headers_sent) = 1;
SG(request_info).no_headers = 1;
php_request_shutdown((void *) 0);
return -1;
}
/* disable headers */
SG(headers_sent) = 1;
SG(request_info).no_headers = 1;
if (filename == NULL) {
php_printf("No input file specified");
return SMFIS_TEMPFAIL;
}
if (!(file_handle.handle.fp = VCWD_FOPEN(filename, "rb"))) {
php_printf("Could not open input file: %s\n", filename);
return SMFIS_TEMPFAIL;
}
file_handle.type = ZEND_HANDLE_FP;
file_handle.filename = filename;
file_handle.free_filename = 0;
file_handle.opened_path = NULL;
php_execute_script(&file_handle TSRMLS_CC);
/* call userland */
INIT_ZVAL(function_name);
ZVAL_STRING(&function_name, "milter_init", 0);
/* set the milter context for possible use in API functions */
MG(state) = MLFI_INIT;
status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);
MG(state) = MLFI_NONE;
MG(initialized) = 1;
if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
ret = Z_LVAL(retval);
}
php_request_shutdown((void *) 0);
return ret;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:61,代码来源:php_milter.c
示例7: php_memoize_return
/* {{{ */
static int php_memoize_return(zend_execute_data *execute_data) {
zend_long ttl = 0;
const zend_function *fbc = EX(func);
if (MG(ini.enabled) && php_memoize_is_memoizing(fbc, &ttl)) {
zend_string *key = php_memoize_key(
&EX(This),
fbc, EX_NUM_ARGS(), EX_VAR_NUM(0));
if (key) {
zval *return_value;
if (EX(opline)->op1_type & IS_CONST) {
return_value = EX_CONSTANT(EX(opline)->op1);
} else {
return_value = EX_VAR(EX(opline)->op1.var);
}
apc_cache_store(php_memoize_cache, key, return_value, ttl, 1);
if (EG(exception)) {
zend_clear_exception();
}
zend_string_release(key);
}
}
if (zend_return_function) {
return zend_return_function(execute_data);
}
return ZEND_USER_OPCODE_DISPATCH;
} /* }}} */
开发者ID:krakjoe,项目名称:memoize,代码行数:35,代码来源:memoize.c
示例8: php_memoize_fcall_by_name
/* {{{ */
static int php_memoize_fcall_by_name(zend_execute_data *frame) {
if (MG(ini.enabled) && php_memoize_is_memoized(frame)) {
return php_memoize_leave_helper(frame);
}
if (zend_do_fcall_by_name_function) {
return zend_do_fcall_by_name_function(frame);
}
return ZEND_USER_OPCODE_DISPATCH;
} /* }}} */
开发者ID:krakjoe,项目名称:memoize,代码行数:12,代码来源:memoize.c
示例9: mlfi_abort
/* {{{ mlfi_abort()
*/
static sfsistat mlfi_abort(SMFICTX *ctx)
{
zval function_name, retval;
int status;
/* call userland */
INIT_ZVAL(function_name);
ZVAL_STRING(&function_name, "milter_abort", 0);
/* set the milter context for possible use in API functions */
MG(ctx) = ctx;
MG(state) = MLFI_ABORT;
status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL);
MG(state) = MLFI_NONE;
if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
return Z_LVAL(retval);
}
return SMFIS_CONTINUE;
}
开发者ID:AmesianX,项目名称:php-src,代码行数:25,代码来源:php_milter.c
示例10: WindowProc
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_SIZE:
if (Engine()->GetGlDevice()) {
Engine()->GetGlDevice()->SetWindowSize();
MG()->Resize();
}
break;
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
FillRect(hdc, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW + 1));
EndPaint(hwnd, &ps);
break;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
开发者ID:medav,项目名称:RDFT-Project,代码行数:23,代码来源:main.cpp
示例11: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR pCmdLine, int nCmdShow) {
// Register the window class.
const char CLASS_NAME[] = "RDFT Systems, Inc.";
Con();
std::cout << "*********************************************************\n";
std::cout << "* RDFT Minigame and Engine Demo *\n";
std::cout << "* Copyright (c) 2014 RDFT Systems, Inc. *\n";
std::cout << "* Michael Davies, Daniel Shauger, Matt Wilkinson *\n";
std::cout << "*********************************************************\n";
std::cout << "Creating window...\n";
WNDCLASS wc = {};
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;
RegisterClass(&wc);
// Create the window.
HWND hwnd = CreateWindowEx(
0, CLASS_NAME,
"RDFT Engine Demo",
WS_OVERLAPPEDWINDOW,
20, 20, 1024, 768,
NULL, NULL,
hInstance,
NULL);
if (hwnd == NULL)
return 0;
ShowWindow(hwnd, nCmdShow);
std::cout << "Initializing Engine...\n";
Engine()->SetHWND(hwnd);
std::cout << "Loading libraries...\n";
if (!Engine()->LoadDLLs())
return 0;
std::cout << "Creating devices...\n";
if (!Engine()->CreateDevices())
return 0;
std::cout << "Setting up devices...\n";
Engine()->GetGlDevice()->SetWindowSize();
// This will call the constructors for our singletons
std::cout << "Creating game...\n";
MG();
std::cout << "Setup complete!\n";
Con()->Start();
// Run the message loop.
MSG msg = {};
bool done = false;
while (!done) {
PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE);
if (msg.message == WM_QUIT) {
done = true;
}
else {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
MG()->Think();
MG()->Draw();
Con()->ExecSync();
}
Con()->Stop();
return 0;
}
开发者ID:medav,项目名称:RDFT-Project,代码行数:83,代码来源:main.cpp
示例12: php_memoize_time
/* {{{ */
static inline time_t php_memoize_time(void) {
return MG(ini.debug) ? time(NULL) : sapi_get_request_time();
} /* }}} */
开发者ID:krakjoe,项目名称:memoize,代码行数:4,代码来源:memoize.c
注:本文中的MG函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论