/*
  +----------------------------------------------------------------------+
  | PHP Version 5                                                        |
  +----------------------------------------------------------------------+
  | Copyright (c) 1997-2009 The PHP Group                                |
  +----------------------------------------------------------------------+
  | This source file is subject to version 3.01 of the PHP license,      |
  | that is bundled with this package in the file LICENSE, and is        |
  | available through the world-wide-web at the following url:           |
  | http://www.php.net/license/3_01.txt                                  |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to          |
  | license@php.net so we can mail you a copy immediately.               |
  +----------------------------------------------------------------------+
  | Author: Anatol Belski ab@php.net                                     |
  +----------------------------------------------------------------------+
*/

/* $Id: php_gender.h 330002 2013-04-04 17:46:59Z ab $ */

#ifndef PHP_GENDER_H
#define PHP_GENDER_H

extern zend_module_entry gender_module_entry;
#define phpext_gender_ptr &gender_module_entry

#ifdef PHP_WIN32
#define PHP_GENDER_API __declspec(dllexport)
#else
#define PHP_GENDER_API
#endif

#ifdef ZTS
#include "TSRM.h"
#endif

#define PHP_GENDER_VERSION "0.9.0"

PHP_MINIT_FUNCTION(gender);
PHP_MSHUTDOWN_FUNCTION(gender);
PHP_MINFO_FUNCTION(gender);

PHP_METHOD(Gender, __construct);
PHP_METHOD(Gender, get);
PHP_METHOD(Gender, connect);
PHP_METHOD(Gender, trace);
PHP_METHOD(Gender, country);
PHP_METHOD(Gender, similarNames);
PHP_METHOD(Gender, isNick);

#ifdef ZTS
#define GENDER_G(v) TSRMG(gender_globals_id, zend_gender_globals *, v)
#else
#define GENDER_G(v) (gender_globals.v)
#endif

/* data modes list */
#define DATA_MODE_ORIGINAL 0
#define DATA_MODE_SQLITE 1
#define DATA_MODE_MYSQL 2
#define DATA_MODE_POSTGRES 3

ZEND_BEGIN_MODULE_GLOBALS(gender)
	int dummy;
ZEND_END_MODULE_GLOBALS(gender)

ZEND_EXTERN_MODULE_GLOBALS(gender)

struct ze_gender_obj {
	zend_object zo;
    int  internal_mode;
    php_stream *f_names;
    int  line_size;
    long record_count;
    long cache_p [CACHE_LOOKBACK_COUNT];
    char cache_text [CACHE_LOOKBACK_COUNT] [MAX_LINE_SIZE+1];

    char up_and_conv[HASH_COUNT];
    char sortchar [HASH_COUNT];
    char sortchar2[HASH_COUNT];
    char upperchar[HASH_COUNT];

    int ph_hash_group_begin[17];
    int ph_hash_group_end[17];
    int ph_rules_hash_del_ins [HASH_COUNT];
    int ph_rules_hash_replace [HASH_COUNT];

    char trace_buffer[2001];
    char input_buffer_1 [101];
    char input_buffer_2 [101];
    char output_buffer [2002];

    int data_mode;
    char *dsn;
	int internal_dict;
};

#endif	/* PHP_GENDER_H */


/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 * vim600: noet sw=4 ts=4 fdm=marker
 * vim<600: noet sw=4 ts=4
 */
