RE: [PHP-DEV] Re: Object Overloading

2002-09-23 Thread Sam Liddicott



 -Original Message-
 From: Zeev Suraski [mailto:[EMAIL PROTECTED]]
 Sent: 23 August 2002 18:59
 To: Sam Liddicott
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DEV] Re: Object Overloading
 
 
 At 17:09 23/08/2002, Sam Liddicott wrote:
 Or am I missing something obvious?
 
 ZE2 objects are not at all like ZE1 objects.  We're way 
 beyond that point 
 there now :)

Is there any chance I can look at some zend 5 code to see the new model, and
how it might fit with SWIG?

Also, overloaded objects are good, what do you think about overloaded
variables? (And with references these might just become overloaded zvals...
Hmm...) Anyway...

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] help, C property get/set object overloading

2002-09-20 Thread Sam Liddicott

swig wraps C++ objects as zend overloaded objects, the property getters and
setters fall back to storing things in the
Z_OBJPROP_P(property_reference-object) hash but I'm not doing it properly
and I can't work out what I'm doing wrong.

The propget functions are generated like this:

static pval _wrap_propget_ArrayStruct(zend_property_reference
*property_referenc
e) {
  pval result;
  pval **_result;
  zend_llist_element *element = property_reference-elements_list-head;
  zend_overloaded_element *property=(zend_overloaded_element
*)element-data;

  /* Parent class hierachy dispatcher */
  if (_propget_ArrayStruct(property_reference, result)==SUCCESS) return
result;

  /* Nope? return it ourselves from property hash*/
  if
(zend_hash_find(Z_OBJPROP_P(property_reference-object),Z_STRVAL_P((proper
ty-element)),1+Z_STRLEN_P((property-element)),(void**)_result)==SUCCESS)
ret
urn **_result;
  result.type = IS_NULL;
  return result;
}

No the trouble is I don't get reference counting/copying/whatever right,
and, if for example I store a string in the hash, then later, if I read the
string back a few times I find it's value changes, so I'm sure I'm passing
around a free'd zval.

The set function is generated like this:
static int _wrap_propset_ArrayStruct(zend_property_reference
*property_reference
, pval *value) {
  zend_llist_element *element = property_reference-elements_list-head;
  zend_overloaded_element *property=(zend_overloaded_element
*)element-data;
  /* Parent class hierachy dispatcher */
  if (_propset_ArrayStruct(property_reference, value)==SUCCESS) return
SUCCESS;

  /* nope? set it ourselves */
  return
add_property_zval_ex(property_reference-object,Z_STRVAL_P((property-
element)),1+Z_STRLEN_P((property-element)),value);
}

I've tried zval_copy_ctor, SEPERATE_ZVAL and the like both before storing
and after reading but I can't get any joy:

This sort of php script:
?php
// Sample test file

require arrays.php;

$ss=new simplestruct();
$ss-array_c=ab;
var_dump($ss);
var_dump($ss-array_c);
$x=$ss-array_c;
print 1 $x\n;
$x=$ss-array_c;
print 2 $x\n;
$x=$ss-array_c;
print 3 $x\n;
var_dump($x);

?

outputs this:
X-Powered-By: PHP/4.2.1
Content-type: text/html

object(simplestruct)(2) {
  [_cPtr]=
  resource(1) of type (_p_SimpleStruct)
  [array_c]=
  string(2) ab
}
string(2) ab
1 1
2 2
3 3
string(2) T

instead of
string(2) ab
1 ab
2 ab
3 ab
string(2) ab






-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Object Overloading

2002-08-22 Thread Sam Liddicott

Zeev I just wanted to make you aware that not just the Java module, but also
all SWIG generated php modules also use the object overloading propget and
propset way of accessing properties of the wrapped objects.

I hear this was being revamped for zend 2.0 and thought I should let you
know.

SWIG-php works by generating a seperate overloaded class for each wrapped
class, with methods as normal in the method table, but special behaviour to
intercept the getting and setting of properties.

Will the propget/propset system be lost in zend 2.0?

Further for your information; (and I realise not for discussion); the
wrapped class hierachy is mirrored in php (get_parent_class) except where
the wrapped class hierachy uses mutiple inheritance in which case
get_parent_class only returns the main parent class, but class properties
and such from all classes remain available.  I mention this in case zend 2.0
does support multiple inheritance and so you may know how we would use it.

Thanks

Sam





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Only one CXX_SUFFIX

2002-07-25 Thread Sam Liddicott

Is there a great reason why rules_common.mk can't be modified so the suffix
rules work on .cxx as well as .cpp ?
 
Sam
  _  


Samuel Liddicott
Support Consultant
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Tel: +44 (0)113 367 4523
Fax: +44 (0)113 367 4680
Switchboard: +44 (0)113 367 4600

Orange Multimedia Operations
Marshall Mill
Marshall Street
Leeds
LS11 9YJ
 http://www.ananova.com/ www.ananova.com

Ananova Limited Registered Office:
St James Court
Great Park Road
Almondsbury Park
Bradley Stoke
Bristol BS32 4QJ

Registered in England No.2858918

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you receive
this in error, please contact the sender and delete the material from any
computer.

I'm required to have this long signature so please don't pick on me about
it, yes I know it's often longer than the email message it goes with.

 






[PHP-DEV] INTERNAL FEATURE request

2002-07-19 Thread Sam Liddicott

Please can we have a magic cookie resource value or zval associated with
PHP objects accessable via the C API?
 
