Exemple #1
0
int uopz_add_class_handler(UOPZ_OPCODE_HANDLER_ARGS) { /* {{{ */
	zval *name = EX_CONSTANT(EX(opline)->op2);
	zend_string *key = zend_string_tolower(Z_STR_P(name));
	zval *mock = NULL;
	
	if ((mock = zend_hash_find(&UOPZ(mocks), key))) {
		if (Z_TYPE_P(mock) == IS_STRING) {
			zend_class_entry *ce = zend_lookup_class(Z_STR_P(mock));
			
			if (ce) {
				CACHE_PTR(Z_CACHE_SLOT_P(name), ce);
			}
		} else {
			CACHE_PTR(Z_CACHE_SLOT_P(name), Z_OBJCE_P(mock));
		}
	}
	
	zend_string_release(key);	

	if (uopz_add_trait_handler || uopz_add_interface_handler) {
		switch (EX(opline)->opcode) {
			case ZEND_ADD_INTERFACE:
				return uopz_add_interface_handler(UOPZ_OPCODE_HANDLER_ARGS_PASSTHRU);

			case ZEND_ADD_TRAIT:
				return uopz_add_trait_handler(UOPZ_OPCODE_HANDLER_ARGS_PASSTHRU);
		}
	}
	
	return ZEND_USER_OPCODE_DISPATCH;
} /* }}} */
Exemple #2
0
void updatePMLEFieldUtilEx(int xStart, int xEnd, int yStart, int yEnd, int zStart, int zEnd, int xBound, int yBound, int zBound, pmlConstStruct cx[], pmlConstStruct cy[], pmlConstStruct cz[], int n){
		
	int i, j, k; // These are the indexes
	int x,y,z;// There are indexes for the pmlConstStruct indexs
	long p;
	int m;
	double dxStore;
	double eps;
	for (i=xStart;i<xEnd+1;i++){
		x = abs(xBound - i)%PML_LAYERS;	
	for (j=yStart;j<yEnd+1;j++){
		y = abs(yBound - j)%PML_LAYERS;	
	for (k=zStart;k<zEnd+1;k++){
		z = abs(zBound - k)%PML_LAYERS;
		
		p = PMLINDEX(i,j,k);
		dxStore = DX(p);					
	
		m = MATERIALINDEX(i,j,k);
		eps = EPSR(m)*EPSNOT;
		DX(p)     = cy[y].c1*DX(p) + cy[y].c2*(HZ(i,j,k) - HZ(i,j-1,k) - HY(i,j,k) + HY(i,j,k-1) - JSX(m));
		EX(i,j,k) = cz[z].c3*EX(i,j,k) + cz[z].c4*(cx[x].c5*DX(p)-cx[x].c6*dxStore)/eps; 
		 
	}}} // end for

}// end updatePMLEFieldUtilEx
Exemple #3
0
static ZEND_NAMED_FUNCTION(zend_closure_internal_handler) /* {{{ */
{
	zend_closure *closure = (zend_closure*)ZEND_CLOSURE_OBJECT(EX(func));
	closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
	OBJ_RELEASE((zend_object*)closure);
	EX(func) = NULL;
}
Exemple #4
0
void updatePMLHFieldUtilHz(int xStart, int xEnd, int yStart, int yEnd, int zStart, int zEnd, int xBound, int yBound, int zBound, pmlConstStruct cx[], pmlConstStruct cy[], pmlConstStruct cz[], int n){
		
	int i, j, k; // These are the indexes
	int x,y,z;// There are indexes for the pmlConstStruct indexs
	long p;
	int m;
	double bzStore;
	double mu;
// Either this, or make cOnes a bigger array with number of elements which are the max of xLen, yLen, zLen
	for (i=xStart;i<xEnd+1;i++){
		x = abs(xBound - i)%PML_LAYERS;	
	for (j=yStart;j<yEnd+1;j++){
		y = abs(yBound - j)%PML_LAYERS;		
	for (k=zStart;k<zEnd+1;k++){
		z = abs(zBound - k)%PML_LAYERS;
			
		p = PMLINDEX(i,j,k);
		bzStore = BZ(p);
	
		mu = MUR(m)*MUNOT;
				
		BZ(p)     = cx[x].c1*BZ(p) + cx[x].c2*(EX(i,j+1,k) - EX(i,j,k) + EY(i,j,k) - EY(i+1,j,k) - MSZ(m));
		HZ(i,j,k) = cy[y].c3*HZ(i,j,k) + cy[y].c4*(cz[z].c5*BZ(p)-cz[z].c6*bzStore)/mu; 
	}}} // end for

}// end updatePMLHFieldUtilHz
Exemple #5
0
static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
	zend_fcall_info fci;
	zend_fcall_info_cache fcc;
	zval params[2];

	memset(&fci, 0, sizeof(zend_fcall_info));
	memset(&fcc, 0, sizeof(zend_fcall_info_cache));

	fci.size = sizeof(zend_fcall_info);
	fci.retval = return_value;

	fcc.function_handler = (zend_function *) EX(func)->common.arg_info;
	fci.params = params;
	fci.param_count = 2;
	ZVAL_STR(&fci.params[0], EX(func)->common.function_name);
	if (ZEND_NUM_ARGS()) {
		array_init_size(&fci.params[1], ZEND_NUM_ARGS());
		zend_copy_parameters_array(ZEND_NUM_ARGS(), &fci.params[1]);
	} else {
		ZVAL_EMPTY_ARRAY(&fci.params[1]);
	}

	fci.object = Z_OBJ(EX(This));
	fcc.object = Z_OBJ(EX(This));

	zend_call_function(&fci, &fcc);

	zval_ptr_dtor(&fci.params[0]);
	zval_ptr_dtor(&fci.params[1]);
}
Exemple #6
0
static void zend_closure_internal_handler(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
{
	zend_closure *closure = (zend_closure*)EX(func)->common.prototype;
	closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
	OBJ_RELEASE((zend_object*)closure);
	EX(func) = NULL;
}
Exemple #7
0
/* {{{ */
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;
} /* }}} */
Exemple #8
0
/* {{{ */
static inline zend_bool php_memoize_is_memoized(const zend_execute_data *execute_data) {
	const zend_execute_data *call = EX(call);
	const zend_function *fbc = call->func;

	if (call && php_memoize_is_memoizing(fbc, NULL)) {
		zend_string *key = php_memoize_key(
			&call->This,
			fbc,
			ZEND_CALL_NUM_ARGS(call), ZEND_CALL_ARG(call, 1));
		zval *return_value;

		if (!key) {
			return 0;
		}

		return_value = EX_VAR(EX(opline)->result.var);

		if (apc_cache_fetch(php_memoize_cache, key, php_memoize_time(), &return_value)) {
			zend_string_release(key);
			return 1;
		}

		zend_string_release(key);
	}

	return 0;
} /* }}} */
Exemple #9
0
int uopz_class_constant_handler(UOPZ_OPCODE_HANDLER_ARGS) { /* {{{ */
	if (EX(opline)->op1_type == IS_CONST) {
		zval *name = EX_CONSTANT(EX(opline)->op1);
		zend_string *key = Z_STR_P(name);
		zval *mock = NULL;
		zend_class_entry *poser = NULL;

		key = zend_string_tolower(key);
		
		if ((mock = zend_hash_find(&UOPZ(mocks), key))) {
			if (Z_TYPE_P(mock) == IS_OBJECT) {
				poser = Z_OBJCE_P(mock);
			} else poser = zend_lookup_class(Z_STR_P(mock));

			if (poser) {
				CACHE_PTR(Z_CACHE_SLOT_P(name), poser);
			}
		}

		zend_string_release(key);
	}

	CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(EX(opline)->op2)), NULL);

	if (uopz_fetch_class_constant_handler) {
		return uopz_fetch_class_constant_handler(UOPZ_OPCODE_HANDLER_ARGS_PASSTHRU);
	}
	
	return ZEND_USER_OPCODE_DISPATCH;
} /* }}} */
Exemple #10
0
static void zend_closure_call_magic(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ {
	zend_fcall_info fci;
	zend_fcall_info_cache fcc;
	zval params[2];

	memset(&fci, 0, sizeof(zend_fcall_info));
	memset(&fci, 0, sizeof(zend_fcall_info_cache));

	fci.size = sizeof(zend_fcall_info);
	fci.retval = return_value;

	fcc.initialized = 1;
	fcc.function_handler = (zend_function *) EX(func)->common.arg_info;
	fci.params = params;
	fci.param_count = 2;
	ZVAL_STR(&fci.params[0], EX(func)->common.function_name);
	array_init(&fci.params[1]);
	zend_copy_parameters_array(ZEND_NUM_ARGS(), &fci.params[1]);

	fci.object = Z_OBJ(EX(This));
	fcc.object = Z_OBJ(EX(This));
	fcc.calling_scope = zend_get_executed_scope();

	zend_call_function(&fci, &fcc);

	zval_ptr_dtor(&fci.params[0]);
	zval_ptr_dtor(&fci.params[1]);
}
Exemple #11
0
void free(void *ptr) {
	__asm
	POP HL
	EX (SP), IX
	PCALL(FREE)
	EX (SP), IX
	JP (HL)
	__endasm;
	ptr;
}
Exemple #12
0
void wung_execute_ex(wung_execute_data * execute_data) {

    while(1) {
        if (EX(opline)->handler==0) {
            break;
        }
        wung_print_opline(EX(opline));
        (EX(opline)->handler)(execute_data);
        WUNG_NEXT_OPCODE;
    }
}
Exemple #13
0
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Throwable previous]]])
   ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
{
	char  *message = NULL, *filename = NULL;
	zend_long   code = 0, severity = E_ERROR, lineno;
	zval   tmp, *object, *previous = NULL;
	int    argc = ZEND_NUM_ARGS();
	size_t message_len, filename_len;

	if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, zend_ce_throwable) == FAILURE) {
		zend_class_entry *ce;

		if (Z_TYPE(EX(This)) == IS_OBJECT) {
			ce = Z_OBJCE(EX(This));
		} else if (Z_CE(EX(This))) {
			ce = Z_CE(EX(This));
		} else {
			ce = zend_ce_error_exception;
		}
		zend_throw_error(NULL, "Wrong parameters for %s([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno  [, Throwable $previous = NULL]]]]]])", ZSTR_VAL(ce->name));
		return;
	}

	object = getThis();

	if (message) {
		ZVAL_STRING(&tmp, message);
		zend_update_property_ex(zend_ce_exception, object, CG(known_strings)[ZEND_STR_MESSAGE], &tmp);
		zval_ptr_dtor(&tmp);
	}

	if (code) {
		ZVAL_LONG(&tmp, code);
		zend_update_property_ex(zend_ce_exception, object, CG(known_strings)[ZEND_STR_CODE], &tmp);
	}

	if (previous) {
		zend_update_property_ex(zend_ce_exception, object, CG(known_strings)[ZEND_STR_PREVIOUS], previous);
	}

	ZVAL_LONG(&tmp, severity);
	zend_update_property_ex(zend_ce_exception, object, CG(known_strings)[ZEND_STR_SEVERITY], &tmp);

	if (argc >= 4) {
		ZVAL_STRING(&tmp, filename);
		zend_update_property_ex(zend_ce_exception, object, CG(known_strings)[ZEND_STR_FILE], &tmp);
		zval_ptr_dtor(&tmp);
    	if (argc < 5) {
    	    lineno = 0; /* invalidate lineno */
    	}
		ZVAL_LONG(&tmp, lineno);
		zend_update_property_ex(zend_ce_exception, object, CG(known_strings)[ZEND_STR_LINE], &tmp);
	}
}
// variant: means by /nrow rather than /npairs when dealing with missing data
// deviates from R's pairwise.complete.obs, but highly similar.
// good results in context of particular biological validations,
// but formal correctness undetermined
void
pearson_distances_pairwise_complete_obs_variant(
	double * const d,
	const double * const matrix,
	int const nrow,
	int const ncol
){
	std::ptrdiff_t p(0);
	t_float EX(0), EY(0), EXX(0), EYY(0), EXY(0), x(0), y(0);
	for(int col1(0), end(ncol); col1<(end-1); ++col1){
		for(int col2(col1+1); col2<end; ++col2){
			// Pearson correlation distance
			EX=0, EY=0, EXX=0, EYY=0, EXY=0, x=0, y=0;
			unsigned npairs(0);
			for(int row(0); row<nrow; ++row){
				// R indexes its arrays BY COLUMN
				x = matrix[col1*nrow+row];
				y = matrix[col2*nrow+row];
				if(ISNA(x) || ISNA(y)) continue;
				++npairs;
				EX += x;
				EY += y;
				EXX += x*x;
				EYY += y*y;
				EXY += x*y;
			}
			if(npairs<1) d[p++] = 2.0;
			else d[p++] = 1.0 - (EXY - EX*EY/nrow) / sqrt( (EXX - EX*EX/nrow)*(EYY - EY*EY/nrow) );
		}
	}
}
Exemple #15
0
static int com_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS)
{
	zval *args = NULL;
	php_com_dotnet_object *obj = (php_com_dotnet_object*)object;
	int nargs;
	VARIANT v;
	int ret = FAILURE;

	if (V_VT(&obj->v) != VT_DISPATCH) {
		return FAILURE;
	}

	nargs = ZEND_NUM_ARGS();

	if (nargs) {
		args = (zval *)safe_emalloc(sizeof(zval), nargs, 0);
		zend_get_parameters_array_ex(nargs, args);
	}

	VariantInit(&v);

	if (SUCCESS == php_com_do_invoke_byref(obj, (zend_internal_function*)EX(func), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args)) {
		php_com_zval_from_variant(return_value, &v, obj->code_page);
		ret = SUCCESS;
		VariantClear(&v);
	}

	if (args) {
		efree(args);
	}

	return ret;
}
void run_pipeline() {
	if(Register::cycle == 59) {
            printf("in main before WB ID_EX.$rt_out = %d\n", ID_EX.$rt_out);
        }
	WB();
	if(Register::cycle == 59) {
            printf("in main before DM ID_EX.$rt_out = %d\n", ID_EX.$rt_out);
        }
    DM();
    if(Register::cycle == 59) {
            printf("in main before EX ID_EX.$rt_out = %d\n", ID_EX.$rt_out);
        }
    EX();
    if(Register::cycle == 59) {
            printf("in main before ID ID_EX.$rt_out = %d\n", ID_EX.$rt_out);
        }
    ID();
    if(Register::cycle == 59) {
            printf("in main before IF ID_EX.$rt_out = %d\n", ID_EX.$rt_out);
        }
    IF();
    if(Register::cycle == 59) {
            printf("in main after IF ID_EX.$rt_out = %d\n", ID_EX.$rt_out);
        }
}
Exemple #17
0
/* {{{ proto Closure Closure::fromCallable(callable callable)
   Create a closure from a callable using the current scope. */
