Commit 5cb2c993c6db760a815cb58826a206bee6f2611a
1 parent
6514f2c3
Exists in
master
and in
5 other branches
Mudando funcionamento do plugin ooRexx para usar o elemento interno.
Showing
2 changed files
with
3 additions
and
436 deletions
Show diff stats
src/include/pw3270/class.h
... | ... | @@ -255,6 +255,8 @@ |
255 | 255 | string get_3270_text(const char *str); |
256 | 256 | string get_local_text(const char *str); |
257 | 257 | |
258 | + static session * create_local(H3270 *hSession) throw (std::exception); | |
259 | + | |
258 | 260 | protected: |
259 | 261 | session(); |
260 | 262 | |
... | ... | @@ -278,7 +280,6 @@ |
278 | 280 | |
279 | 281 | static session * create_remote(const char *name) throw (std::exception); |
280 | 282 | static session * create_local(void) throw (std::exception); |
281 | - static session * create_local(H3270 *hSession) throw (std::exception); | |
282 | 283 | |
283 | 284 | #ifdef HAVE_ICONV |
284 | 285 | iconv_t conv2Local; | ... | ... |
src/plugins/rx3270/pluginmain.cc
... | ... | @@ -78,96 +78,6 @@ |
78 | 78 | using namespace std; |
79 | 79 | using namespace PW3270_NAMESPACE; |
80 | 80 | |
81 | - class plugin : public session | |
82 | - { | |
83 | - public: | |
84 | - plugin(H3270 *hSession); | |
85 | - virtual ~plugin(); | |
86 | - | |
87 | - void free(void *ptr); | |
88 | - | |
89 | - const string get_version(void); | |
90 | - | |
91 | - LIB3270_CSTATE get_cstate(void); | |
92 | - LIB3270_MESSAGE get_program_message(void); | |
93 | - LIB3270_SSL_STATE get_secure(void); | |
94 | - | |
95 | - int disconnect(void); | |
96 | - int set_url(const char *uri); | |
97 | - int connect(void); | |
98 | - bool is_connected(void); | |
99 | - bool is_ready(void); | |
100 | - | |
101 | - void logva(const char *fmt, va_list args); | |
102 | - | |
103 | - int iterate(bool wait); | |
104 | - int wait(int seconds); | |
105 | - int wait_for_ready(int seconds); | |
106 | - | |
107 | - string get_text(int baddr, size_t len); | |
108 | - string get_text_at(int row, int col, size_t sz); | |
109 | - int cmp_text_at(int row, int col, const char *text); | |
110 | - int set_text_at(int row, int col, const char *str); | |
111 | - | |
112 | - int set_cursor_position(int row, int col); | |
113 | - int set_cursor_addr(int addr); | |
114 | - int get_cursor_addr(void); | |
115 | - | |
116 | - int emulate_input(const char *str); | |
117 | - | |
118 | - int set_toggle(LIB3270_TOGGLE ix, bool value); | |
119 | - | |
120 | - int enter(void); | |
121 | - int pfkey(int key); | |
122 | - int pakey(int key); | |
123 | - | |
124 | - int erase(void); | |
125 | - int erase_eof(void); | |
126 | - int erase_eol(void); | |
127 | - int erase_input(void); | |
128 | - | |
129 | - int print(void); | |
130 | - | |
131 | - int get_field_start(int baddr = -1); | |
132 | - int get_field_len(int baddr = -1); | |
133 | - int get_next_unprotected(int baddr = -1); | |
134 | - int get_is_protected(int baddr = -1); | |
135 | - int get_is_protected_at(int row, int col); | |
136 | - | |
137 | - int set_copy(const char *text); | |
138 | - string get_copy(void); | |
139 | - | |
140 | - string get_clipboard(void); | |
141 | - int set_clipboard(const char *text); | |
142 | - | |
143 | - int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); | |
144 | - string file_chooser_dialog(int action, const char *title, const char *extension, const char *filename); | |
145 | - | |
146 | - int set_host_charset(const char *charset); | |
147 | - string get_host_charset(void); | |
148 | - string get_display_charset(void); | |
149 | - | |
150 | - int get_width(void); | |
151 | - int get_height(void); | |
152 | - int get_length(void); | |
153 | - | |
154 | - const char * asc2ebc(unsigned char *str, int sz = -1); | |
155 | - const char * ebc2asc(unsigned char *str, int sz = -1); | |
156 | - | |
157 | - int file_transfer(LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl = 0, int blksize = 0, int primspace = 0, int secspace = 0, int dft = 4096); | |
158 | - | |
159 | - int quit(void); | |
160 | - int action(const char *name); | |
161 | - | |
162 | - void set_unlock_delay(unsigned short ms); | |
163 | - | |
164 | - protected: | |
165 | - | |
166 | - private: | |
167 | - H3270 * hSession; | |
168 | - | |
169 | - }; | |
170 | - | |
171 | 81 | |
172 | 82 | /*--[ Running rexx scripts ]---------------------------------------------------------------------------------*/ |
173 | 83 | |
... | ... | @@ -487,7 +397,7 @@ extern "C" |
487 | 397 | |
488 | 398 | static session * factory(const char *name) |
489 | 399 | { |
490 | - return new plugin(lib3270_get_default_session_handle()); | |
400 | + return session::create_local(lib3270_get_default_session_handle()); | |
491 | 401 | } |
492 | 402 | |
493 | 403 | LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) |
... | ... | @@ -509,347 +419,3 @@ extern "C" |
509 | 419 | return 0; |
510 | 420 | } |
511 | 421 | |
512 | - plugin::plugin(H3270 *hSession) : session() | |
513 | - { | |
514 | - this->hSession = hSession; | |
515 | - set_display_charset(); | |
516 | - } | |
517 | - | |
518 | - plugin::~plugin() | |
519 | - { | |
520 | - trace("%s",__FUNCTION__); | |
521 | - } | |
522 | - | |
523 | - | |
524 | - const string plugin::get_version(void) | |
525 | - { | |
526 | - return string(lib3270_get_version()); | |
527 | - } | |
528 | - | |
529 | - LIB3270_CSTATE plugin::get_cstate(void) | |
530 | - { | |
531 | - return lib3270_get_connection_state(hSession); | |
532 | - } | |
533 | - | |
534 | - LIB3270_MESSAGE plugin::get_program_message(void) | |
535 | - { | |
536 | - return lib3270_get_program_message(hSession); | |
537 | - } | |
538 | - | |
539 | - LIB3270_SSL_STATE plugin::get_secure(void) | |
540 | - { | |
541 | - return lib3270_get_secure(hSession); | |
542 | - } | |
543 | - | |
544 | - int plugin::disconnect(void) | |
545 | - { | |
546 | - lib3270_disconnect(hSession); | |
547 | - return 0; | |
548 | - } | |
549 | - | |
550 | - int plugin::connect(void) | |
551 | - { | |
552 | - return lib3270_connect(hSession,0); | |
553 | - } | |
554 | - | |
555 | - bool plugin::is_connected(void) | |
556 | - { | |
557 | - return lib3270_is_connected(hSession) != 0; | |
558 | - } | |
559 | - | |
560 | - int plugin::iterate(bool wait) | |
561 | - { | |
562 | - if(!lib3270_is_connected(hSession)) | |
563 | - return ENOTCONN; | |
564 | - | |
565 | - lib3270_main_iterate(hSession,wait); | |
566 | - | |
567 | - return 0; | |
568 | - } | |
569 | - | |
570 | - int plugin::wait(int seconds) | |
571 | - { | |
572 | - return lib3270_wait(hSession,seconds); | |
573 | - } | |
574 | - | |
575 | - int plugin::enter(void) | |
576 | - { | |
577 | - return lib3270_enter(hSession); | |
578 | - } | |
579 | - | |
580 | - int plugin::pfkey(int key) | |
581 | - { | |
582 | - return lib3270_pfkey(hSession,key); | |
583 | - } | |
584 | - | |
585 | - int plugin::pakey(int key) | |
586 | - { | |
587 | - return lib3270_pakey(hSession,key); | |
588 | - } | |
589 | - | |
590 | - int plugin::wait_for_ready(int seconds) | |
591 | - { | |
592 | - return lib3270_wait_for_ready(hSession,seconds); | |
593 | - } | |
594 | - | |
595 | - string plugin::get_text_at(int row, int col, size_t sz) | |
596 | - { | |
597 | - string rc; | |
598 | - char * ptr = lib3270_get_text_at(hSession,row,col,(int) sz); | |
599 | - | |
600 | - if(ptr) | |
601 | - { | |
602 | - rc.assign(ptr); | |
603 | - lib3270_free(ptr); | |
604 | - } | |
605 | - | |
606 | - return rc; | |
607 | - } | |
608 | - | |
609 | - int plugin::cmp_text_at(int row, int col, const char *text) | |
610 | - { | |
611 | - return lib3270_cmp_text_at(hSession,row,col,text); | |
612 | - } | |
613 | - | |
614 | - int plugin::set_text_at(int row, int col, const char *str) | |
615 | - { | |
616 | - return lib3270_set_text_at(hSession,row,col,(const unsigned char *) str); | |
617 | - } | |
618 | - | |
619 | - bool plugin::is_ready(void) | |
620 | - { | |
621 | - return lib3270_is_ready(hSession) != 0; | |
622 | - } | |
623 | - | |
624 | - int plugin::set_cursor_position(int row, int col) | |
625 | - { | |
626 | - return lib3270_set_cursor_position(hSession,row,col); | |
627 | - } | |
628 | - | |
629 | - int plugin::set_toggle(LIB3270_TOGGLE ix, bool value) | |
630 | - { | |
631 | - return lib3270_set_toggle(hSession,ix,(int) value); | |
632 | - } | |
633 | - | |
634 | - void plugin::logva(const char *fmt, va_list args) | |
635 | - { | |
636 | - lib3270_write_va_log(hSession,"REXX",fmt,args); | |
637 | - } | |
638 | - | |
639 | - string plugin::get_text(int baddr, size_t len) | |
640 | - { | |
641 | - string rc; | |
642 | - char * ptr = lib3270_get_text(hSession,baddr,len); | |
643 | - | |
644 | - if(ptr) | |
645 | - { | |
646 | - rc.assign(ptr); | |
647 | - lib3270_free(ptr); | |
648 | - } | |
649 | - | |
650 | - return rc; | |
651 | - } | |
652 | - | |
653 | - int plugin::get_field_start(int baddr) | |
654 | - { | |
655 | - return lib3270_get_field_start(hSession,baddr); | |
656 | - } | |
657 | - | |
658 | - int plugin::get_field_len(int baddr) | |
659 | - { | |
660 | - return lib3270_get_field_len(hSession,baddr); | |
661 | - } | |
662 | - | |
663 | - int plugin::set_copy(const char *text) | |
664 | - { | |
665 | - v3270_set_copy(GTK_WIDGET(lib3270_get_user_data(hSession)),text); | |
666 | - return 0; | |
667 | - } | |
668 | - | |
669 | - string plugin::get_copy(void) | |
670 | - { | |
671 | - string rc; | |
672 | - gchar * ptr = v3270_get_copy(GTK_WIDGET(lib3270_get_user_data(hSession))); | |
673 | - | |
674 | - if(ptr) | |
675 | - { | |
676 | - rc.assign(ptr); | |
677 | - g_free(ptr); | |
678 | - } | |
679 | - | |
680 | - return rc; | |
681 | - } | |
682 | - | |
683 | - string plugin::get_clipboard(void) | |
684 | - { | |
685 | - string rc; | |
686 | - gchar * ptr = gtk_clipboard_wait_for_text(gtk_widget_get_clipboard(pw3270_get_toplevel(),GDK_SELECTION_CLIPBOARD)); | |
687 | - | |
688 | - if(ptr) | |
689 | - { | |
690 | - rc.assign(ptr); | |
691 | - g_free(ptr); | |
692 | - } | |
693 | - | |
694 | - return rc; | |
695 | - } | |
696 | - | |
697 | - int plugin::set_clipboard(const char *text) | |
698 | - { | |
699 | - gtk_clipboard_set_text(gtk_widget_get_clipboard(pw3270_get_toplevel(),GDK_SELECTION_CLIPBOARD),(gchar *) text, -1); | |
700 | - return 0; | |
701 | - } | |
702 | - | |
703 | - void plugin::free(void *ptr) | |
704 | - { | |
705 | - g_free(ptr); | |
706 | - } | |
707 | - | |
708 | - int plugin::set_cursor_addr(int addr) | |
709 | - { | |
710 | - return lib3270_set_cursor_address(hSession,addr); | |
711 | - } | |
712 | - | |
713 | - int plugin::get_cursor_addr(void) | |
714 | - { | |
715 | - return lib3270_get_cursor_address(hSession); | |
716 | - } | |
717 | - | |
718 | - int plugin::get_width(void) | |
719 | - { | |
720 | - return lib3270_get_width(hSession); | |
721 | - } | |
722 | - | |
723 | - int plugin::get_height(void) | |
724 | - { | |
725 | - return lib3270_get_height(hSession); | |
726 | - } | |
727 | - | |
728 | - int plugin::get_length(void) | |
729 | - { | |
730 | - return lib3270_get_length(hSession); | |
731 | - } | |
732 | - | |
733 | - int plugin::emulate_input(const char *str) | |
734 | - { | |
735 | - return lib3270_emulate_input(hSession, str, -1, 1); | |
736 | - } | |
737 | - | |
738 | - int plugin::get_next_unprotected(int baddr) | |
739 | - { | |
740 | - return lib3270_get_next_unprotected(hSession,baddr); | |
741 | - } | |
742 | - | |
743 | - int plugin::get_is_protected(int baddr) | |
744 | - { | |
745 | - return lib3270_get_is_protected(hSession,baddr); | |
746 | - } | |
747 | - | |
748 | - int plugin::get_is_protected_at(int row, int col) | |
749 | - { | |
750 | - return lib3270_get_is_protected_at(hSession,row,col); | |
751 | - } | |
752 | - | |
753 | -int plugin::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...) | |
754 | -{ | |
755 | - va_list args; | |
756 | - va_start(args, fmt); | |
757 | - lib3270_popup_va(hSession, id, title, message, fmt, args); | |
758 | - va_end(args); | |
759 | - return 0; | |
760 | -} | |
761 | - | |
762 | -string plugin::file_chooser_dialog(int action, const char *title, const char *extension, const char *filename) | |
763 | -{ | |
764 | - string rc; | |
765 | - | |
766 | - gchar * ptr = pw3270_file_chooser((GtkFileChooserAction) action, script_name ? script_name : "rexx", title, filename, extension); | |
767 | - | |
768 | - if(ptr) | |
769 | - { | |
770 | - rc.assign((char *) ptr); | |
771 | - g_free(ptr); | |
772 | - } | |
773 | - | |
774 | - return rc; | |
775 | -} | |
776 | - | |
777 | -int plugin::quit(void) | |
778 | -{ | |
779 | - gtk_main_quit(); | |
780 | - return 0; | |
781 | -} | |
782 | - | |
783 | -int plugin::action(const char *name) | |
784 | -{ | |
785 | - return lib3270_action(hSession,name); | |
786 | -} | |
787 | - | |
788 | -int plugin::set_host_charset(const char *charset) | |
789 | -{ | |
790 | - return lib3270_set_host_charset(hSession,charset); | |
791 | -} | |
792 | - | |
793 | -string plugin::get_host_charset(void) | |
794 | -{ | |
795 | - return string(lib3270_get_host_charset(hSession)); | |
796 | -} | |
797 | - | |
798 | -string plugin::get_display_charset(void) | |
799 | -{ | |
800 | - return string(lib3270_get_display_charset(hSession)); | |
801 | -} | |
802 | - | |
803 | -int plugin::erase(void) | |
804 | -{ | |
805 | - return lib3270_erase(hSession); | |
806 | -} | |
807 | - | |
808 | -int plugin::erase_eof(void) | |
809 | -{ | |
810 | - return lib3270_eraseeof(hSession); | |
811 | -} | |
812 | - | |
813 | -int plugin::erase_eol(void) | |
814 | -{ | |
815 | - return lib3270_eraseeol(hSession); | |
816 | -} | |
817 | - | |
818 | -int plugin::erase_input(void) | |
819 | -{ | |
820 | - return lib3270_eraseinput(hSession); | |
821 | -} | |
822 | - | |
823 | -int plugin::print(void) | |
824 | -{ | |
825 | - return lib3270_print(hSession); | |
826 | -} | |
827 | - | |
828 | -const char * plugin::asc2ebc(unsigned char *str, int sz) | |
829 | -{ | |
830 | - return lib3270_asc2ebc(hSession,str,sz); | |
831 | -} | |
832 | - | |
833 | -int plugin::set_url(const char *uri) | |
834 | -{ | |
835 | - return lib3270_set_url(hSession,uri) != NULL ? 1 : 0; | |
836 | -} | |
837 | - | |
838 | -const char * plugin::ebc2asc(unsigned char *str, int sz) | |
839 | -{ | |
840 | - return lib3270_ebc2asc(hSession,str,sz); | |
841 | -} | |
842 | - | |
843 | -int plugin::file_transfer(LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl, int blksize, int primspace, int secspace, int dft) | |
844 | -{ | |
845 | - /* | |
846 | - return v3270_transfer_file(v3270_get_default_widget(),options,local,remote,lrecl,blksize,primspace,secspace,dft); | |
847 | - */ | |
848 | - return EINVAL; | |
849 | -} | |
850 | - | |
851 | -void plugin::set_unlock_delay(unsigned short ms) | |
852 | -{ | |
853 | - lib3270_set_unlock_delay(hSession, (unsigned short) ms); | |
854 | -} | |
855 | - | ... | ... |