This would be used when the PHP class it wrapping a C++ class (such as one
linked in via swig ( www.swig.org http://www.swig.org )) so there was a
cheap way to find which C++ object the php object was wrapping.
 
Currently we use _cPtr element of the wrapped object but it is open to
freakery by user scripts.
 
Thanks

SAm
  _  


Samuel Liddicott
Support Consultant
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  
Direct Dial: +44 (0)113 367 4523
Fax: +44 (0)113 367 4680
Switchboard: +44 (0)113 367 4600

Ananova Limited
Marshall Mill
Marshall Street
Leeds
LS11 9YJ

http://www.ananova.com

Registered Office:
St James Court
Great Park Road
Almondsbury Park
Bradley Stoke
Bristol BS32 4QJ
Registered in England No.2858918

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you receive
this in error, please contact the sender and delete the material from any
computer.

 






RE: [PHP-DEV] Persistent overloaded class registration problem,

2002-04-26 Thread Sam Liddicott



 -Original Message-
 From: Andi Gutmans [mailto:[EMAIL PROTECTED]]
 Sent: 25 April 2002 23:14
 To: Sam Liddicott; Sam Liddicott; 'Rasmus Lerdorf'
 Cc: 'PHP Developers Mailing List'
 Subject: Re: [PHP-DEV] Persistent overloaded class 
 registration problem,
 
 
 At 11:11 24/04/2002 +0100, Sam Liddicott wrote:
 My overloaded classes are now registered in MINIT with:
 
 INIT_OVERLOADED_CLASS_ENTRY()
 zend_register_internal_class()
 ..zend_register_list_destructors_ex
 
 And all seems mostly fine;
 
 except the second time apache serves a request, one of the 
 classes (!!) has
 been de-registered!  As shown by get_declared_classes() in 
 the script.
 
 I'm not sure what's happening there. Did you grep the 
 directories under 
 ext/ for examples of how to use zend_register_internal_class()?

Yes, most of it I copied from java/java.c however it turned out to be
another pointer fault (HashPosition * instead of HashPosition) which was
clobbering zend memory, so it works fine now.

Thanks v.much

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Proposal! Destructor notification

2002-04-26 Thread Sam Liddicott

Some know I'm working to improve swig-php to make module generation easy and
satisfying.

The final hurdle remains in handling and generating callbacks from the
module to PHP.  Or rather from the library the module wraps to PHP.

This requires some kind of callback wrapper that can convert from a flat
function pointer the library expects to a complete object-method (or just
function) reference that call_user_function expects.

This problem is solved but it requires some per-callback-function allocation
to hold this extra data.

The new problem is that swig can't tell when the scope of the callback
closes (when no more callbacks will occur) and when it can free this
structure, so for longer lived scripts which make new objects often to
handle callbacks we allocate and do not free ever more and more structures.

If a module could request notification when all/specific objects are
destroyed it would be able to free these structures when the object dies and
thus avoid long term memory leaks.

Are PHP developers willing to provide a mechanism where more than one module
can request notification when objects generally, or specific objects are
destroyed?

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] RE: phpize writes config.m4

2002-04-26 Thread Sam Liddicott

Sorry; wrong list, I get boths lists in the same mailbox and I just replied
to a message already there.

 -Original Message-
 From: Sam Liddicott 
 Sent: 26 April 2002 12:01
 To: [EMAIL PROTECTED]
 Subject: phpize writes config.m4
 
 
 I'm making some more changes to php-swig, where it writes out 
 the sample config.m4 file.
 
 It's pretty complete now but it strikes me that this code 
 should probably be part of phpize.
 
 Most modules have the same requirements for config.m4 (below).
 Perhaps we could have a phpize.in file where we provide the 
 module name, required header and library files and an 
 optional symbol to test compile each library.
 
 Does this make sense?  I've already done it for swig but I 
 think it belongs in phpize
 
 Sam
 
 1) PHP_ARG_WITH
 
 2) search paths for INCDIR looking for certain include files
 
 3) search paths for LIBDIR looking for certain LIBS
 
 4) PHP_REQUIRE_CXX, AC_CHECK_LIB(stdc++, cin) if it is a C++ module
 
 optional 5) AC_CHECK_LIB... to check the library links and a 
 test symbol is present
 
 6) PHP_SUBST(***_SHARED_LIBADD)
AC_DEFINE(HAVE_***, 1, [ ])
AC_DEFINE_UNQUOTED(PHP_***_DIR, $***_DIR, [ ] )
 
 for each library
   PHP_ADD_LIBRARY_WITH_PATH(***, $***_LIBDIR, ***_SHARED_LIBADD)
 
 for include path
   PHP_ADD_INCLUDE($***_INCDIR)
 
 7) PHP_EXTENSION(***, $ext_shared)
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] ?= and %= both work, why not ?php=

2002-04-26 Thread Sam Liddicott



 -Original Message-
 From: Brinkman, Theodore 
 [mailto:[EMAIL PROTECTED]]
 Sent: 26 April 2002 14:55
 To: 'PHP Developers Mailing List'
 Subject: RE: [PHP-DEV] ?= and %= both work, why not ?php=
 
 
 Sure, and its only an extra 4 character, really.  But that's 
 not the issue
 at hand.  The issue at hand is that the inconsistency of 
 supporting ?= and
 %= but not ?php= encourages quite a few people to use the 
 'optional' short
 form tags, meaning that their code isn't portable.

I guy here who till recently poo-poo'd asp tags is now using them because
%=$VAR;% is emminently more readable than the alternative.

 For each person who says ?php= $variable ? is hard to read 
 at least one
 other person says they find ?php echo $variable ? harder to read.  I
 personally find the first easier to read when it is embedded 
 in the middle
 of a long line of HTML (like an input tag for example).

Yep.

 What possible harm comes from improving the internal 
 consistency of the
 language?  Why is a two-line patch that would completely remove an
 inconsistency so bitterly fought against?

To emphasise; people here are adopting bad-old short tags in order to keep
readability of code.  It makes it easy to see the code is passive, echoing
only.

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Persistent overloaded class registration problem,

2002-04-24 Thread Sam Liddicott

My overloaded classes are now registered in MINIT with:

INIT_OVERLOADED_CLASS_ENTRY()
zend_register_internal_class()
..zend_register_list_destructors_ex

And all seems mostly fine;

except the second time apache serves a request, one of the classes (!!) has
been de-registered!  As shown by get_declared_classes() in the script.

Swig is generating all the classes the same way so I'm asking if anyone
might know the cause for this.

The class registration pattern I am following leaves no scope for me to
estrdup or emalloc and the like as zend underlying layers do all this stuff
properly for me.

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Thanks! RE: [PHP-DEV] Persistent overloaded class registration problem,

2002-04-24 Thread Sam Liddicott



 -Original Message-
 From: Markus Fischer [mailto:[EMAIL PROTECTED]]
 Sent: 24 April 2002 11:24
 To: Sam Liddicott
 Cc: 'Rasmus Lerdorf'; 'PHP Developers Mailing List'
 Subject: Re: [PHP-DEV] Persistent overloaded class 
 registration problem,
 
 
 Hi,
 
 it might help if you give a link to some self-contained
 generated source example so we get the full picture.

Good tip and in doing this I found it was a typemap wrapper using
HasPosition *pos instead of HashPositionPos so I was clobbering random
memory.

