Commit 545d9579f808496719f1a1de9eeae626e6187b57

Authored by Perry Werneck
1 parent e7876068

+ Adding cursor and color properties.

src/include/lib3270.h
@@ -1211,8 +1211,8 @@ @@ -1211,8 +1211,8 @@
1211 1211
1212 LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt); 1212 LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt);
1213 1213
1214 - LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype);  
1215 - LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession); 1214 + LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, int colortype);
  1215 + LIB3270_EXPORT int lib3270_get_color_type(H3270 *hSession);
1216 1216
1217 LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name); 1217 LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name);
1218 LIB3270_EXPORT LIB3270_OPTION lib3270_parse_host_type(const char *name); 1218 LIB3270_EXPORT LIB3270_OPTION lib3270_parse_host_type(const char *name);
src/lib3270/options.c
@@ -94,18 +94,18 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt) @@ -94,18 +94,18 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt)
94 94
95 } 95 }
96 96
97 -LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession) 97 +LIB3270_EXPORT int lib3270_get_color_type(H3270 *hSession)
98 { 98 {
99 CHECK_SESSION_HANDLE(hSession); 99 CHECK_SESSION_HANDLE(hSession);
100 - return hSession->mono ? 2 : hSession->colors; 100 + return (int) (hSession->mono ? 2 : hSession->colors);
101 } 101 }
102 102
103 -LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype) 103 +LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, int colortype)
104 { 104 {
105 CHECK_SESSION_HANDLE(hSession); 105 CHECK_SESSION_HANDLE(hSession);
106 106
107 if(hSession->cstate != LIB3270_NOT_CONNECTED) 107 if(hSession->cstate != LIB3270_NOT_CONNECTED)
108 - return EBUSY; 108 + return errno = EBUSY;
109 109
110 switch(colortype) 110 switch(colortype)
111 { 111 {
@@ -129,7 +129,7 @@ LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colort @@ -129,7 +129,7 @@ LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colort
129 break; 129 break;
130 130
131 default: 131 default:
132 - return EINVAL; 132 + return errno = EINVAL;
133 } 133 }
134 134
135 135
src/lib3270/properties.c
@@ -40,95 +40,123 @@ @@ -40,95 +40,123 @@
40 static const LIB3270_INT_PROPERTY properties[] = { 40 static const LIB3270_INT_PROPERTY properties[] = {
41 41
42 { 42 {
43 - "ready", ///< Property name.  
44 - N_( "" ), ///< Property description.  
45 - lib3270_is_ready, ///< Get value.  
46 - NULL ///< Set value. 43 + "ready", // Property name.
  44 + N_( "" ), // Property description.
  45 + lib3270_is_ready, // Get value.
  46 + NULL // Set value.
47 }, 47 },
48 48
49 { 49 {
50 - "connected", ///< Property name.  
51 - N_( "" ), ///< Property description.  
52 - lib3270_is_connected, ///< Get value.  
53 - lib3270_set_connected ///< Set value. 50 + "connected", // Property name.
  51 + N_( "" ), // Property description.
  52 + lib3270_is_connected, // Get value.
  53 + lib3270_set_connected // Set value.
54 }, 54 },
55 55
56 { 56 {
57 - "secure", ///< Property name.  
58 - N_( "" ), ///< Property description.  
59 - lib3270_is_secure, ///< Get value.  
60 - NULL ///< Set value. 57 + "secure", // Property name.
  58 + N_( "" ), // Property description.
  59 + lib3270_is_secure, // Get value.
  60 + NULL // Set value.
61 }, 61 },
62 62
63 { 63 {
64 - "tso", ///< Property name.  
65 - N_( "Non zero if the host is TSO." ), ///< Property description.  
66 - lib3270_is_tso, ///< Get value.  
67 - NULL ///< Set value. 64 + "tso", // Property name.
  65 + N_( "Non zero if the host is TSO." ), // Property description.
  66 + lib3270_is_tso, // Get value.
  67 + NULL // Set value.
68 }, 68 },
69 69
70 { 70 {
71 - "pconnected", ///< Property name.  
72 - N_( "" ), ///< Property description.  
73 - lib3270_pconnected, ///< Get value.  
74 - NULL ///< Set value. 71 + "pconnected", // Property name.
  72 + N_( "" ), // Property description.
  73 + lib3270_pconnected, // Get value.
  74 + NULL // Set value.
75 }, 75 },
76 76
77 { 77 {
78 - "half_connected", ///< Property name.  
79 - N_( "" ), ///< Property description.  
80 - lib3270_half_connected, ///< Get value.  
81 - NULL ///< Set value. 78 + "half_connected", // Property name.
  79 + N_( "" ), // Property description.
  80 + lib3270_half_connected, // Get value.
  81 + NULL // Set value.
82 }, 82 },
83 83
84 { 84 {
85 - "neither", ///< Property name.  
86 - N_( "" ), ///< Property description.  
87 - lib3270_in_neither, ///< Get value.  
88 - NULL ///< Set value. 85 + "neither", // Property name.
  86 + N_( "" ), // Property description.
  87 + lib3270_in_neither, // Get value.
  88 + NULL // Set value.
89 }, 89 },
90 90
91 { 91 {
92 - "ansi", ///< Property name.  
93 - N_( "" ), ///< Property description.  
94 - lib3270_in_ansi, ///< Get value.  
95 - NULL ///< Set value. 92 + "ansi", // Property name.
  93 + N_( "" ), // Property description.
  94 + lib3270_in_ansi, // Get value.
  95 + NULL // Set value.
96 }, 96 },
97 97
98 { 98 {
99 - "3270", ///< Property name.  
100 - N_( "" ), ///< Property description.  
101 - lib3270_in_3270, ///< Get value.  
102 - NULL ///< Set value. 99 + "3270", // Property name.
  100 + N_( "" ), // Property description.
  101 + lib3270_in_3270, // Get value.
  102 + NULL // Set value.
103 }, 103 },
104 104
105 { 105 {
106 - "sscp", ///< Property name.  
107 - N_( "" ), ///< Property description.  
108 - lib3270_in_sscp, ///< Get value.  
109 - NULL ///< Set value. 106 + "sscp", // Property name.
  107 + N_( "" ), // Property description.
  108 + lib3270_in_sscp, // Get value.
  109 + NULL // Set value.
110 }, 110 },
111 111
112 { 112 {
113 - "tn3270e", ///< Property name.  
114 - N_( "" ), ///< Property description.  
115 - lib3270_in_tn3270e, ///< Get value.  
116 - NULL ///< Set value. 113 + "tn3270e", // Property name.
  114 + N_( "" ), // Property description.
  115 + lib3270_in_tn3270e, // Get value.
  116 + NULL // Set value.
117 }, 117 },
118 118
119 { 119 {
120 - "e", ///< Property name.  
121 - N_( "" ), ///< Property description.  
122 - lib3270_in_e, ///< Get value.  
123 - NULL ///< Set value. 120 + "e", // Property name.
  121 + N_( "" ), // Property description.
  122 + lib3270_in_e, // Get value.
  123 + NULL // Set value.
  124 + },
  125 +
  126 + {
  127 + "cursor_address", // Property name.
  128 + N_( "Cursor address" ), // Property description.
  129 + lib3270_get_cursor_address, // Get value.
  130 + lib3270_set_cursor_address // Set value.
  131 + },
  132 +
  133 + {
  134 + "has_selection", // Property name.
  135 + N_( "Has selected aread" ), // Property description.
  136 + lib3270_has_selection, // Get value.
  137 + NULL // Set value.
  138 + },
  139 +
  140 + {
  141 + "model_number", // Property name.
  142 + N_( "The model number" ), // Property description.
  143 + lib3270_get_model_number, // Get value.
  144 + NULL // Set value.
  145 + },
  146 +
  147 + {
  148 + "color_type", // Property name.
  149 + N_( "The color type" ), // Property description.
  150 + lib3270_get_color_type, // Get value.
  151 + lib3270_set_color_type // Set value.
124 }, 152 },
125 153
126 /* 154 /*
127 { 155 {
128 - "", ///< Property name.  
129 - N_( "" ), ///< Property description.  
130 - NULL, ///< Get value.  
131 - NULL ///< Set value. 156 + "", // Property name.
  157 + N_( "" ), // Property description.
  158 + NULL, // Get value.
  159 + NULL // Set value.
132 }, 160 },
133 */ 161 */
134 162