Commit 8e0eafe5842be42647f7c03d12e900da9bcccb11
1 parent
70785486
Exists in
master
and in
5 other branches
Implementando objeto rexx
Showing
5 changed files
with
157 additions
and
5 deletions
Show diff stats
pw3270.cbp
... | ... | @@ -287,6 +287,8 @@ |
287 | 287 | <Unit filename="src/plugins/rx3270/Makefile.in" /> |
288 | 288 | <Unit filename="src/plugins/rx3270/local.cc" /> |
289 | 289 | <Unit filename="src/plugins/rx3270/pluginmain.cc" /> |
290 | + <Unit filename="src/plugins/rx3270/rexx_methods.cc" /> | |
291 | + <Unit filename="src/plugins/rx3270/rx3270.cls" /> | |
290 | 292 | <Unit filename="src/plugins/rx3270/rx3270.h" /> |
291 | 293 | <Unit filename="src/plugins/rx3270/rxapimain.cc" /> |
292 | 294 | <Unit filename="src/plugins/rx3270/text.cc" /> | ... | ... |
src/plugins/rx3270/rexx_methods.cc
... | ... | @@ -74,3 +74,117 @@ RexxMethod2(int, rx3270_method_sleep, CSELF, sessionPtr, int, seconds) |
74 | 74 | return -1; |
75 | 75 | return hSession->wait(seconds); |
76 | 76 | } |
77 | + | |
78 | +RexxMethod1(int, rx3270_method_is_connected, CSELF, sessionPtr) | |
79 | +{ | |
80 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
81 | + if(!hSession) | |
82 | + return -1; | |
83 | + return hSession->is_connected(); | |
84 | +} | |
85 | + | |
86 | +RexxMethod1(int, rx3270_method_is_ready, CSELF, sessionPtr) | |
87 | +{ | |
88 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
89 | + if(!hSession) | |
90 | + return -1; | |
91 | + return hSession->is_ready(); | |
92 | +} | |
93 | + | |
94 | +RexxMethod2(int, rx3270_method_wait_for_ready, CSELF, sessionPtr, int, seconds) | |
95 | +{ | |
96 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
97 | + if(!hSession) | |
98 | + return -1; | |
99 | + return hSession->wait_for_ready(seconds); | |
100 | +} | |
101 | + | |
102 | +RexxMethod3(int, rx3270_method_set_cursor, CSELF, sessionPtr, int, row, int, col) | |
103 | +{ | |
104 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
105 | + if(!hSession) | |
106 | + return -1; | |
107 | + return hSession->set_cursor_position(row,col); | |
108 | +} | |
109 | + | |
110 | +RexxMethod1(int, rx3270_method_enter, CSELF, sessionPtr) | |
111 | +{ | |
112 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
113 | + if(!hSession) | |
114 | + return -1; | |
115 | + return hSession->enter(); | |
116 | +} | |
117 | + | |
118 | +RexxMethod2(int, rx3270_method_pfkey, CSELF, sessionPtr, int, key) | |
119 | +{ | |
120 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
121 | + if(!hSession) | |
122 | + return -1; | |
123 | + return hSession->pfkey(key); | |
124 | +} | |
125 | + | |
126 | +RexxMethod2(int, rx3270_method_pakey, CSELF, sessionPtr, int, key) | |
127 | +{ | |
128 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
129 | + if(!hSession) | |
130 | + return -1; | |
131 | + return hSession->pakey(key); | |
132 | +} | |
133 | + | |
134 | +RexxMethod4(RexxStringObject, rx3270_method_get_text_at, CSELF, sessionPtr, int, row, int, col, int, sz) | |
135 | +{ | |
136 | + rx3270 * session = (rx3270 *) sessionPtr; | |
137 | + | |
138 | + if(session) | |
139 | + { | |
140 | + char * str = session->get_text_at(row,col,sz); | |
141 | + | |
142 | + if(str) | |
143 | + { | |
144 | + char * text = session->get_local_string(str); | |
145 | + RexxStringObject ret = context->String((CSTRING) text); | |
146 | + free(str); | |
147 | + free(text); | |
148 | + return ret; | |
149 | + } | |
150 | + } | |
151 | + | |
152 | + return context->String(""); | |
153 | +} | |
154 | + | |
155 | + | |
156 | +RexxMethod4(int, rx3270_method_set_text_at, CSELF, sessionPtr, int, row, int, col, CSTRING, text) | |
157 | +{ | |
158 | + rx3270 * session = (rx3270 *) sessionPtr; | |
159 | + | |
160 | + if(session) | |
161 | + { | |
162 | + char * str = session->get_3270_string(text); | |
163 | + int rc; | |
164 | + rc = session->set_text_at(row,col,str); | |
165 | + free(str); | |
166 | + return rc; | |
167 | + } | |
168 | + return -1; | |
169 | +} | |
170 | + | |
171 | +RexxMethod4(int, rx3270_method_cmp_text_at, CSELF, sessionPtr, int, row, int, col, CSTRING, key) | |
172 | +{ | |
173 | + int rc = 0; | |
174 | + rx3270 * session = (rx3270 *) sessionPtr; | |
175 | + | |
176 | + if(session) | |
177 | + { | |
178 | + char * str = session->get_text_at(row,col,strlen(key)); | |
179 | + if(str) | |
180 | + { | |
181 | + char * text = session->get_3270_string(key); | |
182 | + rc = strcasecmp(str,text); | |
183 | + free(text); | |
184 | + } | |
185 | + free(str); | |
186 | + } | |
187 | + | |
188 | + return rc; | |
189 | +} | |
190 | + | ... | ... |
src/plugins/rx3270/rx3270.cls
... | ... | @@ -42,3 +42,18 @@ |
42 | 42 | |
43 | 43 | ::METHOD SLEEP EXTERNAL "LIBRARY rx3270 rx3270_method_sleep" |
44 | 44 | |
45 | +::METHOD CONNECTED EXTERNAL "LIBRARY rx3270 rx3270_method_is_connected" | |
46 | +::METHOD READY EXTERNAL "LIBRARY rx3270 rx3270_method_is_ready" | |
47 | + | |
48 | +::METHOD WAITFORREADY EXTERNAL "LIBRARY rx3270 rx3270_method_wait_for_ready" | |
49 | + | |
50 | +::METHOD SETCURSOR EXTERNAL "LIBRARY rx3270 rx3270_method_set_cursor" | |
51 | + | |
52 | +::METHOD ENTER EXTERNAL "LIBRARY rx3270 rx3270_method_enter" | |
53 | +::METHOD PFKEY EXTERNAL "LIBRARY rx3270 rx3270_method_pfkey" | |
54 | +::METHOD PFKEY EXTERNAL "LIBRARY rx3270 rx3270_method_pakey" | |
55 | + | |
56 | +::METHOD GETTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_get_text_at" | |
57 | +::METHOD SETTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_set_text_at" | |
58 | +::METHOD CMPTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_cmp_text_at" | |
59 | + | ... | ... |
src/plugins/rx3270/rx3270.h
... | ... | @@ -75,6 +75,16 @@ |
75 | 75 | REXX_METHOD_PROTOTYPE(rx3270_method_connect); |
76 | 76 | REXX_METHOD_PROTOTYPE(rx3270_method_disconnect); |
77 | 77 | REXX_METHOD_PROTOTYPE(rx3270_method_sleep); |
78 | + REXX_METHOD_PROTOTYPE(rx3270_method_is_connected); | |
79 | + REXX_METHOD_PROTOTYPE(rx3270_method_is_ready); | |
80 | + REXX_METHOD_PROTOTYPE(rx3270_method_wait_for_ready); | |
81 | + REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor); | |
82 | + REXX_METHOD_PROTOTYPE(rx3270_method_enter); | |
83 | + REXX_METHOD_PROTOTYPE(rx3270_method_pfkey); | |
84 | + REXX_METHOD_PROTOTYPE(rx3270_method_pakey); | |
85 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_text_at); | |
86 | + REXX_METHOD_PROTOTYPE(rx3270_method_set_text_at); | |
87 | + REXX_METHOD_PROTOTYPE(rx3270_method_cmp_text_at); | |
78 | 88 | |
79 | 89 | /*---[ Globals ]---------------------------------------------------------------------------------------------*/ |
80 | 90 | ... | ... |
src/plugins/rx3270/rxapimain.cc
... | ... | @@ -111,11 +111,22 @@ RexxRoutineEntry rx3270_functions[] = |
111 | 111 | |
112 | 112 | RexxMethodEntry rx3270_methods[] = |
113 | 113 | { |
114 | - REXX_METHOD(rx3270_method_init, rx3270_method_init ), | |
115 | - REXX_METHOD(rx3270_method_uninit, rx3270_method_uninit ), | |
116 | - REXX_METHOD(rx3270_method_connect, rx3270_method_connect ), | |
117 | - REXX_METHOD(rx3270_method_disconnect, rx3270_method_disconnect ), | |
118 | - REXX_METHOD(rx3270_method_sleep, rx3270_method_sleep ), | |
114 | + REXX_METHOD(rx3270_method_init, rx3270_method_init ), | |
115 | + REXX_METHOD(rx3270_method_uninit, rx3270_method_uninit ), | |
116 | + REXX_METHOD(rx3270_method_connect, rx3270_method_connect ), | |
117 | + REXX_METHOD(rx3270_method_disconnect, rx3270_method_disconnect ), | |
118 | + REXX_METHOD(rx3270_method_sleep, rx3270_method_sleep ), | |
119 | + REXX_METHOD(rx3270_method_is_connected, rx3270_method_is_connected ), | |
120 | + REXX_METHOD(rx3270_method_is_ready, rx3270_method_is_ready ), | |
121 | + REXX_METHOD(rx3270_method_wait_for_ready, rx3270_method_wait_for_ready ), | |
122 | + REXX_METHOD(rx3270_method_set_cursor, rx3270_method_set_cursor ), | |
123 | + REXX_METHOD(rx3270_method_enter, rx3270_method_enter ), | |
124 | + REXX_METHOD(rx3270_method_pfkey, rx3270_method_pfkey ), | |
125 | + REXX_METHOD(rx3270_method_pakey, rx3270_method_pakey ), | |
126 | + REXX_METHOD(rx3270_method_get_text_at, rx3270_method_get_text_at ), | |
127 | + REXX_METHOD(rx3270_method_set_text_at, rx3270_method_set_text_at ), | |
128 | + REXX_METHOD(rx3270_method_cmp_text_at, rx3270_method_cmp_text_at ), | |
129 | + | |
119 | 130 | REXX_LAST_METHOD() |
120 | 131 | }; |
121 | 132 | ... | ... |