So thanks to Easmus and Markus for this great help in getting swig-php4
improved.

All works fine now!

The release (1.3.12) is anticipated somewhere around June time according to
the swig maintainer David Beezley.

I anticipate that swig could replace ext_skel as the preferred way to create
php modules; who wants to discuss making this an official position?

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] NOTICE: Wise volunteer needed for PHP module review

2002-04-23 Thread Sam Liddicott

I'm working with Richard Palmer on the php module of SWIG
(http://www.swig.org)

Swig is used to automatically write php, perl, python, guile, java, ruby,
etc etc modules to link 3rd part libraries into these scripting systems.

This means if I have a fancy library libfoo and I want to use it for php,
I just write a single simple interface file (or even use the supplied .h
header file); run swig on it and taraa!!! I have a php module ready to
compile in to php.

Richard and myself are making some _heavy_changes_ to the php module lately
and we need some eagle/gimlet eye to review the output code of some simple
cases to see that we are generating the code correctly - with regards use of
ZVALs, destructors, resource handling, CG() vars and so forth.

My involvement with swig is working on xapian (www.xapian.org) which is the
open muscat descendant; so once we get this sorted we will also have a
xapian module for php; in fact php will be providing the scripting for the
main xapian search  results page supplied with xapian.

I've asked quite a few questions lately here but had no response and so have
had to guess at the answers.

Volunteers to review swig generated code would be appreciated.

regards

Sam Liddicott




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] MINIT or RINIT

2002-04-23 Thread Sam Liddicott

Swig generated code registers some overloaded classes to wrap C classes.

I think it should do this in PHP_MINIT but when I do it here they are only
available as registered for the first apache request.

If I register them in PHP_RINIT then they are always available.

Why would this be so?  Which should I use?

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] MINIT or RINIT

2002-04-23 Thread Sam Liddicott



 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
 Sent: 23 April 2002 11:30
 To: Sam Liddicott
 Cc: PHP Developers Mailing List
 Subject: Re: [PHP-DEV] MINIT or RINIT
 
 
 Well, where are you storing them?  Make sure they are not in 
 memory that
 gets cleaned on a per-request basis.  ie. do your own 
 malloc() in MINIT
 and free() in MSHUTDOWN.

Stupid questions follow:
So... does my zend_class_entry have to be wrapped in CG()?

Right now swig generates lines like:
CG(class_entry).type=...

Can I just do:

zend_class_entry _swig_wrap_;
_swig_wrap_X.type=...

And it also currently does:
CG(class_entry).refcount=(int *)emalloc(sizerof(int));
*CG(class_entry).refcount=1;

I have no idea why it does this; do we need to init refcount?  To anything
simpler?

Thanks

Sam

 
 -Rasmus
 
 On Tue, 23 Apr 2002, Sam Liddicott wrote:
 
  Swig generated code registers some overloaded classes to 
 wrap C classes.
 
  I think it should do this in PHP_MINIT but when I do it 
 here they are only
  available as registered for the first apache request.
 
  If I register them in PHP_RINIT then they are always available.
 
  Why would this be so?  Which should I use?
 
  Sam
 
 
 
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] MINIT or RINIT

2002-04-23 Thread Sam Liddicott



 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
 Sent: 23 April 2002 11:30
 To: Sam Liddicott
 Cc: PHP Developers Mailing List
 Subject: Re: [PHP-DEV] MINIT or RINIT
 
 
 Well, where are you storing them?  Make sure they are not in 
 memory that
 gets cleaned on a per-request basis.  ie. do your own 
 malloc() in MINIT
 and free() in MSHUTDOWN.

This means my class must be declared as ZEND_INTERNAL_CLASS then?
Are there any other side effects to doing this?

Must I un-register my classes during shutdown?  It seems zend does that for
me.

I've made these changes, to use ZEND_INTERNAL_CLASS and malloc and strdup
instead of emalloc and estrdup but now zend hangs on shutdown.

It seems to come round (under gdb) somewhere in _efree, under
zend_hash_destroy under destroy_zend_class
So it sounds like something I did wrong...

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] MINIT or RINIT

2002-04-23 Thread Sam Liddicott

It seems like if I use zend_register_internal_class then I can't make use of
the .function table of my class entry because zend_register_internal class
null's this out.

Is there an entirely good reason for this?

I want the internal class to have its functions registered seperatly with
zend_hash_add(class_entry.function_table,
But I don't want the class damaged at RSHUTDOWN.

Do these desires conflict?
At least I will have to reproduce much of zend_register_internal_class but
preserve the function table.

Are there any other side effects of being ZEND_INTERNAL_CLASS instead of
ZEND_USER_CLASS?  Perhaps it will be safer to register as ZEND_USER_CLASS in
RINIT instead of ZEND_INTERNAL_CLASS in MINIT?

Sam

 -Original Message-
 From: Sam Liddicott 
 Sent: 23 April 2002 15:50
 To: Rasmus Lerdorf; Sam Liddicott
 Cc: PHP Developers Mailing List
 Subject: RE: [PHP-DEV] MINIT or RINIT
 
 
 
 
  -Original Message-
  From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
  Sent: 23 April 2002 11:30
  To: Sam Liddicott
  Cc: PHP Developers Mailing List
  Subject: Re: [PHP-DEV] MINIT or RINIT
  
  
  Well, where are you storing them?  Make sure they are not in 
  memory that
  gets cleaned on a per-request basis.  ie. do your own 
  malloc() in MINIT
  and free() in MSHUTDOWN.
 
 This means my class must be declared as ZEND_INTERNAL_CLASS then?
 Are there any other side effects to doing this?
 
 Must I un-register my classes during shutdown?  It seems zend 
 does that for me.
 
 I've made these changes, to use ZEND_INTERNAL_CLASS and 
 malloc and strdup instead of emalloc and estrdup but now zend 
 hangs on shutdown.
 
 It seems to come round (under gdb) somewhere in _efree, under 
 zend_hash_destroy under destroy_zend_class
 So it sounds like something I did wrong...
 
 Sam
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] MINIT or RINIT

2002-04-23 Thread Sam Liddicott

OK, I just noticed class_entry-builtin_functions which I can probably use.

