Commit 11bc769d3a981ce17a2d4dc29e97f5211d83a771

Authored by Perry Werneck
1 parent 7d8038b3
Exists in master

Debugging on windows.

run.bat 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +@echo off
  2 +del /s /q build
  3 +python setup.py build
  4 +
  5 +set PYTHONPATH=.\build\lib.win-amd64-3.7
  6 +python testprograms\sample.py
... ...
src/module/properties.cc
... ... @@ -28,6 +28,7 @@
28 28 */
29 29  
30 30 #include <py3270.h>
  31 + #include <lib3270/ipc.h>
31 32 #include <lib3270.h>
32 33  
33 34 /*---[ Implement ]----------------------------------------------------------------------------------*/
... ...
src/module/windows/init.cc
... ... @@ -138,13 +138,13 @@
138 138 static string savedpath;
139 139  
140 140 // https://docs.microsoft.com/en-us/cpp/build/reference/structure-and-constant-definitions?view=vs-2019
  141 +
141 142 switch (reason) {
142 143 case dliNoteStartProcessing:
143 144 {
  145 + string installLocation = TN3270::getInstallLocation();
144 146  
145   - string datadir = py3270_get_datadir();
146   -
147   - if(!datadir.empty()) {
  147 + if(!installLocation.empty()) {
148 148  
149 149 char curdir[4096];
150 150 memset(curdir,0,sizeof(curdir));
... ... @@ -155,18 +155,20 @@
155 155 savedpath.clear();
156 156 }
157 157  
158   - SetCurrentDirectory(datadir.c_str());
  158 + SetCurrentDirectory(installLocation.c_str());
159 159  
160 160 }
161   -
162 161 }
163 162 break;
164 163  
165 164 case dliNoteEndProcessing:
  165 +
166 166 if(!savedpath.empty()) {
167 167 SetCurrentDirectory(savedpath.c_str());
168 168 savedpath.clear();
  169 +
169 170 }
  171 +
170 172 break;
171 173  
172 174 case dliNotePreLoadLibrary:
... ...
testprograms/sample.py
... ... @@ -24,39 +24,39 @@ print(&quot;Testing python module&quot;)
24 24 print("Using TN3270 Version " + tn3270.version())
25 25 print(tn3270.revision())
26 26  
27   -#session = tn3270.Session("")
28   -#session.timeout = 10
  27 +session = tn3270.Session("")
  28 +session.timeout = 10
29 29  
30   -#print("Using tn3270 version " + session.version + " revision " + session.revision)
  30 +print("Using tn3270 version " + session.version + " revision " + session.revision)
31 31  
32   -#print(session.cstate)
33   -#print(session.width)
34   -#print(session.connected)
  32 +print(session.cstate)
  33 +print(session.width)
  34 +print(session.connected)
35 35  
36   -#print(session.reconnect)
  36 +print(session.reconnect)
37 37  
38 38 #
39 39 # Can reconnect? If yes do it!
40 40 #
41   -#if session.reconnect.activatable:
42   -# print("Reconnecting...")
43   -# session.reconnect().wait(10)
  41 +if session.reconnect.activatable:
  42 + print("Reconnecting...")
  43 + session.reconnect().wait(10)
44 44  
45   -#print(session.connected)
46   -#print(session.find('sisbb'))
47   -#print(session.count('sisbb'))
  45 +print(session.connected)
  46 +print(session.find('sisbb'))
  47 +print(session.count('sisbb'))
48 48  
49   -#print('----------------------')
50   -#print(dir(session))
51   -#print('----------------------')
  49 +print('----------------------')
  50 +print(dir(session))
  51 +print('----------------------')
52 52  
53   -#print(session.get(14,22,38))
  53 +print(session.get(14,22,38))
54 54  
55 55 #print("-----------------------------------------------------------------------")
56 56 #print(session)
57 57 #print("-----------------------------------------------------------------------")
58 58  
59   -#session.enter().wait(14,2,"Senha")
  59 +session.enter().wait(14,2,"Senha")
60 60  
61 61 #session.set("value")
62 62  
... ...