Commit 034342bbe4adafa80deae969738363ba18c6e31a

Authored by Perry Werneck
1 parent d48e268b
Exists in master

Ajustes para empacotamento.

.gitignore
... ... @@ -21,3 +21,4 @@ ChangeLog
21 21 revision
22 22 revision.m4
23 23 php3270.h
  24 +*.ini
... ...
Makefile.in
... ... @@ -104,16 +104,13 @@ Release: \
104 104 $(BINRLS)/$(LIBNAME)
105 105  
106 106 install: \
107   - $(BINRLS)/$(LIBNAME).@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@
108   -
109   - @$(MKDIR) $(DESTDIR)/$(libdir)
110   - @$(INSTALL_PROGRAM) $(BINRLS)/$(LIBNAME).@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ $(DESTDIR)/$(libdir)
  107 + $(BINRLS)/$(LIBNAME)
111 108  
112   - @rm -f $(DESTDIR)/$(libdir)/$(LIBNAME).@PACKAGE_MAJOR_VERSION@
113   - @rm -f $(DESTDIR)/$(libdir)/$(LIBNAME)
  109 + @$(MKDIR) $(DESTDIR)/`$(PHPCONFIG) --extension-dir`
  110 + @$(INSTALL_PROGRAM) $(BINRLS)/$(LIBNAME) $(DESTDIR)/`$(PHPCONFIG) --extension-dir`/tn3270@DLLEXT@
114 111  
115   - @$(LN_S) $(LIBNAME).@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ $(DESTDIR)/$(libdir)/$(LIBNAME).@PACKAGE_MAJOR_VERSION@
116   - @$(LN_S) $(LIBNAME).@PACKAGE_MAJOR_VERSION@ $(DESTDIR)/$(libdir)/$(LIBNAME)
  112 + @$(MKDIR) $(DESTDIR)/@PHPCONFDIR@
  113 + @$(INSTALL_DATA) php.ini $(DESTDIR)/@PHPCONFDIR@/tn3270.ini
117 114  
118 115 $(BINRLS)/$(LIBNAME): \
119 116 $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o)
... ... @@ -132,6 +129,11 @@ $(BINDBG)/$(LIBNAME): \
132 129 @$(MKDIR) `dirname $@`
133 130 @$(LD) -shared -Wl,-soname,$(LIBNAME) $(LDFLAGS) -o $@ $^ $(LIBS)
134 131  
  132 +run: \
  133 + $(BINDBG)/$(LIBNAME)
  134 +
  135 + php -d extension=$(BINDBG)/$(LIBNAME) testprograms/version.php
  136 +
135 137 clean:
136 138  
137 139 @rm -fr $(BINDIR)
... ...
configure.ac
... ... @@ -367,6 +367,7 @@ dnl ---------------------------------------------------------------------------
367 367  
368 368 AC_CONFIG_FILES(Makefile)
369 369 AC_CONFIG_FILES(src/php3270.h)
  370 +AC_CONFIG_FILES(php.ini)
370 371  
371 372 dnl ---------------------------------------------------------------------------
372 373 dnl Output the generated config.status script.
... ...
php.ini.in 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +; comment out next line to disable pdo extension in php
  2 +extension=tn3270@DLLEXT@
... ...
src/get.cc
... ... @@ -106,3 +106,23 @@ PHP_METHOD(tn3270, getisprotectedat)
106 106  
107 107 RETURN_LONG(obj->hSession->get_is_protected_at(row,col));
108 108 }
  109 +
  110 +PHP_METHOD(tn3270, getversion)
  111 +{
  112 + tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
  113 +
  114 + string str = obj->hSession->get_version();
  115 +
  116 + trace("String = [%s]",str.c_str());
  117 + RETURN_STRING(str.c_str(),1);
  118 +}
  119 +
  120 +PHP_METHOD(tn3270, getrevision)
  121 +{
  122 + tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
  123 +
  124 + string str = obj->hSession->get_revision();
  125 +
  126 + trace("String = [%s]",str.c_str());
  127 + RETURN_STRING(str.c_str(),1);
  128 +}
... ...
src/main.cc
... ... @@ -44,6 +44,9 @@ zend_function_entry tn3270_methods[] =
44 44 {
45 45 PHP_ME( tn3270, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
46 46  
  47 + PHP_ME( tn3270, getversion, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
  48 + PHP_ME( tn3270, getrevision, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
  49 +
47 50 PHP_ME( tn3270, connect, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
48 51 PHP_ME( tn3270, disconnect, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
49 52  
... ...
src/php3270.h.in
... ... @@ -48,6 +48,10 @@
48 48  
49 49 // 3270 session methods
50 50 PHP_METHOD(tn3270,__construct);
  51 +
  52 + PHP_METHOD(tn3270,getversion);
  53 + PHP_METHOD(tn3270,getrevision);
  54 +
51 55 PHP_METHOD(tn3270,connect);
52 56 PHP_METHOD(tn3270,disconnect);
53 57 PHP_METHOD(tn3270,isconnected);
... ...
testprograms/sample.php 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<?php
  2 +
  3 + printf("PW3270 PHP sample\n");
  4 +
  5 + $host = new tn3270("pw3270:a");
  6 +
  7 + $rc = $host->connect();
  8 + print("connect() exits with rc=" . $rc . "\n");
  9 +
  10 + $rc = $host->waitforready(10);
  11 + print("waitforready() exits with rc=" . $rc . "\n");
  12 +
  13 + $str = $host->getstringat(3,2,14);
  14 + print("Getstring(3,2,14) saiu com \"" . $str . "\"\n");
  15 +
  16 + $rc = $host->getisprotectedat(19,39);
  17 + print("GetIsprotectedAt(19,39) saiu com \"" . $rc . "\"\n");
  18 +
  19 + $rc = $host->getisprotectedat(20,39);
  20 + print("GetIsprotectedAt(20,39) saiu com \"" . $rc . "\"\n");
  21 +
  22 + $rc = $host->action("clear");
  23 + print("Action(\"clear\") saiu com \"" . $rc . "\"\n");
  24 +
  25 + $rc = $host->disconnect();
  26 + print("disconnect() exits with rc=" . $rc . "\n");
  27 +
  28 +?>
... ...
testprograms/version.php 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<?php
  2 +
  3 + printf("PW3270 PHP sample\n");
  4 +
  5 + $host = new tn3270("");
  6 +
  7 + print("Using pw3270 version " . $host->getVersion() . " revision " . $host->getRevision());
  8 +
  9 +?>
  10 +
... ...