Sam

 -Original Message-
 From: Sam Liddicott 
 Sent: 23 April 2002 16:19
 To: Sam Liddicott; 'Rasmus Lerdorf'
 Cc: 'PHP Developers Mailing List'
 Subject: RE: [PHP-DEV] MINIT or RINIT
 
 
 It seems like if I use zend_register_internal_class then I 
 can't make use of the .function table of my class entry 
 because zend_register_internal class null's this out.
 
 Is there an entirely good reason for this?
 
 I want the internal class to have its functions registered 
 seperatly with zend_hash_add(class_entry.function_table,
 But I don't want the class damaged at RSHUTDOWN.
 
 Do these desires conflict?
 At least I will have to reproduce much of 
 zend_register_internal_class but preserve the function table.
 
 Are there any other side effects of being ZEND_INTERNAL_CLASS 
 instead of ZEND_USER_CLASS?  Perhaps it will be safer to 
 register as ZEND_USER_CLASS in RINIT instead of 
 ZEND_INTERNAL_CLASS in MINIT?
 
 Sam
 
  -Original Message-
  From: Sam Liddicott 
  Sent: 23 April 2002 15:50
  To: Rasmus Lerdorf; Sam Liddicott
  Cc: PHP Developers Mailing List
  Subject: RE: [PHP-DEV] MINIT or RINIT
  
  
  
  
   -Original Message-
   From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
   Sent: 23 April 2002 11:30
   To: Sam Liddicott
   Cc: PHP Developers Mailing List
   Subject: Re: [PHP-DEV] MINIT or RINIT
   
   
   Well, where are you storing them?  Make sure they are not in 
   memory that
   gets cleaned on a per-request basis.  ie. do your own 
   malloc() in MINIT
   and free() in MSHUTDOWN.
  
  This means my class must be declared as ZEND_INTERNAL_CLASS then?
  Are there any other side effects to doing this?
  
  Must I un-register my classes during shutdown?  It seems zend 
  does that for me.
  
  I've made these changes, to use ZEND_INTERNAL_CLASS and 
  malloc and strdup instead of emalloc and estrdup but now zend 
  hangs on shutdown.
  
  It seems to come round (under gdb) somewhere in _efree, under 
  zend_hash_destroy under destroy_zend_class
  So it sounds like something I did wrong...
  
  Sam
  
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Refcount question

2002-04-18 Thread Sam Liddicott

If I'm writing a C++ extension module and I want return_value to be the same
as this_ptr do I need to increase the ref count of the zval  this_ptr?

Or is it safe just to do as the last line:

return_Value=this_ptr;

or

*return_value=*this_ptr;

or what

??

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] call_user_function()

2002-04-17 Thread Sam Liddicott

What happened with this in the end.

I have a case where call_user_function needs to call a class function
without me having to instantiate a dummy object first.

Sam

 -Original Message-
 From: Andi Gutmans [mailto:[EMAIL PROTECTED]]
 Sent: 26 February 2002 17:13
 To: brad lafountain; [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] call_user_function()
 
 
 Can you send  a unified diff of what call_user_function() 
 would look like 
 with your changes?
 
 Andi
 
 At 06:04 AM 2/25/2002 -0800, brad lafountain wrote:
 Ok,
   I know ive already posted this but no responded. So I'll 
 do it again.
 
 Currently call_user_function() doesn't call overloaded class methods.
 I hacked together a function to get around this. Does anyone 
 want to look 
 at it
 and see if it's gunna mess anything up as far as zend 
 execution. if not put it
 in as part as the normal call_user_function.
 
 int my_call_user_function(HashTable *function_table, zval 
 **object_pp, zval
 *function_name, zval *retval_ptr, int param_count, zval 
 *params[] TSRMLS_DC)
 {
  if(call_user_function(function_table, object_pp, 
 function_name, 
  retval_ptr,
 param_count, params TSRMLS_CC) == FAILURE)
  {
  
 if(Z_OBJCE_PP(object_pp)-handle_function_call != NULL)
  {
  zend_overloaded_element overloaded_element;
  zend_property_reference property_reference;
  zend_function_state function_state;
  zend_function_state 
 *original_function_state_ptr;
  int i;
 
  overloaded_element.element = *function_name;
  overloaded_element.type = OE_IS_METHOD;
 
  function_state.function = (zend_function *) 
  emalloc(sizeof(zend_function));
  function_state.function-type = 
  ZEND_OVERLOADED_FUNCTION;
  
 function_state.function-common.arg_types = NULL;
  
 function_state.function-overloaded_function.function_name =
 Z_STRVAL_P(function_name);
 
  property_reference.object = *object_pp;
  property_reference.type = BP_VAR_NA;
  property_reference.elements_list = 
 (zend_llist
 *)emalloc(sizeof(zend_llist));
  
 zend_llist_init(property_reference.elements_list,
 sizeof(zend_overloaded_element), NULL, 0);
  
 zend_llist_add_element(property_reference.elements_list,
 overloaded_element);
 
  //Build argument stack
  for(i = 0;i  param_count;i++)
  
 zend_ptr_stack_push(EG(argument_stack), 
  params[i]);
  
 zend_ptr_stack_n_push(EG(argument_stack), 2, 
  (void *)param_count, NULL);
 
  EG(function_state_ptr) = function_state;
  
 Z_OBJCE_PP(object_pp)-handle_function_call(param_count, retval_ptr,
 *object_pp, 1 TSRMLS_CC, property_reference);
  EG(function_state_ptr) = 
 original_function_state_ptr;
 
  
 zend_llist_destroy(property_reference.elements_list);
  efree(property_reference.elements_list);
  efree(function_state.function);
 
  zend_ptr_stack_clear_multiple(TSRMLS_C);
  return SUCCESS;
  }
  }
 }
 
 
 __
 Do You Yahoo!?
 Yahoo! Sports - Coverage of the 2002 Olympic Games
 http://sports.yahoo.com
 
 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] call_user_func_array bug

2002-04-15 Thread Sam Liddicott

call_user_func_array and family support methods and functions but not class
methods.

I'm using swig to generate the php module for xapian (was OpenMuscat) and
want to patch swig so that methods shadow classes can take variable numbers
of arguments.  The shadow methods need to pass on the same number of
arguments using get_args() and call_user_func_array, but can't because
call_user_func_array can't call a class method.  

Is there a good reason why call_user_func_array doesn support class methods?

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Autoconf 2.52 and Open Muscat

2002-02-05 Thread Sam Liddicott

