Newsgroups: php.internals,php.pecl.dev Path: news.php.net Xref: news.php.net php.internals:6289 php.pecl.dev:236 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23247 invoked by uid 1010); 8 Dec 2003 18:50:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 23204 invoked by uid 1007); 8 Dec 2003 18:50:28 -0000 Message-ID: <20031208185028.23203.qmail@pb1.pair.com> To: internals@lists.php.net, pecl-dev@lists.php.net Reply-To: "Justin Hannus" Date: Mon, 8 Dec 2003 13:45:33 -0500 Lines: 33 Organization: vci X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Posted-By: 209.244.152.156 Subject: REGISTER_*_CONSTANT() or SET_VAR_*() with multiple strings constants From: jhannus@visualconceptsinc.com ("Justin Hannus") sent to php.pecl.dev and php.internals -------------------------- I'm building an extension that will need to register multiple (approx 250 (up to 48 chars per string)) strings as constants. I would rather not clutter up the namespace with all these constants so I was wondering what would the recommended way to achieve this would be? A. Should I normalize the constants by mapping them to int's and create a few ZEND_FUNCTION(ext_import_*_constants) functions and use SET_VAR_LONG() and internally have a static char *php_ext_map_constant(int c) that maps the php int constants to a string? B. Go all out and use REGISTER_STRING_CONSTANT[L]() in the ext's startup? C. Or, just create an include php file with all the constants defined()'d from php code and distribute with ext or package as PEAR? D. Ignore constants and let the users type the string themselves. I noticed one other ext (syslog) that does something like this with define_syslog_variables(). I also toyed with the idea of creating zend_object's that hold these constant to avoid cluttering up the namespace but I need this to work for php 4-5 and I'm not sure that 4 supports read-only class variables. Any thoughts on this would be appreciated. Thanks, -- Justin Hannus Lead Programmer/Web Development jhannus@visualconceptsinc.com www.visualconceptsinc.com [860] 242.1150 ext.125 [860] 242.1446 fax