adding functions to php4(simple question ?)

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: adding functions to php4(simple question ?)
Groups: php.dev 
Request: Send a blank email to php-dev+get-28342@lists.php.net to get a copy of this message
Hi, I try to include some statistical function module on my php4. I have gotten C-source codes , compiled and installed under /usr/local/lib/libRmath.a on my Solaris 2.7 station. The following is the part of the original C-source(wilcox.c).- ----------- .. static double ***w; ... static void w_init_maybe(int m, int n) { int i; .... if (!w) { ... w = (double ***) calloc(m+1, sizeof(double **)); if (!w) MATHLIB_ERROR("wilcox allocation error %d", 1); ... } ... double pwilcox(double x, double m, double n, int lower, int log_p) ... w_init_maybe(m,n) ... }/* pwilcox */ ---------------------------------- I have made necessary files using ext_skel script and modified config.m4 and stat.c files under php4. This is a part of my stat.c file in question. ---------------------------------- ... function_entry_stat_functions[] = { PHP_FE(p_wilcox, NULL) .... PHP_FUNCTION(p_wilcox) { zval **x, **m, **n, **lower, **log_p ; double a, b, c; int t, p; double ret_val; .... convert_to_double_ex(x); ... convert_to_long_ex(log_p) a = (*x)->value.lval; .. p = (*log_p)->value.lval; ret_val=pwilcox(a,b,c,t,p); RETURN_DOUBLE(ret_val); } #endif /* HAVE_STAT */ ------------------------------ On my shell, I tried to test it by tying >./php -f ext/stat/stat.php It gave me --- wilcox allocation error 1 --------- --<stat.php>--- .. $x=6.0; .. $retval = p_wilcox(6.0, 3.0, 4.0, 1, 1); echo "pwilcox="; echo "$retval"; --------------- I do not know how to handle "w" on my stat.c file. I looked into apidoc.txt but due to my shallow c-knowledge, it doesn't help much. Could someone give me a hint to go on ? Thanks. Jinsoo

« previous php.dev (#28342) next »