diff --git a/configure.ac b/configure.ac
index 60cadb3..575674b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,7 +15,7 @@ dnl Compute the canonical host-system type
AC_CANONICAL_HOST
dnl Put macro definitions here (though they aren't used).
-AC_CONFIG_HEADER([src/include/config.h])
+AC_CONFIG_HEADER([src/config.h])
dnl Initialise automake stuff.
AM_INIT_AUTOMAKE
@@ -368,7 +368,7 @@ dnl ---------------------------------------------------------------------------
dnl AC_CONFIG_FILES(Makefile)
dnl AC_CONFIG_FILES(src/extension/Makefile)
dnl AC_CONFIG_FILES(src/plugin/Makefile)
-AC_CONFIG_FILES(src/include/php3270.h)
+AC_CONFIG_FILES(src/php3270.h)
dnl ---------------------------------------------------------------------------
dnl Output the generated config.status script.
diff --git a/pw3270-php5.cbp b/pw3270-php5.cbp
new file mode 100644
index 0000000..601524e
--- /dev/null
+++ b/pw3270-php5.cbp
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/config.h.in b/src/config.h.in
new file mode 100644
index 0000000..26b3ff5
--- /dev/null
+++ b/src/config.h.in
@@ -0,0 +1,51 @@
+/**
+ * @file config.h
+ *
+ * @brief Configuração para o aplicativo.
+ *
+ * Gerado automaticamente pelo processo ./configure esse arquivo descreve
+ * as configurações de ambiente detectadas automaticamente.
+ *
+ * @author perry.werneck@gmail.com
+ *
+ */
+
+#ifndef CONFIG_H_INCLUDED
+
+ #define CONFIG_H_INCLUDED 1
+
+ /**
+ * @brief Nome do pacote.
+ */
+ #undef PACKAGE_NAME
+
+ /**
+ * @brief Versão atual.
+ */
+ #undef PACKAGE_VERSION
+
+ /**
+ * @brief Revisão svn quando o pacote foi configurado.
+ *
+ */
+ #undef PACKAGE_REVISION
+
+ /**
+ * @brief Descrição do aplicativo.
+ */
+ #undef PACKAGE_DESCRIPTION
+
+ /**
+ * @brief Indica se o compilador atual possui suporte a "visibility"
+ *
+ * Quando disponível indica que o compilador atual permite tornar
+ * visíveis numa biblioteca apenas as funções declaradas para isso
+ * evitando que todos os símbolos fiquem visíveis.
+ *
+ * Isso permite um melhor controle sobre quais funções podem ser usados
+ * pelo programa principal.
+ *
+ */
+ #undef HAVE_GNUC_VISIBILITY
+
+#endif // CONFIG_H_INCLUDED
diff --git a/src/get.cc b/src/get.cc
new file mode 100644
index 0000000..94c7093
--- /dev/null
+++ b/src/get.cc
@@ -0,0 +1,108 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Este programa está nomeado como get.cc e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ * Referências:
+ *
+ * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
+ *
+ */
+
+ #include "php3270.h"
+
+/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
+
+PHP_METHOD(tn3270, isconnected)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ RETURN_BOOL(obj->hSession->is_connected());
+}
+
+PHP_METHOD(tn3270, isready)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ RETURN_BOOL(obj->hSession->is_ready());
+}
+
+PHP_METHOD(tn3270, getstringat)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ long row;
+ long col;
+ long sz;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &row, &col, &sz) == FAILURE)
+ RETURN_NULL();
+
+ string str = obj->hSession->get_string_at(row,col,sz);
+
+ trace("String = [%s]",str.c_str());
+ RETURN_STRING(str.c_str(),1);
+}
+
+PHP_METHOD(tn3270, cmpstringat)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ long row;
+ long col;
+ const char * text;
+ int szText;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &row, &col, &text, &szText) == FAILURE)
+ RETURN_NULL();
+
+ if(!szText)
+ RETURN_NULL();
+
+ char buffer[szText+1];
+ memcpy(buffer,text,szText);
+ buffer[szText] = 0;
+
+ RETURN_LONG(obj->hSession->cmp_string_at(row,col,buffer));
+}
+
+PHP_METHOD(tn3270, getisprotected)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ long baddr;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &baddr) == FAILURE)
+ RETURN_NULL();
+
+ RETURN_LONG(obj->hSession->get_is_protected(baddr));
+}
+
+PHP_METHOD(tn3270, getisprotectedat)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ long row;
+ long col;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &row, &col) == FAILURE)
+ RETURN_NULL();
+
+ RETURN_LONG(obj->hSession->get_is_protected_at(row,col));
+}
diff --git a/src/include/config.h.in b/src/include/config.h.in
deleted file mode 100644
index 26b3ff5..0000000
--- a/src/include/config.h.in
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @file config.h
- *
- * @brief Configuração para o aplicativo.
- *
- * Gerado automaticamente pelo processo ./configure esse arquivo descreve
- * as configurações de ambiente detectadas automaticamente.
- *
- * @author perry.werneck@gmail.com
- *
- */
-
-#ifndef CONFIG_H_INCLUDED
-
- #define CONFIG_H_INCLUDED 1
-
- /**
- * @brief Nome do pacote.
- */
- #undef PACKAGE_NAME
-
- /**
- * @brief Versão atual.
- */
- #undef PACKAGE_VERSION
-
- /**
- * @brief Revisão svn quando o pacote foi configurado.
- *
- */
- #undef PACKAGE_REVISION
-
- /**
- * @brief Descrição do aplicativo.
- */
- #undef PACKAGE_DESCRIPTION
-
- /**
- * @brief Indica se o compilador atual possui suporte a "visibility"
- *
- * Quando disponível indica que o compilador atual permite tornar
- * visíveis numa biblioteca apenas as funções declaradas para isso
- * evitando que todos os símbolos fiquem visíveis.
- *
- * Isso permite um melhor controle sobre quais funções podem ser usados
- * pelo programa principal.
- *
- */
- #undef HAVE_GNUC_VISIBILITY
-
-#endif // CONFIG_H_INCLUDED
diff --git a/src/include/php3270.h.in b/src/include/php3270.h.in
deleted file mode 100644
index 75d138b..0000000
--- a/src/include/php3270.h.in
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
- * St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Este programa está nomeado como php3270.h e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
- *
- * Referências:
- *
- * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
- *
- */
-
-#ifndef PHP3270_INCLUDED
-
- #define PHP3270_INCLUDED 1
-
- #define PHP3270_EXTNAME "@PACKAGE_NAME@"
- #define PHP3270_EXTVER "@PACKAGE_VERSION@"
-
- extern "C"
- {
- #include "php.h"
- }
-
- extern zend_module_entry lib3270_module_entry;
- #define phpext_lib3270_ptr &lib3270_module_entry;
-
- // 3270 session methods
- PHP_METHOD(tn3270,__construct);
- PHP_METHOD(tn3270,connect);
- PHP_METHOD(tn3270,disconnect);
- PHP_METHOD(tn3270,isconnected);
- PHP_METHOD(tn3270,isready);
- PHP_METHOD(tn3270,waitforready);
- PHP_METHOD(tn3270,wait);
- PHP_METHOD(tn3270,iterate);
-
- PHP_METHOD(tn3270,pfkey);
- PHP_METHOD(tn3270,pakey);
- PHP_METHOD(tn3270,enter);
-
- PHP_METHOD(tn3270,getstringat);
- PHP_METHOD(tn3270,setstringat);
- PHP_METHOD(tn3270,cmpstringat);
-
- PHP_METHOD(tn3270,getisprotected);
- PHP_METHOD(tn3270,getisprotectedat);
-
- PHP_METHOD(tn3270,action);
-
- #undef PACKAGE_NAME
- #undef PACKAGE_VERSION
- #undef HAVE_MALLOC_H
- #include
-
- // PHP object
- using namespace PW3270_NAMESPACE;
-
- struct tn3270_object
- {
- zend_object std;
- session * hSession;
- };
-
-
-#endif // PHP_LIB3270_INCLUDED
diff --git a/src/init.cc b/src/init.cc
new file mode 100644
index 0000000..03f92af
--- /dev/null
+++ b/src/init.cc
@@ -0,0 +1,86 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Este programa está nomeado como init.cc e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ * Referências:
+ *
+ * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
+ *
+ */
+
+ #include "php3270.h"
+ #include
+
+/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
+
+PHP_METHOD(tn3270, __construct)
+{
+ char * name;
+ int szName = 0;
+ char * url;
+ int szURL = 0;
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ trace("%s %d",__FUNCTION__,ZEND_NUM_ARGS());
+
+ // http://www.php.net/manual/pt_BR/internals2.funcs.php
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &name, &szName, &url, &szURL) == FAILURE)
+ RETURN_NULL();
+
+ trace("szName=%d",szName);
+
+ try
+ {
+
+ if(szName)
+ {
+ char text[szName+1];
+ strncpy(text,name,szName);
+ text[szName] = 0;
+ trace("session_name=\"%s\"",text);
+ obj->hSession = session::start(text);
+ }
+ else
+ {
+ obj->hSession = session::start();
+ }
+
+ if(szURL)
+ {
+ char text[szURL+1];
+ strncpy(text,url,szURL);
+ text[szURL] = 0;
+ obj->hSession->set_url(text);
+ }
+
+ }
+ catch(std::exception &e)
+ {
+ zend_throw_error_exception(zend_exception_get_default(), (char *) e.what(), 0, 0 TSRMLS_DC);
+ }
+
+}
+
diff --git a/src/main.cc b/src/main.cc
new file mode 100644
index 0000000..e509379
--- /dev/null
+++ b/src/main.cc
@@ -0,0 +1,151 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Este programa está nomeado como main.cc e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ * Referências:
+ *
+ * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
+ *
+ */
+
+ #include "php3270.h"
+
+/*--[ Globals ]----------------------------------------------------------------------------------------------------*/
+
+static zend_class_entry * tn3270_ce = NULL;
+static zend_object_handlers tn3270_object_handlers;
+
+/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
+
+zend_function_entry tn3270_methods[] =
+{
+ PHP_ME( tn3270, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+
+ PHP_ME( tn3270, connect, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, disconnect, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+
+ PHP_ME( tn3270, isconnected, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, isready, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+
+ PHP_ME( tn3270, waitforready, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, wait, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, iterate, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+
+ PHP_ME( tn3270, pfkey, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, pakey, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, enter, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+
+ PHP_ME( tn3270, getstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, setstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, cmpstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+
+ PHP_ME( tn3270, getisprotected, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME( tn3270, getisprotectedat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+
+ PHP_ME( tn3270, action, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+
+ {NULL, NULL, NULL}
+};
+
+void tn3270_free_storage(void *object TSRMLS_DC)
+{
+ tn3270_object *obj = (tn3270_object *)object;
+
+ trace("%s",__FUNCTION__);
+
+ zend_object_std_dtor(&obj->std TSRMLS_CC);
+ delete obj->hSession;
+
+ efree(obj);
+}
+
+zend_object_value tn3270_create_handler(zend_class_entry *type TSRMLS_DC)
+{
+ zend_object_value retval;
+ tn3270_object * obj = (tn3270_object *) emalloc(sizeof(tn3270_object));
+
+ trace("%s",__FUNCTION__);
+
+ memset(obj, 0, sizeof(tn3270_object));
+
+ zend_object_std_init( &(obj->std), type TSRMLS_CC );
+
+ // http://stackoverflow.com/questions/14105529/writing-a-c-extension-for-php-5-4-example-code-is-obsolete
+ // object_properties_init((zend_object*) &(obj->std), type);
+#if PHP_VERSION_ID < 50399
+ zend_hash_copy(obj->std.properties, &(type->default_properties),(copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
+ object_properties_init(&obj->std, type);
+#endif
+
+ retval.handle = zend_objects_store_put(obj, NULL, tn3270_free_storage, NULL TSRMLS_CC);
+ retval.handlers = &tn3270_object_handlers;
+
+ return retval;
+}
+
+PHP_MINIT_FUNCTION(tn3270)
+{
+ zend_class_entry ce;
+
+ trace("%s",__FUNCTION__);
+
+ INIT_CLASS_ENTRY(ce, "tn3270", tn3270_methods);
+
+ tn3270_ce = zend_register_internal_class(&ce TSRMLS_CC);
+ tn3270_ce->create_object = tn3270_create_handler;
+
+ memcpy(&tn3270_object_handlers,zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ tn3270_object_handlers.clone_obj = NULL;
+
+ return SUCCESS;
+}
+
+zend_module_entry lib3270_module_entry =
+{
+#if ZEND_MODULE_API_NO >= 20010901
+ STANDARD_MODULE_HEADER,
+#endif
+ PHP3270_EXTNAME,
+ NULL, /* Functions */
+ PHP_MINIT(tn3270),
+ NULL, /* MSHUTDOWN */
+ NULL, /* RINIT */
+ NULL, /* RSHUTDOWN */
+ NULL, /* MINFO */
+#if ZEND_MODULE_API_NO >= 20010901
+ PHP3270_EXTVER,
+#endif
+ STANDARD_MODULE_PROPERTIES
+};
+
+// #ifdef COMPILE_DL_LIB3270
+extern "C"
+{
+ ZEND_GET_MODULE(lib3270)
+}
+// #endif
+
diff --git a/src/misc.cc b/src/misc.cc
new file mode 100644
index 0000000..2a2fbe3
--- /dev/null
+++ b/src/misc.cc
@@ -0,0 +1,139 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Este programa está nomeado como main.cc e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ * Referências:
+ *
+ * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
+ *
+ */
+
+ #include "php3270.h"
+
+/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
+
+PHP_METHOD(tn3270, connect)
+{
+ const char * host;
+ int szHost;
+ zend_bool wait = 0;
+ int rc = 0;
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &host, &szHost, &wait) == FAILURE)
+ RETURN_NULL();
+
+ if(szHost)
+ {
+ char text[szHost+1];
+ strncpy(text,host,szHost);
+ text[szHost] = 0;
+ rc = obj->hSession->connect(text,wait);
+ }
+ else
+ {
+ rc = obj->hSession->connect();
+ }
+
+ RETURN_LONG(rc);
+}
+
+PHP_METHOD(tn3270, disconnect)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ RETURN_LONG(obj->hSession->disconnect());
+}
+
+PHP_METHOD(tn3270, waitforready)
+{
+ long seconds;
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ // http://www.php.net/manual/pt_BR/internals2.funcs.php
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
+ RETURN_NULL();
+
+ RETURN_LONG(obj->hSession->wait_for_ready((int) seconds));
+}
+
+PHP_METHOD(tn3270, waity)
+{
+ long seconds;
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ // http://www.php.net/manual/pt_BR/internals2.funcs.php
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
+ RETURN_NULL();
+
+ RETURN_LONG(obj->hSession->wait((int) seconds));
+}
+
+PHP_METHOD(tn3270, wait)
+{
+ long seconds;
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ // http://www.php.net/manual/pt_BR/internals2.funcs.php
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
+ RETURN_NULL();
+
+ RETURN_LONG(obj->hSession->wait((int) seconds));
+}
+
+
+PHP_METHOD(tn3270, iterate)
+{
+ zend_bool wait = 0;
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ // http://www.php.net/manual/pt_BR/internals2.funcs.php
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &wait) == FAILURE)
+ RETURN_NULL();
+
+ RETURN_LONG(obj->hSession->iterate(wait));
+}
+
+PHP_METHOD(tn3270, action)
+{
+
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ const char * text;
+ int szText;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &text, &szText) == FAILURE)
+ RETURN_NULL();
+
+ if(!szText)
+ RETURN_NULL();
+
+ char buffer[szText+1];
+ memcpy(buffer,text,szText);
+ buffer[szText] = 0;
+
+ RETURN_LONG(obj->hSession->action(buffer));
+
+}
diff --git a/src/native/get.cc b/src/native/get.cc
deleted file mode 100644
index 94c7093..0000000
--- a/src/native/get.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
- * St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Este programa está nomeado como get.cc e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
- *
- * Referências:
- *
- * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
- *
- */
-
- #include "php3270.h"
-
-/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
-
-PHP_METHOD(tn3270, isconnected)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- RETURN_BOOL(obj->hSession->is_connected());
-}
-
-PHP_METHOD(tn3270, isready)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- RETURN_BOOL(obj->hSession->is_ready());
-}
-
-PHP_METHOD(tn3270, getstringat)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- long row;
- long col;
- long sz;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &row, &col, &sz) == FAILURE)
- RETURN_NULL();
-
- string str = obj->hSession->get_string_at(row,col,sz);
-
- trace("String = [%s]",str.c_str());
- RETURN_STRING(str.c_str(),1);
-}
-
-PHP_METHOD(tn3270, cmpstringat)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- long row;
- long col;
- const char * text;
- int szText;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &row, &col, &text, &szText) == FAILURE)
- RETURN_NULL();
-
- if(!szText)
- RETURN_NULL();
-
- char buffer[szText+1];
- memcpy(buffer,text,szText);
- buffer[szText] = 0;
-
- RETURN_LONG(obj->hSession->cmp_string_at(row,col,buffer));
-}
-
-PHP_METHOD(tn3270, getisprotected)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- long baddr;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &baddr) == FAILURE)
- RETURN_NULL();
-
- RETURN_LONG(obj->hSession->get_is_protected(baddr));
-}
-
-PHP_METHOD(tn3270, getisprotectedat)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- long row;
- long col;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &row, &col) == FAILURE)
- RETURN_NULL();
-
- RETURN_LONG(obj->hSession->get_is_protected_at(row,col));
-}
diff --git a/src/native/init.cc b/src/native/init.cc
deleted file mode 100644
index 03f92af..0000000
--- a/src/native/init.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
- * St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Este programa está nomeado como init.cc e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
- *
- * Referências:
- *
- * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
- *
- */
-
- #include "php3270.h"
- #include
-
-/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
-
-PHP_METHOD(tn3270, __construct)
-{
- char * name;
- int szName = 0;
- char * url;
- int szURL = 0;
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- trace("%s %d",__FUNCTION__,ZEND_NUM_ARGS());
-
- // http://www.php.net/manual/pt_BR/internals2.funcs.php
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &name, &szName, &url, &szURL) == FAILURE)
- RETURN_NULL();
-
- trace("szName=%d",szName);
-
- try
- {
-
- if(szName)
- {
- char text[szName+1];
- strncpy(text,name,szName);
- text[szName] = 0;
- trace("session_name=\"%s\"",text);
- obj->hSession = session::start(text);
- }
- else
- {
- obj->hSession = session::start();
- }
-
- if(szURL)
- {
- char text[szURL+1];
- strncpy(text,url,szURL);
- text[szURL] = 0;
- obj->hSession->set_url(text);
- }
-
- }
- catch(std::exception &e)
- {
- zend_throw_error_exception(zend_exception_get_default(), (char *) e.what(), 0, 0 TSRMLS_DC);
- }
-
-}
-
diff --git a/src/native/main.cc b/src/native/main.cc
deleted file mode 100644
index e509379..0000000
--- a/src/native/main.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
- * St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Este programa está nomeado como main.cc e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
- *
- * Referências:
- *
- * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
- *
- */
-
- #include "php3270.h"
-
-/*--[ Globals ]----------------------------------------------------------------------------------------------------*/
-
-static zend_class_entry * tn3270_ce = NULL;
-static zend_object_handlers tn3270_object_handlers;
-
-/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
-
-zend_function_entry tn3270_methods[] =
-{
- PHP_ME( tn3270, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
-
- PHP_ME( tn3270, connect, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, disconnect, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
-
- PHP_ME( tn3270, isconnected, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, isready, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
-
- PHP_ME( tn3270, waitforready, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, wait, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, iterate, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
-
- PHP_ME( tn3270, pfkey, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, pakey, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, enter, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
-
- PHP_ME( tn3270, getstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, setstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, cmpstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
-
- PHP_ME( tn3270, getisprotected, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME( tn3270, getisprotectedat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
-
- PHP_ME( tn3270, action, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
-
- {NULL, NULL, NULL}
-};
-
-void tn3270_free_storage(void *object TSRMLS_DC)
-{
- tn3270_object *obj = (tn3270_object *)object;
-
- trace("%s",__FUNCTION__);
-
- zend_object_std_dtor(&obj->std TSRMLS_CC);
- delete obj->hSession;
-
- efree(obj);
-}
-
-zend_object_value tn3270_create_handler(zend_class_entry *type TSRMLS_DC)
-{
- zend_object_value retval;
- tn3270_object * obj = (tn3270_object *) emalloc(sizeof(tn3270_object));
-
- trace("%s",__FUNCTION__);
-
- memset(obj, 0, sizeof(tn3270_object));
-
- zend_object_std_init( &(obj->std), type TSRMLS_CC );
-
- // http://stackoverflow.com/questions/14105529/writing-a-c-extension-for-php-5-4-example-code-is-obsolete
- // object_properties_init((zend_object*) &(obj->std), type);
-#if PHP_VERSION_ID < 50399
- zend_hash_copy(obj->std.properties, &(type->default_properties),(copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
-#else
- object_properties_init(&obj->std, type);
-#endif
-
- retval.handle = zend_objects_store_put(obj, NULL, tn3270_free_storage, NULL TSRMLS_CC);
- retval.handlers = &tn3270_object_handlers;
-
- return retval;
-}
-
-PHP_MINIT_FUNCTION(tn3270)
-{
- zend_class_entry ce;
-
- trace("%s",__FUNCTION__);
-
- INIT_CLASS_ENTRY(ce, "tn3270", tn3270_methods);
-
- tn3270_ce = zend_register_internal_class(&ce TSRMLS_CC);
- tn3270_ce->create_object = tn3270_create_handler;
-
- memcpy(&tn3270_object_handlers,zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- tn3270_object_handlers.clone_obj = NULL;
-
- return SUCCESS;
-}
-
-zend_module_entry lib3270_module_entry =
-{
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- PHP3270_EXTNAME,
- NULL, /* Functions */
- PHP_MINIT(tn3270),
- NULL, /* MSHUTDOWN */
- NULL, /* RINIT */
- NULL, /* RSHUTDOWN */
- NULL, /* MINFO */
-#if ZEND_MODULE_API_NO >= 20010901
- PHP3270_EXTVER,
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-
-// #ifdef COMPILE_DL_LIB3270
-extern "C"
-{
- ZEND_GET_MODULE(lib3270)
-}
-// #endif
-
diff --git a/src/native/misc.cc b/src/native/misc.cc
deleted file mode 100644
index 2a2fbe3..0000000
--- a/src/native/misc.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
- * St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Este programa está nomeado como main.cc e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
- *
- * Referências:
- *
- * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
- *
- */
-
- #include "php3270.h"
-
-/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
-
-PHP_METHOD(tn3270, connect)
-{
- const char * host;
- int szHost;
- zend_bool wait = 0;
- int rc = 0;
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &host, &szHost, &wait) == FAILURE)
- RETURN_NULL();
-
- if(szHost)
- {
- char text[szHost+1];
- strncpy(text,host,szHost);
- text[szHost] = 0;
- rc = obj->hSession->connect(text,wait);
- }
- else
- {
- rc = obj->hSession->connect();
- }
-
- RETURN_LONG(rc);
-}
-
-PHP_METHOD(tn3270, disconnect)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- RETURN_LONG(obj->hSession->disconnect());
-}
-
-PHP_METHOD(tn3270, waitforready)
-{
- long seconds;
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- // http://www.php.net/manual/pt_BR/internals2.funcs.php
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
- RETURN_NULL();
-
- RETURN_LONG(obj->hSession->wait_for_ready((int) seconds));
-}
-
-PHP_METHOD(tn3270, waity)
-{
- long seconds;
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- // http://www.php.net/manual/pt_BR/internals2.funcs.php
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
- RETURN_NULL();
-
- RETURN_LONG(obj->hSession->wait((int) seconds));
-}
-
-PHP_METHOD(tn3270, wait)
-{
- long seconds;
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- // http://www.php.net/manual/pt_BR/internals2.funcs.php
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
- RETURN_NULL();
-
- RETURN_LONG(obj->hSession->wait((int) seconds));
-}
-
-
-PHP_METHOD(tn3270, iterate)
-{
- zend_bool wait = 0;
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- // http://www.php.net/manual/pt_BR/internals2.funcs.php
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &wait) == FAILURE)
- RETURN_NULL();
-
- RETURN_LONG(obj->hSession->iterate(wait));
-}
-
-PHP_METHOD(tn3270, action)
-{
-
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- const char * text;
- int szText;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &text, &szText) == FAILURE)
- RETURN_NULL();
-
- if(!szText)
- RETURN_NULL();
-
- char buffer[szText+1];
- memcpy(buffer,text,szText);
- buffer[szText] = 0;
-
- RETURN_LONG(obj->hSession->action(buffer));
-
-}
diff --git a/src/native/set.cc b/src/native/set.cc
deleted file mode 100644
index 9cbdbeb..0000000
--- a/src/native/set.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
- * St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Este programa está nomeado como set.cc e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
- *
- * Referências:
- *
- * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
- *
- */
-
- #include "php3270.h"
-
-/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
-
-PHP_METHOD(tn3270, pfkey)
-{
- long id;
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- // http://www.php.net/manual/pt_BR/internals2.funcs.php
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE)
- RETURN_NULL();
-
- RETURN_LONG(obj->hSession->pfkey((int) id));
-}
-
-PHP_METHOD(tn3270, pakey)
-{
- long id;
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
-
- // http://www.php.net/manual/pt_BR/internals2.funcs.php
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE)
- RETURN_NULL();
-
- RETURN_LONG(obj->hSession->pakey((int) id));
-}
-
-PHP_METHOD(tn3270, enter)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- RETURN_LONG(obj->hSession->enter());
-}
-
-PHP_METHOD(tn3270, setstringat)
-{
- tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
- long row;
- long col;
- const char * text;
- int szText;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &row, &col, &text, &szText) == FAILURE)
- RETURN_NULL();
-
- if(!szText)
- RETURN_NULL();
-
- char buffer[szText+1];
- memcpy(buffer,text,szText);
- buffer[szText] = 0;
-
- RETURN_LONG(obj->hSession->set_string_at(row,col,buffer));
-}
-
diff --git a/src/php3270.h.in b/src/php3270.h.in
new file mode 100644
index 0000000..75d138b
--- /dev/null
+++ b/src/php3270.h.in
@@ -0,0 +1,87 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Este programa está nomeado como php3270.h e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ * Referências:
+ *
+ * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
+ *
+ */
+
+#ifndef PHP3270_INCLUDED
+
+ #define PHP3270_INCLUDED 1
+
+ #define PHP3270_EXTNAME "@PACKAGE_NAME@"
+ #define PHP3270_EXTVER "@PACKAGE_VERSION@"
+
+ extern "C"
+ {
+ #include "php.h"
+ }
+
+ extern zend_module_entry lib3270_module_entry;
+ #define phpext_lib3270_ptr &lib3270_module_entry;
+
+ // 3270 session methods
+ PHP_METHOD(tn3270,__construct);
+ PHP_METHOD(tn3270,connect);
+ PHP_METHOD(tn3270,disconnect);
+ PHP_METHOD(tn3270,isconnected);
+ PHP_METHOD(tn3270,isready);
+ PHP_METHOD(tn3270,waitforready);
+ PHP_METHOD(tn3270,wait);
+ PHP_METHOD(tn3270,iterate);
+
+ PHP_METHOD(tn3270,pfkey);
+ PHP_METHOD(tn3270,pakey);
+ PHP_METHOD(tn3270,enter);
+
+ PHP_METHOD(tn3270,getstringat);
+ PHP_METHOD(tn3270,setstringat);
+ PHP_METHOD(tn3270,cmpstringat);
+
+ PHP_METHOD(tn3270,getisprotected);
+ PHP_METHOD(tn3270,getisprotectedat);
+
+ PHP_METHOD(tn3270,action);
+
+ #undef PACKAGE_NAME
+ #undef PACKAGE_VERSION
+ #undef HAVE_MALLOC_H
+ #include
+
+ // PHP object
+ using namespace PW3270_NAMESPACE;
+
+ struct tn3270_object
+ {
+ zend_object std;
+ session * hSession;
+ };
+
+
+#endif // PHP_LIB3270_INCLUDED
diff --git a/src/set.cc b/src/set.cc
new file mode 100644
index 0000000..9cbdbeb
--- /dev/null
+++ b/src/set.cc
@@ -0,0 +1,88 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Este programa está nomeado como set.cc e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ * Referências:
+ *
+ * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
+ *
+ */
+
+ #include "php3270.h"
+
+/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
+
+PHP_METHOD(tn3270, pfkey)
+{
+ long id;
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ // http://www.php.net/manual/pt_BR/internals2.funcs.php
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE)
+ RETURN_NULL();
+
+ RETURN_LONG(obj->hSession->pfkey((int) id));
+}
+
+PHP_METHOD(tn3270, pakey)
+{
+ long id;
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ // http://www.php.net/manual/pt_BR/internals2.funcs.php
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE)
+ RETURN_NULL();
+
+ RETURN_LONG(obj->hSession->pakey((int) id));
+}
+
+PHP_METHOD(tn3270, enter)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ RETURN_LONG(obj->hSession->enter());
+}
+
+PHP_METHOD(tn3270, setstringat)
+{
+ tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ long row;
+ long col;
+ const char * text;
+ int szText;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &row, &col, &text, &szText) == FAILURE)
+ RETURN_NULL();
+
+ if(!szText)
+ RETURN_NULL();
+
+ char buffer[szText+1];
+ memcpy(buffer,text,szText);
+ buffer[szText] = 0;
+
+ RETURN_LONG(obj->hSession->set_string_at(row,col,buffer));
+}
+
--
libgit2 0.21.2