Yes!! The good news is that what was open muscat but that is now xapian
(www.xapian.org) is having it's php module finished this week!
[The muscat module will expire and be replaced by Xapian, a much more
comprehensive module]

The trouble is Xapian prefers autoconf 2.52 as it provides
large-file-support test macros for all platforms; but php chokes on this
version of autoconf for some reason; the same reason many other packages
choke on it; e.g.:
http://archive.linuxfromscratch.org/mail-archives/blfs-support/2001/11/0014.
html

So I thought I would bring the pendig autoconf 2.52 changes to the attention
of those concerned and then leave them to address it at their leisure.

Thanks guys.

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] NEW PHP standalone compiler (was Re: [PHP-DEV] Here we try again)

2002-02-04 Thread Sam Liddicott



 -Original Message-
 From: Hartmut Holzgraefe [mailto:[EMAIL PROTECTED]]
 Sent: 01 February 2002 11:20
 To: Sam Liddicott
 Cc: Stig S. Bakken; Manuel Lemos; [EMAIL PROTECTED];
 [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] NEW PHP standalone compiler (was Re: [PHP-DEV]
 Here we try again)
 
 
 Sam Liddicott wrote:
 have you had a look on php4/Zend/LICENSE lately ? ;)
  
  Yes, I checked it minutes before sending out my mail.  Have you?
 
 so you've noticed the difference between CVS revision 1.5 and 1.6
 of that file?

No I checked the one on the web site, url provided at the time, but you
could stop playing games and get to the point.

[goes off to check]
I'm not sure which file you meant by that file.

http://cvs.php.net/cvs.php/php4
 LICENSE   1.17   imajes   3 daysupdating license to 2002 (hasn't been
done since 2000)  

Not version 1.5 or 1.6 and no significant changes.

Sam





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] NEW PHP standalone compiler (was Re: [PHP-DEV] Here we try again)

2002-02-01 Thread Sam Liddicott



 -Original Message-
 From: Hartmut Holzgraefe [mailto:[EMAIL PROTECTED]]
 Sent: 31 January 2002 10:15
 To: Sam Liddicott
 Cc: Stig S. Bakken; Manuel Lemos; [EMAIL PROTECTED];
 [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] NEW PHP standalone compiler (was Re: [PHP-DEV]
 Here we try again)
 
 
 Sam Liddicott wrote:
 
  The Zend Open Source license
  http://www.php.net/license/ZendGrant/ZendGrant3.png
  and http://www.php.net/license/ZendGrant/ZendGrant4.png 
 (see 5a) you MUST
  provide the source to software which links with it.  It 
 will take lawyers to
  decide if compiled php which requires the runtime to run 
 is included.
 
 have you had a look on php4/Zend/LICENSE lately ? ;)

Yes, I checked it minutes before sending out my mail.  Have you?

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] NEW PHP standalone compiler (was Re: [PHP-DEV] Here we try again)

2002-01-31 Thread Sam Liddicott



 -Original Message-
 From: Stig S. Bakken [mailto:[EMAIL PROTECTED]]
 Sent: 31 January 2002 08:49
 To: Manuel Lemos
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] NEW PHP standalone compiler (was Re: [PHP-DEV]
 Here we try again)
 
 Unless I'm mistaken, Java doesn't have eval.  Any language with eval
 needs a runtime environment when executing, even if the rest 
 of the code
 is converted to C.

Which has licensing implications due to the terms of the PHP License.

The Zend Open Source license
http://www.php.net/license/ZendGrant/ZendGrant3.png
and http://www.php.net/license/ZendGrant/ZendGrant4.png (see 5a) you MUST
provide the source to software which links with it.  It will take lawyers to
decide if compiled php which requires the runtime to run is included.

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] maybe serious error in RC3 memory manager

2001-11-26 Thread Sam Liddicott



 -Original Message-
 From: Stig Venaas [mailto:[EMAIL PROTECTED]]
 Sent: 26 November 2001 10:22
 To: Oleg Khimich
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] maybe serious error in RC3 memory manager
 
 
 On Mon, Nov 26, 2001 at 11:38:52AM +0200, Oleg Khimich wrote:
  On my FreeBSD 4.3 php4.1.0rc3 not failing, but message 
 maximum execution time... appeared.
  PHP4.2.0-dev core dumped after some time.
 
 Good to see I'm not the only one. I see now that I should 
 have read the
 CGI quick cleanup thread. I think this should be fixed, but actually
 when running as CGI/standalone it would be good to just exit without
 freeing all the memory the nice way. In that thread it's suggested to
 turn off fast cache, but couldn't we by default exit quickly when run
 as standalone? 

I think it should; turning off fast-cache was just a quick fix which I
haven't tried in case it slows down access to all those array items; not
being sure what fast cache is actually for.

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] CGI quick cleanup

2001-11-23 Thread Sam Liddicott

I am using PHP for a system script to import TV listings to a database.

It works well but creates 20,000  to 30,000 hash elements with various
relationships and it *seems* to take exponentially longer for the script to
actually stop running after it reaches the exit statement the more items
there are.

I also note that even though max execution time is set to zero and the
script runs for a long time, I still get a max-execution error at 30 seconds
after the script has been trying to exit (although the script runs for many
minutes).  30 seconds is the timeout in the php.ini which I override with
ini_set.

I think this long shutdown time is PHP's per-page cleanup freeing all the
objects, which is not so important if running as a CGI.

Currently I am quitting with 
posix_kill(posix_getpid(),5)
as it is pretty quick

but I wondered if the per-page cleanup which is only important when running
as an apache module could be disabled in cgi mode.

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] CGI quick cleanup

2001-11-23 Thread Sam Liddicott

I should add that without the kill -5 it takes longer for the script to
finally exit than it took to execute!

Sam

 -Original Message-
 From: Sam Liddicott [mailto:[EMAIL PROTECTED]]
 Sent: 23 November 2001 10:35
 To: [EMAIL PROTECTED]
 Subject: [PHP-DEV] CGI quick cleanup
 
 
 I am using PHP for a system script to import TV listings to a 
 database.
 
 It works well but creates 20,000  to 30,000 hash elements with various
 relationships and it *seems* to take exponentially longer for 
 the script to
 actually stop running after it reaches the exit statement 
 the more items
 there are.
 
 I also note that even though max execution time is set to zero and the
 script runs for a long time, I still get a max-execution 
 error at 30 seconds
 after the script has been trying to exit (although the script 
 runs for many
 minutes).  30 seconds is the timeout in the php.ini which I 
 override with
 ini_set.
 
 I think this long shutdown time is PHP's per-page cleanup 
 freeing all the
 objects, which is not so important if running as a CGI.
 
 Currently I am quitting with 
 posix_kill(posix_getpid(),5)
 as it is pretty quick
 
 but I wondered if the per-page cleanup which is only 
 important when running
 as an apache module could be disabled in cgi mode.
 
 Sam
 
 
 
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] CGI quick cleanup

