Commit c6a0891622310907a875b3e637b711958e2ceec9

Authored by Perry Werneck
1 parent 7813f5bd
Exists in master and in 1 other branch develop

Row & Col should be unsigned short.

client/src/core/session.cc
@@ -392,7 +392,7 @@ @@ -392,7 +392,7 @@
392 return toString(baddr,len,'\0').compare(0,len,s); 392 return toString(baddr,len,'\0').compare(0,len,s);
393 } 393 }
394 394
395 - int Session::compare(unsigned int row, unsigned int col, const char* s, int len) const { 395 + int Session::compare(unsigned short row, unsigned short col, const char* s, int len) const {
396 396
397 if(len < 0) 397 if(len < 0)
398 len = strlen(s); 398 len = strlen(s);
client/src/host/pop.cc
@@ -53,7 +53,7 @@ TN3270::Host &amp; TN3270::Host::pop(int baddr, std::string &amp;text) { @@ -53,7 +53,7 @@ TN3270::Host &amp; TN3270::Host::pop(int baddr, std::string &amp;text) {
53 return *this; 53 return *this;
54 } 54 }
55 55
56 -TN3270::Host & TN3270::Host::pop(int row, int col, std::string &text) { 56 +TN3270::Host & TN3270::Host::pop(unsigned short row, unsigned short col, std::string &text) {
57 57
58 this->session->waitForReady(this->timeout); 58 this->session->waitForReady(this->timeout);
59 59
client/src/host/push.cc
@@ -45,7 +45,7 @@ TN3270::Host &amp; TN3270::Host::push(int baddr, const char *str, int len) { @@ -45,7 +45,7 @@ TN3270::Host &amp; TN3270::Host::push(int baddr, const char *str, int len) {
45 return *this; 45 return *this;
46 } 46 }
47 47
48 -TN3270::Host & TN3270::Host::push(int row, int col, const char *str, int len) { 48 +TN3270::Host & TN3270::Host::push(unsigned short row, unsigned short col, const char *str, int len) {
49 session->push(row,col,str,len); 49 session->push(row,col,str,len);
50 return *this; 50 return *this;
51 } 51 }
@@ -60,7 +60,7 @@ TN3270::Host &amp; TN3270::Host::push(int baddr, const std::string &amp;text) { @@ -60,7 +60,7 @@ TN3270::Host &amp; TN3270::Host::push(int baddr, const std::string &amp;text) {
60 return *this; 60 return *this;
61 } 61 }
62 62
63 -TN3270::Host & TN3270::Host::push(int row, int col, const std::string &text) { 63 +TN3270::Host & TN3270::Host::push(unsigned short row, unsigned short col, const std::string &text) {
64 session->push(row,col,text); 64 session->push(row,col,text);
65 return *this; 65 return *this;
66 } 66 }
client/src/host/string.cc
@@ -53,7 +53,7 @@ std::string TN3270::Host::toString(int baddr, int len, char lf) const { @@ -53,7 +53,7 @@ std::string TN3270::Host::toString(int baddr, int len, char lf) const {
53 53
54 } 54 }
55 55
56 -std::string TN3270::Host::toString(unsigned int row, unsigned int col, int len, char lf) const { 56 +std::string TN3270::Host::toString(unsigned short row, unsigned short col, int len, char lf) const {
57 57
58 this->session->waitForReady(this->timeout); 58 this->session->waitForReady(this->timeout);
59 return this->session->toString(row,col,len,lf); 59 return this->session->toString(row,col,len,lf);
@@ -76,7 +76,7 @@ int TN3270::Host::compare(int baddr, const char* s, int len) const { @@ -76,7 +76,7 @@ int TN3270::Host::compare(int baddr, const char* s, int len) const {
76 76
77 } 77 }
78 78
79 -int TN3270::Host::compare(unsigned int row, unsigned int col, const char* s, int len) const { 79 +int TN3270::Host::compare(unsigned short row, unsigned short col, const char* s, int len) const {
80 80
81 this->session->waitForReady(this->timeout); 81 this->session->waitForReady(this->timeout);
82 return this->session->compare(row,col,s,len); 82 return this->session->compare(row,col,s,len);
client/src/include/ipc-client-internals.h
@@ -159,14 +159,14 @@ @@ -159,14 +159,14 @@
159 159
160 // Contents 160 // Contents
161 std::string toString(int baddr, int len, char lf) const override; 161 std::string toString(int baddr, int len, char lf) const override;
162 - std::string toString(unsigned int row, unsigned int col, int len, char lf) const override; 162 + std::string toString(unsigned short row, unsigned short col, int len, char lf) const override;
163 163
164 void push(const char *text, size_t length) override; 164 void push(const char *text, size_t length) override;
165 void push(int baddr, const char *text, int length) override; 165 void push(int baddr, const char *text, int length) override;
166 - void push(int row, int col, const char *text, int length) override; 166 + void push(unsigned short row, unsigned short col, const char *text, int length) override;
167 167
168 void pop(int baddr, std::string &text) override; 168 void pop(int baddr, std::string &text) override;
169 - void pop(int row, int col, std::string &text) override; 169 + void pop(unsigned short row, unsigned short col, std::string &text) override;
170 void pop(std::string &text) override; 170 void pop(std::string &text) override;
171 171
172 }; 172 };
client/src/include/lib3270/ipc.h
@@ -408,12 +408,12 @@ @@ -408,12 +408,12 @@
408 408
409 // Contents 409 // Contents
410 virtual std::string toString(int baddr = 0, int len = -1, char lf = '\n') const = 0; 410 virtual std::string toString(int baddr = 0, int len = -1, char lf = '\n') const = 0;
411 - virtual std::string toString(unsigned int row, unsigned int col, int len, char lf = '\n') const = 0; 411 + virtual std::string toString(unsigned short row, unsigned short col, int len, char lf = '\n') const = 0;
412 412
413 /// @brief Input string. 413 /// @brief Input string.
414 virtual void push(const char *text, size_t length) = 0; 414 virtual void push(const char *text, size_t length) = 0;
415 virtual void push(int baddr, const char *text, int length) = 0; 415 virtual void push(int baddr, const char *text, int length) = 0;
416 - virtual void push(int row, int col, const char *text, int length) = 0; 416 + virtual void push(unsigned short row, unsigned short col, const char *text, int length) = 0;
417 417
418 inline void push(const std::string &text) { 418 inline void push(const std::string &text) {
419 push(-1,text.c_str(),text.size()); 419 push(-1,text.c_str(),text.size());
@@ -423,7 +423,7 @@ @@ -423,7 +423,7 @@
423 push(baddr,text.c_str(),text.size()); 423 push(baddr,text.c_str(),text.size());
424 } 424 }
425 425
426 - inline void push(int row, int col, const std::string &text) { 426 + inline void push(unsigned short row, unsigned short col, const std::string &text) {
427 push(row,col,text.c_str(),text.size()); 427 push(row,col,text.c_str(),text.size());
428 } 428 }
429 429
@@ -435,7 +435,7 @@ @@ -435,7 +435,7 @@
435 virtual void pop(int baddr, std::string &text) = 0; 435 virtual void pop(int baddr, std::string &text) = 0;
436 436
437 /// @brief Get contents of field at position. 437 /// @brief Get contents of field at position.
438 - virtual void pop(int row, int col, std::string &text) = 0; 438 + virtual void pop(unsigned short row, unsigned short col, std::string &text) = 0;
439 439
440 /// @brief Get contents of field at cursor position. 440 /// @brief Get contents of field at cursor position.
441 virtual void pop(std::string &text) = 0; 441 virtual void pop(std::string &text) = 0;
@@ -559,7 +559,7 @@ @@ -559,7 +559,7 @@
559 virtual void wait(const char *text, int seconds = DEFAULT_TIMEOUT) = 0; 559 virtual void wait(const char *text, int seconds = DEFAULT_TIMEOUT) = 0;
560 560
561 /// @brief Wait for string. 561 /// @brief Wait for string.
562 - virtual void wait(unsigned int row, unsigned int col, const char *text, int seconds = DEFAULT_TIMEOUT) = 0; 562 + virtual void wait(unsigned short row, unsigned short col, const char *text, int seconds = DEFAULT_TIMEOUT) = 0;
563 563
564 /// @brief Wait for string. 564 /// @brief Wait for string.
565 virtual void wait(int addr, const char *text, int seconds = DEFAULT_TIMEOUT) = 0; 565 virtual void wait(int addr, const char *text, int seconds = DEFAULT_TIMEOUT) = 0;
@@ -583,7 +583,7 @@ @@ -583,7 +583,7 @@
583 583
584 /// @brief Compare contents. 584 /// @brief Compare contents.
585 int compare(int baddr, const char* s, int len = -1) const; 585 int compare(int baddr, const char* s, int len = -1) const;
586 - int compare(unsigned int row, unsigned int col, const char* s, int len = -1) const; 586 + int compare(unsigned short row, unsigned short col, const char* s, int len = -1) const;
587 587
588 }; 588 };
589 589
@@ -632,20 +632,21 @@ @@ -632,20 +632,21 @@
632 LIB3270_KEYBOARD_LOCK_STATE input(const char *text, int length = -1, const char control_char = '@'); 632 LIB3270_KEYBOARD_LOCK_STATE input(const char *text, int length = -1, const char control_char = '@');
633 633
634 Host & push(int baddr, const std::string &text); 634 Host & push(int baddr, const std::string &text);
635 - Host & push(int row, int col, const std::string &text); 635 + Host & push(unsigned short row, unsigned short col, const std::string &text);
636 Host & push(const std::string &text); 636 Host & push(const std::string &text);
637 637
  638 + Host & push(const char *text);
638 Host & push(int baddr, const char *str, int len = -1); 639 Host & push(int baddr, const char *str, int len = -1);
639 - Host & push(int row, int col, const char *str, int len = -1); 640 + Host & push(unsigned short row, unsigned short col, const char *str, int len = -1);
640 Host & push(const char *str, int len = -1); 641 Host & push(const char *str, int len = -1);
641 642
642 Host & pop(int baddr, std::string &text); 643 Host & pop(int baddr, std::string &text);
643 - Host & pop(int row, int col, std::string &text); 644 + Host & pop(unsigned short row, unsigned short col, std::string &text);
644 Host & pop(std::string &text); 645 Host & pop(std::string &text);
645 646
646 std::string toString() const; 647 std::string toString() const;
647 std::string toString(int baddr, int len = -1, char lf = '\n') const; 648 std::string toString(int baddr, int len = -1, char lf = '\n') const;
648 - std::string toString(unsigned int row, unsigned int col, int len = -1, char lf = '\n') const; 649 + std::string toString(unsigned short row, unsigned short col, int len = -1, char lf = '\n') const;
649 650
650 template<typename T> 651 template<typename T>
651 Host & push(T value) { 652 Host & push(T value) {
@@ -822,11 +823,11 @@ @@ -822,11 +823,11 @@
822 } 823 }
823 824
824 /// @brief Wait for string. 825 /// @brief Wait for string.
825 - inline void wait(unsigned int row, unsigned int col, const char *text) { 826 + inline void wait(unsigned short row, unsigned short col, const char *text) {
826 return session->wait(row,col,text,this->timeout); 827 return session->wait(row,col,text,this->timeout);
827 } 828 }
828 829
829 - inline void wait(unsigned int row, unsigned int col, const char *text, time_t timeout) { 830 + inline void wait(unsigned short row, unsigned short col, const char *text, time_t timeout) {
830 return session->wait(row,col,text,timeout); 831 return session->wait(row,col,text,timeout);
831 } 832 }
832 833
@@ -844,7 +845,7 @@ @@ -844,7 +845,7 @@
844 845
845 /// @brief Compare contents. 846 /// @brief Compare contents.
846 int compare(int baddr, const char* s, int len = -1) const; 847 int compare(int baddr, const char* s, int len = -1) const;
847 - int compare(unsigned int row, unsigned int col, const char* s, int len = -1) const; 848 + int compare(unsigned short row, unsigned short col, const char* s, int len = -1) const;
848 849
849 // Set contents. 850 // Set contents.
850 851
@@ -859,11 +860,6 @@ @@ -859,11 +860,6 @@
859 860
860 // Host & input(const char *text, size_t sz); 861 // Host & input(const char *text, size_t sz);
861 862
862 - /// @brief Set field at current position, jumps to next writable field.  
863 - inline Host & push(const char *text) {  
864 - session->push(text,-1);  
865 - return *this;  
866 - };  
867 863
868 /* 864 /*
869 // Event listeners 865 // Event listeners
client/src/session/get.cc
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 return convertFromHost(get(baddr,len,lf)); 46 return convertFromHost(get(baddr,len,lf));
47 } 47 }
48 48
49 - std::string Abstract::Session::toString(unsigned int row, unsigned int col, int len, char lf) const { 49 + std::string Abstract::Session::toString(unsigned short row, unsigned short col, int len, char lf) const {
50 return convertFromHost(get(row,col,len,lf)); 50 return convertFromHost(get(row,col,len,lf));
51 } 51 }
52 52
@@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
56 } 56 }
57 57
58 /// @brief Get contents of field at position. 58 /// @brief Get contents of field at position.
59 - void Abstract::Session::pop(int row, int col, std::string &text) { 59 + void Abstract::Session::pop(unsigned short row, unsigned short col, std::string &text) {
60 throw std::system_error(ENOTSUP, std::system_category()); 60 throw std::system_error(ENOTSUP, std::system_category());
61 } 61 }
62 62
client/src/session/local/private.h
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 105
106 void wait(const char *text, int seconds) override; 106 void wait(const char *text, int seconds) override;
107 void wait(int addr, const char *text, int seconds) override; 107 void wait(int addr, const char *text, int seconds) override;
108 - void wait(unsigned int row, unsigned int col, const char *text, int seconds) override; 108 + void wait(unsigned short row, unsigned short col, const char *text, int seconds) override;
109 109
110 // States 110 // States
111 ProgramMessage getProgramMessage() const override; 111 ProgramMessage getProgramMessage() const override;
client/src/session/local/wait.cc
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 76
77 } 77 }
78 78
79 - void Local::Session::wait(unsigned int row, unsigned int col, const char *text, int seconds) { 79 + void Local::Session::wait(unsigned short row, unsigned short col, const char *text, int seconds) {
80 80
81 std::lock_guard<std::mutex> lock(sync); 81 std::lock_guard<std::mutex> lock(sync);
82 chkResponse(lib3270_wait_for_string_at(hSession,row,col,convertToHost(text,-1).c_str(),seconds)); 82 chkResponse(lib3270_wait_for_string_at(hSession,row,col,convertToHost(text,-1).c_str(),seconds));
client/src/session/remote/private.h
@@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
106 106
107 void wait(const char *text, int seconds) override; 107 void wait(const char *text, int seconds) override;
108 void wait(int addr, const char *text, int seconds) override; 108 void wait(int addr, const char *text, int seconds) override;
109 - void wait(unsigned int row, unsigned int col, const char *text, int seconds) override; 109 + void wait(unsigned short row, unsigned short col, const char *text, int seconds) override;
110 110
111 // States 111 // States
112 ProgramMessage getProgramMessage() const override; 112 ProgramMessage getProgramMessage() const override;
client/src/session/remote/wait.cc
@@ -174,7 +174,7 @@ @@ -174,7 +174,7 @@
174 174
175 } 175 }
176 176
177 - void IPC::Session::wait(unsigned int row, unsigned int col, const char *text, int seconds) { 177 + void IPC::Session::wait(unsigned short row, unsigned short col, const char *text, int seconds) {
178 178
179 string key = convertToHost(text,-1); 179 string key = convertToHost(text,-1);
180 180
client/src/session/set.cc
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 set(baddr,convertToHost(text,length)); 51 set(baddr,convertToHost(text,length));
52 } 52 }
53 53
54 - void Abstract::Session::push(int row, int col, const char *text, int length) { 54 + void Abstract::Session::push(unsigned short row, unsigned short col, const char *text, int length) {
55 set(row,col,convertToHost(text,length)); 55 set(row,col,convertToHost(text,length));
56 } 56 }
57 57