ZEND_METHOD(Closure, fromCallable)
{
	zval *callable;
	int success;
	char *error = NULL;

	if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callable) == FAILURE) {
		return;
	}

	if (Z_TYPE_P(callable) == IS_OBJECT && instanceof_function(Z_OBJCE_P(callable), zend_ce_closure)) {
		/* It's already a closure */
		RETURN_ZVAL(callable, 1, 0);
	}

	/* create closure as if it were called from parent scope */
	EG(current_execute_data) = EX(prev_execute_data);
	success = zend_create_closure_from_callable(return_value, callable, &error);
	EG(current_execute_data) = execute_data;

	if (success == FAILURE || error) {
		if (error) {
			zend_throw_exception_ex(zend_ce_type_error, 0, "Failed to create closure from callable: %s", error);
			efree(error);
		} else {
			zend_throw_exception_ex(zend_ce_type_error, 0, "Failed to create closure from callable");
		}
	}
}
Exemple #18
0
/*
 * Checksum for SRECORD.  Add all the bytes from the record length field through the data, and take
 * the ones complement.  This includes the address field, which for SRECORDs can be 2 bytes, 3 bytes or
 * 4 bytes.  In this case, since the upper bytes of the address will be 0 for records of the smaller sizes,
 * just add all 4 bytes of the address in all cases.
 * 
 * The arguments are:
 * 
 *  buf		a pointer to the beginning of the data for the record
 *  length	the length of the data portion of the record
 *  chunk_len	the length of the record starting at the address and including the checksum
 *  chunk_addr	starting address for the data in the record
 *
 * Returns an unsigned char with the checksum
 */