2001-11-23 Thread Sam Liddicott



 -Original Message-
 From: Teodor Cimpoesu [mailto:[EMAIL PROTECTED]]
 Sent: 23 November 2001 10:54
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] CGI quick cleanup
 
 
 Hi Edin!
 On Fri, 23 Nov 2001, Edin Kadribasic wrote:
 
  I have noticed the same problem with a scipt that used a 
 very large array
  (~160 MB). The script run time was around 35 seconds, while 
 it took over 4
  minutes to shut down! Same amount of time was used in 
 trying to unset() the
  array.
 
 [wild guess]
 probably the memory deallocation is the one expensive here.
 
 BTW, don't use large arrays in PHP as Apache module cause 
 when the process
 grows requesting more memory (brk(2)) it cannot release it back to the
 system (because the httpd process is still running).

To solve THIS problem I added ap_child_terminate support to php so you could
request apache to terminate after the page, though this seems to have been
dropped in later releases.
The patch was accepted and did appear in at least one release, I don't know
why it went.

But our problem is not as an apache module but as a system script, using php
-q

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] CGI quick cleanup

2001-11-23 Thread Sam Liddicott



 -Original Message-
 From: Markus Fischer [mailto:[EMAIL PROTECTED]]
 Sent: 23 November 2001 11:16
 To: Sam Liddicott
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] CGI quick cleanup
 
 
 On Fri, Nov 23, 2001 at 11:01:03AM -, Sam Liddicott wrote : 
  To solve THIS problem I added ap_child_terminate support to 
 php so you could
  request apache to terminate after the page, though this 
 seems to have been
  dropped in later releases.
  The patch was accepted and did appear in at least one 
 release, I don't know
  why it went.
 
 I found this in php4/sapi/apache/php_apache.c :

[apache_child_terminate function deleted]

heh!  Thanks.

 However, it doesn't seem to be documented (couldn't find it
 in the manual). But yes, not really relevant because you're
 using a system script.

Hmm.  What do I need to do to get this documented then?

Thanks

Sam




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] CGI quick cleanup

2001-11-23 Thread Sam Liddicott

Here's a sample script that does most of the sorts of stuff I was doing
apart from database work.

Note how long it takes to exit after finishing.

#! /usr/bin/php -q
?php

ini_Set(max_execution_time,0);
ini_Set(memory_limit,500M);

class thingy {
  function thingy($c) {
if ($c0) $this-ref=new thingy($c-1);
  }
}

$stash=array();
$max=50;

$start=time();

for($i=0;$i$max;$i++) {
  $r=rand(0,300);
  $stash[$r][]=new thingy(rand(0,10));
  echo \rUse: .floor($i/$max*100).% ;
}
echo \n;

$mid=time();

$max=count($stash);
$c=0;
foreach(array_keys($stash) as $key) {
  unset($stash[$key]);
  $c++;
  echo \rFree: .floor($c/$max*100).% ;
}
unset($stash);
echo \n;

$done=time();

print Use: .($mid-$start).\n;
print Free: .($done-$mid).\n;


?
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] german umlauts!

2001-09-03 Thread Sam Liddicott



 -Original Message-
 From: Andre Lacour [mailto:[EMAIL PROTECTED]]
 Sent: 03 September 2001 09:28
 To: Php-Dev
 Subject: [PHP-DEV] german umlauts!
 
 
 strtoupper()  strtoulower() does not work with german 
 umlauts (äöü/ÄÖÜ).

Perhaps it depends on what your php locale is (as opposed to your web page
characterset).

Sam




--
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] SLEEP and MAXEXECUTIONTIME and NAUGHTY modules

2001-02-28 Thread Sam Liddicott



 -Original Message-
 From: Andi Gutmans [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 27, 2001 08:03
 To: Sam Liddicott; [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] SLEEP and MAXEXECUTIONTIME and NAUGHTY modules
 
 
 At 12:11 PM 2/26/2001 +, Sam Liddicott wrote:
 I notice that usleep and sleep both clash on solaris with
 Max-execution-time.
 
 1) I notice various modules using sleep:
 db, hyperwave, mysql, oci8, satellite
 which seems to break max execution time.
 
 Any idea why and where they are using sleep()?

Further investigation seems to reveal that use of alarm in OCI8 (oracle
supplied libs actually) on solaris combined with lwp_alarm and oracle
threading issue are breaking max execution time.  However to answer the
question:

db: db.c in php_dbm_open() for an NFS locking loop:
if (lock) {
...
#if NFS_HACK
...
php_sleep(1)


hyperwave: hg_comm.c in hg_read()/hg_write(), php_sleep used with
non-blocking socket to allow up to 5 seconds to try and read.  IMHO they
should either block or return what bytes are available and let the user deal
with it.  5 seconds is pretty arbitrary.


With mysql one use is a BSD threading broken select hack so I guess its no
issue for now.
The other mysql use is in my_write.c function my_write and is used to allow
a full file system to empty somewhat so the write can succeed.

oci8: oci8.c calls php_sleep(3) in oci_failover_callback()

satellite was a read herring.

standard: uniqid.c in PHPFUNCTION(uniqid) uses usleep(1) to wait for more
entropy, usleep also uses sigalarm and may break other alarms on some
systems.


It appears that all these uses of sleep could be replaced by the #define
sleep with the select function below

 2) Could we not use:
 
 #include unistd.h
 #define sleep(n) \
   { struct timeval tv; \
 tv.tv_sec=n; \
 tv.tv_usec=0; \
 select(0,NULL,NULL,NULL,tv); \
   }
 
 Where did you see that?

I just made it up; left over from my perl days where
select(undef,undef,undef,$msecs); was traditionally used for small sleeps.

It compiles into PHP fine that way on solaris, but #include unistd.h is
needed early because it (on Solaris) declares sleep and sleep being #defined
first breaks the declaration.

