Commit 3a72fb9226dd99fc9af996154a0210fc018d7ab8
1 parent
8fa946b5
Exists in
master
and in
1 other branch
Building with msvc.
Showing
7 changed files
with
50 additions
and
9 deletions
Show diff stats
src/core/get.cc
@@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
69 | size_t length = strlen(buffer); | 69 | size_t length = strlen(buffer); |
70 | string contents = host.toString( (unsigned int) row, (unsigned int) col, (int) length); | 70 | string contents = host.toString( (unsigned int) row, (unsigned int) col, (int) length); |
71 | 71 | ||
72 | - strncpy((char *) buffer, contents.c_str(), std::min(length,contents.size())); | 72 | + strncpy((char *) buffer, contents.c_str(), min(length,contents.size())); |
73 | 73 | ||
74 | }); | 74 | }); |
75 | 75 | ||
@@ -92,7 +92,7 @@ | @@ -92,7 +92,7 @@ | ||
92 | string contents = host.toString((int) offset, (int) len); | 92 | string contents = host.toString((int) offset, (int) len); |
93 | 93 | ||
94 | memset(buffer,' ',len); | 94 | memset(buffer,' ',len); |
95 | - strncpy((char *) buffer, contents.c_str(), std::min((size_t) len,contents.size())); | 95 | + strncpy((char *) buffer, contents.c_str(), min((size_t) len,contents.size())); |
96 | 96 | ||
97 | }); | 97 | }); |
98 | } | 98 | } |
@@ -113,7 +113,7 @@ | @@ -113,7 +113,7 @@ | ||
113 | 113 | ||
114 | string luname = host.getAssociatedLUName(); | 114 | string luname = host.getAssociatedLUName(); |
115 | memset(buffer,' ',len); | 115 | memset(buffer,' ',len); |
116 | - strncpy((char *) buffer, luname.c_str(), std::min((size_t) len,luname.size())); | 116 | + strncpy((char *) buffer, luname.c_str(), min((size_t) len,luname.size())); |
117 | 117 | ||
118 | }); | 118 | }); |
119 | 119 |
src/core/hllapi.cc
@@ -27,6 +27,11 @@ | @@ -27,6 +27,11 @@ | ||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | +#if defined(_MSC_VER) | ||
31 | + #define strncasecmp _strnicmp | ||
32 | + #define strcasecmp _stricmp | ||
33 | + #endif | ||
34 | + | ||
30 | #include "private.h" | 35 | #include "private.h" |
31 | #include <lib3270/hllapi.h> | 36 | #include <lib3270/hllapi.h> |
32 | 37 | ||
@@ -315,7 +320,7 @@ static int copy_ps(char *buffer, unsigned short *length, unsigned short GNUC_UNU | @@ -315,7 +320,7 @@ static int copy_ps(char *buffer, unsigned short *length, unsigned short GNUC_UNU | ||
315 | 320 | ||
316 | string contents = host.toString(0,-1,'\0'); | 321 | string contents = host.toString(0,-1,'\0'); |
317 | 322 | ||
318 | - size_t szBuffer = std::min(contents.size(), ((size_t) *length)); | 323 | + size_t szBuffer = min(contents.size(), ((size_t) *length)); |
319 | *length = (unsigned short) szBuffer; | 324 | *length = (unsigned short) szBuffer; |
320 | 325 | ||
321 | strncpy(buffer,contents.c_str(),szBuffer); | 326 | strncpy(buffer,contents.c_str(),szBuffer); |
src/core/private.h
@@ -31,7 +31,10 @@ | @@ -31,7 +31,10 @@ | ||
31 | 31 | ||
32 | #define PRIVATE_H_INCLUDED 1 | 32 | #define PRIVATE_H_INCLUDED 1 |
33 | 33 | ||
34 | +#ifndef _MSC_VER | ||
34 | #include <config.h> | 35 | #include <config.h> |
36 | +#endif // !_MSC_VER | ||
37 | + | ||
35 | #include <exception> | 38 | #include <exception> |
36 | #include <stdexcept> | 39 | #include <stdexcept> |
37 | #include <string> | 40 | #include <string> |
src/core/windows/init.cc
@@ -36,7 +36,11 @@ | @@ -36,7 +36,11 @@ | ||
36 | * | 36 | * |
37 | */ | 37 | */ |
38 | 38 | ||
39 | - #include <config.h> | 39 | +#ifndef _MSC_VER |
40 | + #include <config.h> | ||
41 | + #pragma comment(lib,"Advapi32.lib") | ||
42 | +#endif // !_MSC_VER | ||
43 | + | ||
40 | #include <winsock2.h> | 44 | #include <winsock2.h> |
41 | #include <windows.h> | 45 | #include <windows.h> |
42 | #include "../private.h" | 46 | #include "../private.h" |
src/testprogram/testprogram.cc
@@ -28,12 +28,20 @@ | @@ -28,12 +28,20 @@ | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <iostream> | 30 | #include <iostream> |
31 | - #include <getopt.h> | ||
32 | #include <cstring> | 31 | #include <cstring> |
33 | #include <cstdio> | 32 | #include <cstdio> |
33 | + #include <string> | ||
34 | #include <ctime> | 34 | #include <ctime> |
35 | #include <lib3270/hllapi.h> | 35 | #include <lib3270/hllapi.h> |
36 | 36 | ||
37 | + #if defined(_MSC_VER) | ||
38 | + #pragma comment(lib,"hllapi.lib") | ||
39 | + #define strncasecmp _strnicmp | ||
40 | + #define strcasecmp _stricmp | ||
41 | + #else | ||
42 | + #include <getopt.h> | ||
43 | + #endif | ||
44 | + | ||
37 | #define SCREEN_LENGTH 2000 | 45 | #define SCREEN_LENGTH 2000 |
38 | 46 | ||
39 | using namespace std; | 47 | using namespace std; |
@@ -47,6 +55,8 @@ | @@ -47,6 +55,8 @@ | ||
47 | const char *host = ""; | 55 | const char *host = ""; |
48 | const char *session = ":a"; | 56 | const char *session = ":a"; |
49 | 57 | ||
58 | + #if ! defined(_MSC_VER) | ||
59 | + | ||
50 | #pragma GCC diagnostic push | 60 | #pragma GCC diagnostic push |
51 | static struct option options[] = | 61 | static struct option options[] = |
52 | { | 62 | { |
@@ -75,6 +85,8 @@ | @@ -75,6 +85,8 @@ | ||
75 | 85 | ||
76 | } | 86 | } |
77 | 87 | ||
88 | + #endif // ! defined(_MSC_VER) | ||
89 | + | ||
78 | int rc = hllapi_init((char *) session); | 90 | int rc = hllapi_init((char *) session); |
79 | if(rc) { | 91 | if(rc) { |
80 | cout << "hllapi_init returns with rc=" << rc << " (" << hllapi_get_last_error() << ")" << endl; | 92 | cout << "hllapi_init returns with rc=" << rc << " (" << hllapi_get_last_error() << ")" << endl; |
@@ -88,7 +100,7 @@ | @@ -88,7 +100,7 @@ | ||
88 | cout.flush(); | 100 | cout.flush(); |
89 | 101 | ||
90 | string cmdline; | 102 | string cmdline; |
91 | - while(std::getline(std::cin, cmdline)) { | 103 | + while(getline(cin, cmdline)) { |
92 | 104 | ||
93 | if(cmdline.empty()) | 105 | if(cmdline.empty()) |
94 | break; | 106 | break; |
win/Makefile.msc
@@ -60,17 +60,32 @@ testprogram.exe: \ | @@ -60,17 +60,32 @@ testprogram.exe: \ | ||
60 | @link \ | 60 | @link \ |
61 | /nologo \ | 61 | /nologo \ |
62 | /OUT:"$@" \ | 62 | /OUT:"$@" \ |
63 | + /LIBPATH:"$(PW3270_SDK_PATH)\lib" \ | ||
63 | src\testprogram\testprogram.obj | 64 | src\testprogram\testprogram.obj |
64 | 65 | ||
65 | hllapi.dll: \ | 66 | hllapi.dll: \ |
66 | - $(OBJ_FILES) \ | 67 | + $(OBJ_FILES) |
67 | @echo Build dll file.... | 68 | @echo Build dll file.... |
68 | link \ | 69 | link \ |
69 | /NOLOGO \ | 70 | /NOLOGO \ |
70 | /DLL \ | 71 | /DLL \ |
71 | /OUT:"$@" \ | 72 | /OUT:"$@" \ |
73 | + /LIBPATH:"$(PW3270_SDK_PATH)\lib" \ | ||
72 | $(OBJ_FILES) \ | 74 | $(OBJ_FILES) \ |
73 | - $(PW3270_SDK_PATH)\lib\ipc3270.lib | 75 | + "ipc3270.lib \ |
76 | + Advapi32.lib | ||
77 | + | ||
78 | +install: \ | ||
79 | + $(OBJ_FILES) | ||
80 | + @echo Building library... | ||
81 | + @-mkdir "$(PW3270_SDK_PATH)\lib" | ||
82 | + @lib \ | ||
83 | + /NOLOGO \ | ||
84 | + /OUT:"$(PW3270_SDK_PATH)\lib\hllapi.lib" \ | ||
85 | + $(OBJ_FILES) | ||
86 | + | ||
87 | + @-mkdir "$(PW3270_SDK_PATH)\include\lib3270" | ||
88 | + @copy "src\include\lib3270\*.h" "$(PW3270_SDK_PATH)\include\lib3270" | ||
74 | 89 | ||
75 | clean: | 90 | clean: |
76 | del \ | 91 | del \ |