diff --git a/src/classlib/session.cc b/src/classlib/session.cc index 96f53ac..2323abc 100644 --- a/src/classlib/session.cc +++ b/src/classlib/session.cc @@ -356,6 +356,10 @@ free(outBuffer); } + else + { + rc = str; + } #else rc = str; #endif // HAVE_ICONV @@ -366,6 +370,9 @@ string session::get_string_at(int row, int col, size_t sz) { string str = this->get_text_at(row,col,sz); + + trace("String não convertida: [%s]",str.c_str()); + return this->get_local_text(str.c_str()); } diff --git a/src/php/Makefile.in b/src/php/Makefile.in index e5cce14..16a17b8 100644 --- a/src/php/Makefile.in +++ b/src/php/Makefile.in @@ -35,6 +35,7 @@ bindir=@bindir@ sbindir=@sbindir@ libdir=@libdir@ includedir=@includedir@ +sysconfdir=@sysconfdir@ #---[ Tools ]------------------------------------------------------------------ @@ -72,11 +73,26 @@ CXXFLAGS=@CXXFLAGS@ @DLL_CFLAGS@ `$(PHPCONFIG) --includes` -I../include $(OBJDBG)/%.o: %.cc php3270.h Makefile @echo " CC `basename $@`" @mkdir -p `dirname $@` - $(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $< + @$(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $< +$(OBJRLS)/%.o: %.cc php3270.h Makefile + @echo " CC `basename $@`" + @mkdir -p `dirname $@` + @$(CXX) -DNDEBUG=1 $(CXXFLAGS) -o $@ -c $< #---[ Release targets ]-------------------------------------------------------- +all: $(BINRLS)/php3270@DLLEXT@ + +Release: $(BINRLS)/php3270@DLLEXT@ + +$(BINRLS)/php3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC)@OBJEXT@) \ + $(CLASS_RELEASE_OBJECTS) + @echo " LD `basename $@`" + @$(MKDIR) `dirname $@` + @$(CXX) -shared $(LDFLAGS) $(OO_LDFLAGS) $(CLASS_LIBS) -o $@ $^ + + #---[ Debug targets ]---------------------------------------------------------- Debug: $(BINDBG)/php3270@DLLEXT@ @@ -93,6 +109,15 @@ run: $(BINDBG)/php3270@DLLEXT@ #---[ Misc targets ]----------------------------------------------------------- +install: $(BINDBG)/php3270@DLLEXT@ + @$(MKDIR) $(DESTDIR)/`$(PHPCONFIG) --extension-dir` + @$(INSTALL_PROGRAM) $(BINDBG)/php3270@DLLEXT@ $(DESTDIR)/`$(PHPCONFIG) --extension-dir`/tn3270@DLLEXT@ + + @$(MKDIR) $(DESTDIR)/$(sysconfdir)/php`$(PHPCONFIG) --version | cut -d. -f1`/conf.d + @$(INSTALL_DATA) php.ini $(DESTDIR)/$(sysconfdir)/php`$(PHPCONFIG) --version | cut -d. -f1`/conf.d/tn3270.ini + +cleanDebug: clean + clean: @rm -fr $(OBJDIR) @rm -fr $(BINDIR) diff --git a/src/php/get.cc b/src/php/get.cc index 7b4544c..3c5acd1 100644 --- a/src/php/get.cc +++ b/src/php/get.cc @@ -57,7 +57,10 @@ PHP_METHOD(tn3270, getstringat) if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &row, &col, &sz) == FAILURE) RETURN_NULL(); - RETURN_STRING(obj->hSession->get_string_at(row,col,sz).c_str(),1); + 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) diff --git a/src/php/php.ini b/src/php/php.ini new file mode 100644 index 0000000..b3f0094 --- /dev/null +++ b/src/php/php.ini @@ -0,0 +1,2 @@ +; comment out next line to disable pdo extension in php +extension=tn3270.so diff --git a/src/php/php3270.cbp b/src/php/php3270.cbp index 3cc530f..2919943 100644 --- a/src/php/php3270.cbp +++ b/src/php/php3270.cbp @@ -52,7 +52,7 @@ - + diff --git a/src/php/sample.php b/src/php/sample.php index 31068c9..6fab3df 100644 --- a/src/php/sample.php +++ b/src/php/sample.php @@ -10,6 +10,9 @@ $rc = $host->waitforready(10); print("waitforready() exits with rc=" . $rc . "\n"); + $str = $host->getstringat(3,2,14); + print("Getstring(3,2,14) saiu com \"" . $str . "\"\n"); + $rc = $host->disconnect(); print("disconnect() exits with rc=" . $rc . "\n"); -- libgit2 0.21.2