I'm not entirely happy with it, and other uses of ALARM will break max
execution time anyway...
Maybe the above should be PHP_SLEEP which I note some modules use, then we
can persuade developers to use PHP_SLEEP instead.

Not ot mention, I put it into main/php_config.h (after running configure)
but I'm not sure if this is included by all units which use sleep.  Hmmm...

What do you think?

Sam

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] SLEEP and MAXEXECUTIONTIME and NAUGHTY modules

2001-02-26 Thread Sam Liddicott

I notice that usleep and sleep both clash on solaris with
Max-execution-time.

1) I notice various modules using sleep:
db, hyperwave, mysql, oci8, satellite
which seems to break max execution time.

2) Could we not use:

#include unistd.h
#define sleep (n) \
 { struct timeval tv; \
   tv.tv_sec=n; \
   tv.tv_usec=0; \
   select(0,NULL,NULL,NULL,tv); \
 }

as well as being more accurate it would not break max-execution-time.

And while we are at it define php_msleep for milliseconds?

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] RE: PHP 4.0 Bug #9064 Updated: Functions inside functions cause errors if the outer function is called twice.

2001-02-02 Thread Sam Liddicott



 -Original Message-
 From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 02, 2001 09:49
 To: Christopher Kings-Lynne
 Cc: Bug Database
 Subject: Re: [PHP-DEV] RE: PHP 4.0 Bug #9064 Updated: Functions inside
 functions cause errors if the outer function is called twice.
 
 
 
 What does that buy you that this doesn't?
 
 function test2() {
echo "hi";
 }
 
 function test() {
test2();
 }
 
 ...other than a new scoping rule?

Don't underestimate scoping, it means you can have multiple test2()'s [lest
call it "sort" - common to use different sort routines in different
circumstances]

a) stops namespace polution
b) keeps access private
while 
c) retaining modularisation.

Sam

 
 
 Christopher Kings-Lynne writes:
  Shouldn't you at least be able to register the "nested 
 function" as 'static?
  
  This causes syntax errors in 4.0.4pl1.
  
  ie:
  
  ?php
  
  function test() {
  static function test2() {
  echo "hi";
  }
  
  test2();
  }
  
  test();
  test();
  test();
  
  ?
  
   -Original Message-
   From: Bug Database [mailto:[EMAIL PROTECTED]]
   Sent: Friday, February 02, 2001 5:14 PM
   To: [EMAIL PROTECTED]
   Subject: PHP 4.0 Bug #9064 Updated: Functions inside 
 functions cause
   errors if the outer function is called twice.
  
  
   ID: 9064
   Updated by: hholzgra
   Reported By: [EMAIL PROTECTED]
   Old-Status: Open
   Status: Closed
   Bug Type: Scripting Engine problem
   Assigned To:
   Comments:
  
   php has no "nested function" feature like you'll find in PASCAL
   or in gcc if you enable the feature
  
   what happens here is that test2 is registered on execution of
   test in the global namespace, and when you call test a second time
   it cannot register test2 again
  
   (the engine shouldn't  accept nested functions at all i think)
  
   Previous Comments:
   --
   -
  
   [2001-02-01 22:18:32] [EMAIL PROTECTED]
   This script fails with:
  
   bFatal error/b:  Cannot redeclare test2() in b-/b on line
   b4/bbr
  
   ?php
  
   function test() {
 function test2() {
 echo "hi";
 }
  
 test2();
   }
  
   test();
   test();
   test();
  
   ?
  
   --
   -
  
  
   Full Bug description available at: http://bugs.php.net/?id=9064
  
  
  
  -- 
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
  
 
 -- 
 ++
 |Torben Wilson [EMAIL PROTECTED]Adcore Finland|
 |http://www.coastnet.com/~torbenhttp://www.adcore.com|
 |Ph: 1.604.709.0506 [EMAIL PROTECTED]|
 ++
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] gawk at awk

2001-02-02 Thread Sam Liddicott


./configure selects gawk over awk if present (very nice) 
but buildconf does not, it uses awk over gawk, but on solaris awk has
serious line-length limits which prevent buildconf from working.

Is there any reason not to try and use gawk first for buildconf?

Has anybody replaced solaris awk with gawk - any reason why I should not do
the same?

Sam

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] Destruct order/What is reference counted?

2001-01-30 Thread Sam Liddicott



 -Original Message-
 From: Sam Liddicott [mailto:[EMAIL PROTECTED]]
 Sent: Monday, January 29, 2001 05:22
 To: [EMAIL PROTECTED]
 Subject: [PHP-DEV] Destruct order/What is reference counted?
 
 
 Are resources refence counted, or variables?
 
 I have a muscat_module method I wrote which is of the form:
 
 $new_resource=make_new_object($old_resource);
 
 each resource is a C++ object, and I have to stop $old_resource being
 disposed of until $new_resource has also been disposed of.

To be more accurate, when old_resource is disposed of it will dispose of any
remaining underlying new_resource objects, leaving a load of invalid
new_resource's which will then be free'd later - unsuccessfully.

So I either need to preserve the life of the underlying old_resource until
all visible new_resources are finished, or find some way to mark the
remaining new_resources as invalid.

 It seems like there is no destroy order at end-of-page time?
 Whats the best way to enforce it?
 
 I think I am going to have to wrap all the C++ objects in more C++ to
 implement reference counting- aggh.  Surely there is another way?
 
 Sam
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Destruct order/What is reference counted?

2001-01-29 Thread Sam Liddicott

Are resources refence counted, or variables?

I have a muscat_module method I wrote which is of the form:

$new_resource=make_new_object($old_resource);

each resource is a C++ object, and I have to stop $old_resource being
disposed of until $new_resource has also been disposed of.

This is a strict condition, even at end-of-php-page-mass-destruction time.

It seems like there is no destroy order at end-of-page time?
Whats the best way to enforce it?

I think I am going to have to wrap all the C++ objects in more C++ to
implement reference counting- aggh.  Surely there is another way?

Sam

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] php eating carriage returns?

