Commit 16ffc652a011815e0633161955fd197ec609645e
1 parent
2c571f81
Exists in
master
Implementando métodos
Showing
5 changed files
with
35 additions
and
1 deletions
Show diff stats
src/native/get.cc
... | ... | @@ -72,4 +72,9 @@ |
72 | 72 | |
73 | 73 | int tn3270_get_length(h3270::session *ses) { |
74 | 74 | return (int) ses->get_length(); |
75 | -} | |
75 | + } | |
76 | + | |
77 | + int tn3270_get_display_charset(h3270::session *ses, char* str, int len) { | |
78 | + strncpy(str,ses->get_display_charset().c_str(),len); | |
79 | + return 0; | |
80 | + } | ... | ... |
src/native/private.h
... | ... | @@ -115,6 +115,10 @@ |
115 | 115 | DLL_PUBLIC int tn3270_get_width(h3270::session *ses); |
116 | 116 | DLL_PUBLIC int tn3270_get_height(h3270::session *ses); |
117 | 117 | DLL_PUBLIC int tn3270_get_length(h3270::session *ses); |
118 | + | |
119 | + DLL_PUBLIC int tn3270_set_display_charset(h3270::session *ses, const char* str); | |
120 | + DLL_PUBLIC int tn3270_get_display_charset(h3270::session *ses, char* str, int strlen); | |
121 | + | |
118 | 122 | } |
119 | 123 | |
120 | 124 | ... | ... |
src/native/set.cc
... | ... | @@ -46,4 +46,10 @@ int tn3270_set_cursor_addr(h3270::session *ses, int addr) { |
46 | 46 | return 0; |
47 | 47 | } |
48 | 48 | |
49 | +int tn3270_set_display_charset(h3270::session *ses, const char* str) { | |
50 | + debug("%s(%s)",__FUNCTION__,str); | |
51 | + ses->set_display_charset(0,str); | |
52 | + return 0; | |
53 | +} | |
54 | + | |
49 | 55 | ... | ... |
src/pw3270-sharp/pw3270-sharp.cs
... | ... | @@ -128,6 +128,12 @@ namespace pw3270 { |
128 | 128 | [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] |
129 | 129 | extern static int tn3270_get_length(IntPtr Session); |
130 | 130 | |
131 | + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] | |
132 | + extern static int tn3270_set_display_charset(IntPtr Session, string str); | |
133 | + | |
134 | + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] | |
135 | + extern static int tn3270_get_display_charset(IntPtr session, StringBuilder str, int strlen); | |
136 | + | |
131 | 137 | /// <summary> |
132 | 138 | /// Create a new session with lib3270/pw3270 |
133 | 139 | /// </summary> |
... | ... | @@ -435,6 +441,18 @@ namespace pw3270 { |
435 | 441 | } |
436 | 442 | } |
437 | 443 | |
444 | + public string CharSet { | |
445 | + get { | |
446 | + StringBuilder str = new StringBuilder(31); | |
447 | + tn3270_get_display_charset(hSession,str,30); | |
448 | + return str.ToString(); | |
449 | + } | |
450 | + set { | |
451 | + tn3270_set_display_charset(hSession,value); | |
452 | + } | |
453 | + } | |
454 | + | |
455 | + | |
438 | 456 | } |
439 | 457 | |
440 | 458 | } | ... | ... |
testprograms/sample.cs
... | ... | @@ -37,6 +37,7 @@ class sample { |
37 | 37 | |
38 | 38 | System.Console.WriteLine("Using pw3270 version " + host.Version + " revision " + host.Revision); |
39 | 39 | System.Console.WriteLine("Screen size is " + host.Width + "x" + host.Height + " (" + host.Length + ")"); |
40 | + System.Console.WriteLine("The Charset is " + host.CharSet); | |
40 | 41 | |
41 | 42 | host.Connect("tn3270://zos.efglobe.com:telnet",10); |
42 | 43 | ... | ... |