static unsigned char srec_csum(unsigned char *buf, unsigned int length, int chunk_len, int chunk_addr) {
  int sum = chunk_len + (LO(chunk_addr)) + (HI(chunk_addr)) + (EX(chunk_addr)) + (EH(chunk_addr));
  unsigned int i;
  for(i = 0; i < length; i++) {
    sum += buf[i];
  }
  return ~sum & 0xff;
}
Exemple #19
0
static PHP_FUNCTION(com_method_handler)
{
	zval *object = getThis();

	Z_OBJ_HANDLER_P(object, call_method)(
			((zend_internal_function*)EX(func))->function_name,
			Z_OBJ_P(object),
			INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
Exemple #20
0
int uopz_return_handler(UOPZ_OPCODE_HANDLER_ARGS) { /* {{{ */
	zend_execute_data *call = EX(call);

	if (call) {
		uopz_return_t *ureturn;

		uopz_run_hook(call->func, call);

		ureturn = uopz_find_return(call->func);

		if (ureturn) {
			const zend_op *opline = EX(opline);
			zval rv, *return_value = RETURN_VALUE_USED(opline) ? 
				EX_VAR(EX(opline)->result.var) : &rv;

			if (UOPZ_RETURN_IS_EXECUTABLE(ureturn)) {
				if (UOPZ_RETURN_IS_BUSY(ureturn)) {
					goto _uopz_return_handler_dispatch;
				}

				uopz_execute_return(ureturn, call, return_value);

				if (!RETURN_VALUE_USED(opline)) {
					zval_ptr_dtor(&rv);
				}

				return php_uopz_leave_helper(UOPZ_OPCODE_HANDLER_ARGS_PASSTHRU);
			}

			if (RETURN_VALUE_USED(opline)) {
				ZVAL_COPY(return_value, &ureturn->value);
			}

			return php_uopz_leave_helper(UOPZ_OPCODE_HANDLER_ARGS_PASSTHRU);
		}
	}

_uopz_return_handler_dispatch:
	if (uopz_do_fcall_handler) {
		return uopz_do_fcall_handler(UOPZ_OPCODE_HANDLER_ARGS_PASSTHRU);
	}

	return ZEND_USER_OPCODE_DISPATCH;
} /* }}} */
ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_profile_helper(ZEND_OPCODE_HANDLER_ARGS)
{
	zend_op_array *op_array = (zend_op_array*)EX(func);
	zend_vm_opcode_handler_t handler = (zend_vm_opcode_handler_t)ZEND_FUNC_INFO(op_array);
	uintptr_t counter = (uintptr_t)ZEND_COUNTER_INFO(op_array);

	ZEND_COUNTER_INFO(op_array) = (void*)(counter + 1);
	++zend_jit_profile_counter;
	ZEND_OPCODE_TAIL_CALL(handler);
}
Exemple #22
0
/* {{{ */
static inline int php_memoize_leave_helper(zend_execute_data *execute_data) {
	zend_execute_data *call = EX(call);
	uint32_t info = ZEND_CALL_INFO(call);

	if (info & ZEND_CALL_RELEASE_THIS) {
		OBJ_RELEASE(Z_OBJ(call->This));
	} else if (info & ZEND_CALL_CLOSURE) {
		 OBJ_RELEASE((zend_object*)call->func->op_array.prototype);
	}

	EX(call) = call->prev_execute_data;

	zend_vm_stack_free_args(call);
	zend_vm_stack_free_call_frame(call);

	EX(opline) = EX(opline) + 1;

	return ZEND_USER_OPCODE_LEAVE;
} /* }}} */
Exemple #23
0
static inline void calcMB(void)
{
  for(int i=1; i<N_PX-1; i++){
    for(int j=1; j<N_PY-1; j++){
      double complex nowMz = MZ(i,j);
      Mz[ind(i,j)] = CMZ(i,j)*MZ(i,j) - CMZEXEY(i,j)*(EY(i+1,j) - EY(i,j) - EX(i,j+1) + EX(i,j));
      Bz[ind(i,j)] = CBZ(i,j)*BZ(i,j) + CBZMZ1(i,j)*MZ(i,j) - CBZMZ0(i,j)*nowMz; 
    }
  }
}
ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_top_func_helper(uint32_t call_info EXECUTE_DATA_DC)
{
	if (UNEXPECTED(call_info & (ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS))) {
		if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
			zend_clean_and_cache_symbol_table(EX(symbol_table));
		}
		zend_vm_stack_free_extra_args_ex(call_info, execute_data);
	}
	EG(current_execute_data) = EX(prev_execute_data);
	if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
		OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
	}
	execute_data = EG(current_execute_data);
#ifdef HAVE_GCC_GLOBAL_REGS
	opline = zend_jit_halt_op;
#else
	return -1; // ZEND_VM_RETURN
#endif
}
static int coro_exit_handler(zend_execute_data *execute_data)
{
    zval ex;
    zend_object *obj;
    zend_long flags = 0;
    if (sw_get_current_cid() != -1)
    {
        flags |= SW_EXIT_IN_COROUTINE;
    }
    if (SwooleG.serv && SwooleG.serv->gs->start)
    {
        flags |= SW_EXIT_IN_SERVER;
    }
    if (flags)
    {
        const zend_op *opline = EX(opline);
        zval _exit_status;
        zval *exit_status = NULL;

        if (opline->op1_type != IS_UNUSED)
        {
            if (opline->op1_type == IS_CONST)
            {
                // see: https://github.com/php/php-src/commit/e70618aff6f447a298605d07648f2ce9e5a284f5
#ifdef EX_CONSTANT
                exit_status = EX_CONSTANT(opline->op1);
#else
                exit_status = RT_CONSTANT(opline, opline->op1);
#endif
            }
            else
            {
                exit_status = EX_VAR(opline->op1.var);
            }
            if (Z_ISREF_P(exit_status))
            {
                exit_status = Z_REFVAL_P(exit_status);
            }
        }
        else
        {
            exit_status = &_exit_status;
            ZVAL_NULL(exit_status);
        }
        obj = zend_throw_error_exception(swoole_exit_exception_class_entry_ptr, "swoole exit.", 0, E_ERROR TSRMLS_CC);
        ZVAL_OBJ(&ex, obj);
        zend_update_property_long(swoole_exit_exception_class_entry_ptr, &ex, ZEND_STRL("flags"), flags);
        Z_TRY_ADDREF_P(exit_status);
        zend_update_property(swoole_exit_exception_class_entry_ptr, &ex, ZEND_STRL("status"), exit_status);
    }

    return ZEND_USER_OPCODE_DISPATCH;
}
Exemple #26
0
bool Position_system::read_from_file(std::string datname)
{
	 std::ifstream SET_TXT;  
	 SET_TXT.open(datname.c_str()); 
	 if(!SET_TXT) {
	      throw EX("file load error",DEBUG_LOCATION,"Position_system::temp_read_laser_beam_structur(std::string& datname) -> could not load "+datname+"-> error");
	      return false;
	 }
	 
	 std::string hilf;
	 int icase=0;
	 int max_line = 50, iline = 0;
	 //search of the beginning string
	  while(getline(SET_TXT,hilf))
	  {
	    size_t find_0_1=0;
	    find_0_1=hilf.find(m_search_string_applanix_file.c_str())+1;  //find ist ein vordefinierter Befehl in der Klasse string!            
	    if(find_0_1){ icase=1; break; }
	    
	    size_t find_0_2=0;
	    find_0_2=hilf.find(m_search_string_messpictures_file.c_str())+1;  //find ist ein vordefinierter Befehl in der Klasse string!            
	    if(find_0_2){ icase=2; break; }
	    
	    size_t find_0_3=0;
        find_0_3=hilf.find(m_search_string_temp_laser_beam_file.c_str())+1;  //find ist ein vordefinierter Befehl in der Klasse string!
        if(find_0_3){ icase=3; break; }

	    ++iline;
	    if(iline>max_line){break;}
	  }
	  
	  SET_TXT.close();
	  SET_TXT.clear();
	  
	  if(icase==1)
	  {
		return read_applanix_file(datname);
	  }
	  if(icase==2)
	  {
		return read_messpictures_log_file(datname);
	  }
      if(icase==3)
      {
       (*this).temp_read_laser_beam_structur(datname);
       return true;
      }
	 
	  
	  
return false;	  
}
Exemple #27
0
/* {{{ proto Exception|Error::__construct(string message, int code [, Throwable previous])
   Exception constructor */