2001-01-26 Thread Sam Liddicott



 -Original Message-
 From: Monte Ohrt [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 26, 2001 03:17
 To: [EMAIL PROTECTED]
 Subject: [PHP-DEV] php eating carriage returns?
 
 
 example:
 
 
 This is a test
 
 ? print "testing1"; ?
 ? print "testing2"; ?
 ? print "testing3"; ?
 
 When I run this from the command line (4.0.5dev) I get the following
 output:
 
 
 
 This is a test
 
 testing1testing2testing3
 done.
 
 
 
 Why are there not carriage returns between the print 
 statements? Is this
 an intended behavior?

Yes.
1) Its not carriage returns but br (and others) which start new lines for
html
2) If you want a carriage return (or linefeed as is usual) do
  print "Blah\n";
to start a new line in html and text,
  print "blahbr\n";

Sam

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] le_ why static?

2001-01-26 Thread Sam Liddicott

Why are le_* garbage destructor handles declared static?

As far as I can tell this means other c files in the same module can't
"extern" it but as it is static in file scope it has none of the other
benefits of being static?

Is it to do with threading?  What?

Sam

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] c++ files as module

2001-01-22 Thread Sam Liddicott



 -Original Message-
 From: Sascha Schumann [mailto:[EMAIL PROTECTED]]
 Sent: Monday, January 22, 2001 03:13
 To: Sam Liddicott
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DEV] c++ files as module
 
 
  Is:
AC_ADD_LIBRARY(stdc++)
 
  also my responsibility in config.m4?  [My associated 3rd 
 party .a's seem to
  require it]
 
 Not necessarily.  Do you need to perform any linkage tests in
 your config.m4 with that third party library?

No, Idon't do any linkage tests; but if I don't do it, at php link time I
get errors of various istream, ostream etc unresolved links.  If I do it, it
links fine.

Sam

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] c++ files as module

2001-01-22 Thread Sam Liddicott

Yes, the 3rd example worked - but then so did taking it all out altogther.
I've been having various linking problems all day as I try and combine c and
cpp modules with global variables and such, and can only think that various
use of extern "C" { and such have been causing problems.

So for now, I don't seem to explicilty mention stdc++ at all and it all
links fine

I'll get back if I discover something else.

THanks

Sam

 -Original Message-
 From: Sascha Schumann [mailto:[EMAIL PROTECTED]]
 Sent: Monday, January 22, 2001 03:52
 To: Sam Liddicott
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DEV] c++ files as module
 
 
  No, Idon't do any linkage tests; but if I don't do it, at 
 php link time I
  get errors of various istream, ostream etc unresolved 
 links.  If I do it, it
  links fine.
 
 Perhaps we should provide a macro for that purpose, as the
 standard C++ library is available under various names:
 
 AC_CHECK_LIB(C, cin)
 AC_CHECK_LIB(g++, cin)
 AC_CHECK_LIB(stdc++, cin)
 AC_CHECK_LIB(cxx, cin)
 
 I think it would be fine, if you would use the third test
 until we decide to improve this area.
 
 - Sascha
 
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] linux c++ __rethrow link error

2001-01-22 Thread Sam Liddicott

I get this error when compiling my muscat module for php on linux but no
solaris:

/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/ext/muscat/muscatapi.cpp:107:
undefined reference to `__rethrow'

Needless to say I don't refer to __rethrow anywhere; the actual line is:
muscatapi = new MuscatAPIlocal(muscatHome,memSize);

and for the purposes of this test was the last line of the function.

Has anyone come accross this with c++ module before?

Thanks

Sam


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] c++ files as module

2001-01-19 Thread Sam Liddicott

I'm trying to add some .cpp files to the muscat module, the hard part is
getting them compiled!

My Makefile.in is:
LTLIBRARY_NAME= libmuscat.la
LTLIBRARY_SOURCES = muscat.c muscat_net.c
LTLIBRARY_SOURCES_CPP = muscatapi.cpp
LTLIBRARY_SHARED_NAME = muscat.la
LTLIBRARY_SHARED_LIBADD  = $(MUSCAT_SHARED_LIBADD)
LTLIBRARY_OBJECTS_X = $(LTLIBRARY_SOURCES_CPP:.cpp=.lo)

include $(top_srcdir)/build/dynlib.mk


I've tried to rip bits off qtdom module, one of the few others that uses
C++; but no joy.
Without the LTLIBRARY_OBJECTS_X it doesn't build muscatapi.o from
muscatapi.cpp at all; with it I get:
make[4]: Entering directory
`/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/ext/muscat'
I. -I/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/ext/muscat
-I/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/main
-I/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4
-I/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/Zend
-I/usr/local/empower/include
-I/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/ext/mysql/libmysql
-I/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/ext/xml/expat/xmltok
-I/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/ext/xml/expat/xmlparse
-I/tmp/muscat-php.1.1/1.1.C010/10/php-4.0.4/TSRM  -DXML_BYTE_ORDER=12   -c
muscatapi.cpp  touch muscatapi.lo
/bin/sh: I.: command not found
make[4]: [muscatapi.lo] Error 127 (ignored)

Whats the official rules on Makefile.in to have .cpp files build, AND where
SHOULD I have looked to find this.

Thanks

Sam

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] Octal numbers and automatic conversions

2001-01-16 Thread Sam Liddicott

I remember this showing up years ago in an online java mortgage calculator
giving embarrasingly far-out results.

Only there the bug was the "other way round".

In this case my opinion is that it is behaving as expected and no error.
If the programmer writes 070 he probably means octal, but that doesn't mean
every user and zero-padded string means octal.

I hope the behaviour is not changed; or we may get bad mortage calculators
again.

Sam

 -Original Message-
 From: Sergio Bruder [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 16, 2001 02:01
 To: [EMAIL PROTECTED]
 Subject: [PHP-DEV] Octal numbers and automatic conversions
 
 
 This snippet shows what I consider a problem: The automatic conversion
 string-integer doesnt interprets '070' as an octal, giving 
 57 in the first
 echo (correct) and 71 in the second (wrong).
 
 ?
 echo (070  +1). "BR\n";
 echo ('070'+1). "BR\n";
 ?
 
 Sergio Bruder
 
 -- 
  (http://distro.conectiva.com.br
  )) (tm)  http://sergio.bruder.net
 |""|-.http://pontobr.org
 |__|-'[EMAIL PROTECTED], [EMAIL PROTECTED]
 --
 
 pub  1024D/0C7D9F49 2000-05-26 Sergio Devojno Bruder 
 [EMAIL PROTECTED]
  Key fingerprint = 983F DBDF FB53 FE55 87DF  71CA 6B01 
 5E44 0C7D 9F49
 sub  1024g/138DF93D 2000-05-26
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]