ZEND_METHOD(exception, __construct)
{
	zend_string *message = NULL;
	zend_long   code = 0;
	zval  tmp, *object, *previous = NULL;
	zend_class_entry *base_ce;
	int    argc = ZEND_NUM_ARGS();

	object = getThis();
	base_ce = i_get_exception_base(object);

	if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|SlO!", &message, &code, &previous, zend_ce_throwable) == FAILURE) {
		zend_class_entry *ce;

		if (Z_TYPE(EX(This)) == IS_OBJECT) {
			ce = Z_OBJCE(EX(This));
		} else if (Z_CE(EX(This))) {
			ce = Z_CE(EX(This));
		} else {
			ce = base_ce;
		}
		zend_throw_error(NULL, "Wrong parameters for %s([string $message [, long $code [, Throwable $previous = NULL]]])", ZSTR_VAL(ce->name));
		return;
	}

	if (message) {
		ZVAL_STR(&tmp, message);
		zend_update_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_MESSAGE), &tmp);
	}

	if (code) {
		ZVAL_LONG(&tmp, code);
		zend_update_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_CODE), &tmp);
	}

	if (previous) {
		zend_update_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_PREVIOUS), previous);
	}
}
Exemple #28
0
/** see http://lxr.php.net/xref/PHP_7_0/Zend/zend_vm_def.h#2892 */
static int oop_method_call_handler(zend_execute_data *execute_data)
{
    const zend_op *opline = execute_data->opline;
    zend_free_op free_op1, free_op2;
    zval *obj = NULL, *method = NULL;
    zend_class_entry *ce = NULL;
    zend_function *fbc = NULL;
    zend_execute_data *call = NULL;

    obj = zend_get_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, BP_VAR_R);
    method = zend_get_zval_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, BP_VAR_R);

    if (Z_TYPE_P(obj) == IS_STRING) {
        ce = OOP_G(oop_handlers)[Z_TYPE_P(obj)];

        if (!ce) {
            return ZEND_USER_OPCODE_DISPATCH;
        }

        fbc = zend_std_get_static_method(ce, Z_STR_P(method), NULL);
        if (UNEXPECTED(fbc == NULL)) {
           php_error(E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(method));
        }
        fbc = oop_get_indirection_func(ce, fbc, method, obj);

        call = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_FUNCTION, fbc, opline->extended_value, ce, NULL);
        call->prev_execute_data = EX(call);
        EX(call) = call;

        FREE_OP(free_op2);
        FREE_OP_IF_VAR(free_op1);

        execute_data->opline++;

        return ZEND_USER_OPCODE_CONTINUE;
    }

    return ZEND_USER_OPCODE_DISPATCH;
}
static int ZEND_DECLARE_INHERITED_CLASS_DELAYED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
	zend_class_entry **pce, **pce_orig;

	if (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op2.u.constant), Z_STRLEN(EX(opline)->op2.u.constant) + 1, (void **)&pce) == FAILURE ||
	    (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op1.u.constant), Z_STRLEN(EX(opline)->op1.u.constant), (void**)&pce_orig) == SUCCESS &&
	     *pce != *pce_orig)) {
		do_bind_inherited_class(EX(opline), EG(class_table), EX_T(EX(opline)->extended_value).class_entry, 0 TSRMLS_CC);
	}
	EX(opline)++;
	return ZEND_USER_OPCODE_CONTINUE;
}
Exemple #30
0
int uopz_no_exit_handler(UOPZ_OPCODE_HANDLER_ARGS) { /* {{{ */
	if (UOPZ(exit)) {
		if (uopz_exit_handler)
			return uopz_exit_handler(UOPZ_OPCODE_HANDLER_ARGS_PASSTHRU);

		return ZEND_USER_OPCODE_DISPATCH;
	}

	if (EX(opline)->op1_type != IS_UNUSED) {
		zval *estatus;

		if (EX(opline)->op1_type == IS_CONST) {
			estatus = EX_CONSTANT(EX(opline)->op1);
		} else estatus = EX_VAR(EX(opline)->op1.var);

		if (Z_ISREF_P(estatus)) {
			estatus = Z_REFVAL_P(estatus);
		}

		if (Z_TYPE_P(estatus) == IS_LONG) {
			EG(exit_status) = Z_LVAL_P(estatus);
		} else EG(exit_status) = 0;

		ZVAL_COPY(&UOPZ(estatus), estatus);
	}

	if (EX(opline) < &EX(func)->op_array.opcodes[EX(func)->op_array.last - 1]) {
		EX(opline)++;

		while (EX(opline)->opcode == ZEND_EXT_STMT) {
			EX(opline)++;
		}

		return ZEND_USER_OPCODE_CONTINUE;
	} else {
		return ZEND_USER_OPCODE_RETURN;
	}
} /* }}} */