diff --git a/pw3270.cbp b/pw3270.cbp index 6f24dc9..fa6d221 100644 --- a/pw3270.cbp +++ b/pw3270.cbp @@ -70,7 +70,6 @@ - diff --git a/src/include/config.h.in b/src/include/config.h.in index 28e9483..fe5cdab 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -50,7 +50,10 @@ #undef HAVE_ICONV #undef ICONV_CONST - #undef ENABLE_WINDOWS_REGISTRY + #ifdef _WIN32 + #define ENABLE_WINDOWS_REGISTRY 1 + #endif // _WIN32 + #undef HAVE_GNOME #undef HAVE_GTKMAC diff --git a/src/include/pw3270/hllapi.h b/src/include/pw3270/hllapi.h index 27b820e..104f58f 100644 --- a/src/include/pw3270/hllapi.h +++ b/src/include/pw3270/hllapi.h @@ -107,7 +107,7 @@ extern "C" { #define HLLAPI_STATUS_WAITING HLLAPI_STATUS_TIMEOUT - #if defined(WIN32) + #if defined(_WIN32) #include @@ -145,7 +145,7 @@ extern "C" { #define HLLAPI_API_CALL __attribute__((visibility("default"))) extern DWORD - #endif // WIN32 + #endif // _WIN32 HLLAPI_API_CALL hllapi(const LPWORD func, LPSTR str, LPWORD length, LPWORD rc); diff --git a/src/include/pw3270cpp.h b/src/include/pw3270cpp.h index 93b634d..1c1b0f1 100644 --- a/src/include/pw3270cpp.h +++ b/src/include/pw3270cpp.h @@ -31,11 +31,11 @@ #define PW3270_CLASS_H_INCLUDED 1 - #ifdef WIN32 + #ifdef _WIN32 #define SYSTEM_CHARSET "CP1252" #else #define SYSTEM_CHARSET "UTF-8" - #endif // WIN32 + #endif // _WIN32 #include #include @@ -92,11 +92,11 @@ exception(int syserror = errno); exception(const char *fmt, ...); -#ifdef WIN32 +#ifdef _WIN32 exception(DWORD error, const char *fmt, ...); #else exception(int error, const char *fmt, ...); -#endif // WIN32 +#endif // _WIN32 virtual const char * what() const throw(); @@ -108,13 +108,13 @@ class module { private: -#ifdef WIN32 +#ifdef _WIN32 HMODULE hModule; int get_datadir(LPSTR datadir); #else void * hModule; -#endif // WIN32 +#endif // _WIN32 public: module(const char *name, const char *version = NULL) throw (std::exception); @@ -136,9 +136,9 @@ // Factory methods and settings static session * start(const char *name = 0); - static session * create(const char *name = 0) throw (std::exception); - static session * create_local(H3270 *hSession) throw (std::exception); - static session * create_local() throw (std::exception); + static session * create(const char *name = 0); + static session * create_local(H3270 *hSession); + static session * create_local(); static session * get_default(void); static bool has_default(void); @@ -173,12 +173,12 @@ virtual void set_unlock_delay(unsigned short ms) = 0; // charset -#ifdef WIN32 +#ifdef _WIN32 void set_display_charset(const char *remote = 0, const char *local = "CP1252"); static string win32_strerror(int e); #else void set_display_charset(const char *remote = 0, const char *local = "UTF-8"); -#endif // WIN32 +#endif // _WIN32 virtual int set_host_charset(const char *charset) = 0; virtual string get_host_charset(void) = 0; diff --git a/src/libpw3270cpp/exception.cc b/src/libpw3270cpp/exception.cc index 2a7ab5d..ce4417d 100644 --- a/src/libpw3270cpp/exception.cc +++ b/src/libpw3270cpp/exception.cc @@ -51,7 +51,7 @@ va_end(arg_ptr); } -#ifdef WIN32 +#ifdef _WIN32 exception::exception(DWORD error, const char *fmt, ...) { LPVOID lpMsgBuf = 0; @@ -90,7 +90,7 @@ snprintf(this->msg+szPrefix,4095-szPrefix,": %s (rc=%d)",strerror(error),(int) error); } -#endif // WIN32 +#endif // _WIN32 const char * exception::what() const throw() { diff --git a/src/libpw3270cpp/local.cc b/src/libpw3270cpp/local.cc index 8ffd308..538fc1a 100644 --- a/src/libpw3270cpp/local.cc +++ b/src/libpw3270cpp/local.cc @@ -27,7 +27,7 @@ * */ -#if defined WIN32 +#ifdef _WIN32 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS diff --git a/src/libpw3270cpp/module.cc b/src/libpw3270cpp/module.cc index c821bec..71c2b9e 100644 --- a/src/libpw3270cpp/module.cc +++ b/src/libpw3270cpp/module.cc @@ -27,7 +27,7 @@ * */ -#if defined WIN32 +#ifdef _WIN32 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS @@ -54,7 +54,7 @@ namespace PW3270_NAMESPACE { -#ifdef WIN32 +#ifdef _WIN32 int module::get_datadir(LPSTR datadir) { HKEY hKey = 0; @@ -72,13 +72,13 @@ namespace PW3270_NAMESPACE return *datadir; } -#endif // WIN32 +#endif // _WIN32 module::module(const char *name, const char *version) throw (std::exception) { string dllname = name; -#ifdef WIN32 +#ifdef _WIN32 dllname += ".dll"; if(version) @@ -176,18 +176,18 @@ namespace PW3270_NAMESPACE if(!hModule) throw exception("Can't load lib3270: %s",dllname.c_str()); -#endif // WIN32 +#endif // _WIN32 } module::~module() { -#ifdef WIN32 +#ifdef _WIN32 FreeLibrary(hModule); #else dlclose(hModule); -#endif // WIN32 +#endif // _WIN32 } @@ -195,7 +195,7 @@ namespace PW3270_NAMESPACE { void *symbol; -#ifdef WIN32 +#ifdef _WIN32 symbol = (void *) GetProcAddress(hModule,name); @@ -208,7 +208,7 @@ namespace PW3270_NAMESPACE if(!symbol) throw exception("Can't load symbol %s dlerror was \"%s\"",name,dlerror()); -#endif // WIN32 +#endif // _WIN32 return symbol; } diff --git a/src/libpw3270cpp/remote.cc b/src/libpw3270cpp/remote.cc index d62f853..1c17387 100644 --- a/src/libpw3270cpp/remote.cc +++ b/src/libpw3270cpp/remote.cc @@ -45,7 +45,7 @@ #endif // HAVE_DBUS - #if defined(WIN32) + #if defined(_WIN32) #include #include #include @@ -72,7 +72,7 @@ #define HLLAPI_PACKET_ASC2EBC "asc2ebc" #define HLLAPI_PACKET_EBC2ASC "ebc2asc" #define HLLAPI_PACKET_SET_UNLOCK_DELAY "setUnlockDelay" - #endif // WIN32 + #endif // _WIN32 #include #include @@ -93,7 +93,7 @@ { private: -#if defined(WIN32) +#if defined(_WIN32) HANDLE hPipe; @@ -477,7 +477,7 @@ } #endif // HAVE_DBUS -#if defined(WIN32) +#if defined(_WIN32) static string getRegistryKey(const char *name) throw (std::exception) { @@ -509,7 +509,7 @@ remote(const char *session) throw (std::exception) { -#if defined(WIN32) +#if defined(_WIN32) static DWORD dwMode = PIPE_READMODE_MESSAGE; char buffer[4096]; char * str; @@ -756,7 +756,7 @@ virtual ~remote() { -#if defined(WIN32) +#if defined(_WIN32) if(hPipe != INVALID_HANDLE_VALUE) CloseHandle(hPipe); @@ -832,7 +832,7 @@ url = ""; } -#if defined(WIN32) +#if defined(_WIN32) size_t cbSize = sizeof(struct hllapi_packet_query) + strlen(url) + 1; struct hllapi_packet_query * pkt = (struct hllapi_packet_query *) malloc(cbSize); @@ -884,7 +884,7 @@ { int rc; -#if defined(WIN32) +#if defined(_WIN32) size_t cbSize = sizeof(struct hllapi_packet_text)+strlen(uri); struct hllapi_packet_text * pkt = (struct hllapi_packet_text *) malloc(cbSize); @@ -910,7 +910,7 @@ string get_url() { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_query query = { HLLAPI_PACKET_GET_HOST }; return query_string(&query,sizeof(query),1024); @@ -926,7 +926,7 @@ int wait_for_ready(int seconds) { -#if defined(WIN32) +#if defined(_WIN32) time_t end = time(0)+seconds; @@ -982,7 +982,7 @@ int wait(int seconds) { -#if defined(WIN32) +#if defined(_WIN32) time_t end = time(0)+seconds; @@ -1018,7 +1018,7 @@ int iterate(bool wait) { -#if defined(WIN32) +#if defined(_WIN32) if(wait) Sleep(250); return 0; @@ -1033,7 +1033,7 @@ string get_text_at(int row, int col, size_t sz, bool lf) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_query_at query = { HLLAPI_PACKET_GET_TEXT_AT, (unsigned short) row, (unsigned short) col, (unsigned short) sz, lf ? '\n' : 0 }; @@ -1065,7 +1065,7 @@ int set_text_at(int row, int col, const char *str) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_text_at * query; struct hllapi_packet_result response; @@ -1102,7 +1102,7 @@ { debug("%s(%d,%d,\"%s\")",__FUNCTION__,row,col,text); -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_text_at * query; size_t cbSize = sizeof(struct hllapi_packet_text_at)+strlen(text); @@ -1141,7 +1141,7 @@ if(!cmp_text_at(row,col,key,false)) return 0; -#ifdef WIN32 +#ifdef _WIN32 Sleep(500); #else usleep(500); @@ -1153,7 +1153,7 @@ string get_text(int baddr, size_t len, bool lf) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_query_offset query = { HLLAPI_PACKET_GET_TEXT_AT_OFFSET, (unsigned short) baddr, (unsigned short) len, lf ? '\n' : 0 }; return query_string(&query,sizeof(query),len); @@ -1181,7 +1181,7 @@ int set_cursor_position(int row, int col) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_cursor query = { HLLAPI_PACKET_SET_CURSOR_POSITION, (unsigned short) row, (unsigned short) col }; @@ -1201,7 +1201,7 @@ int set_cursor_addr(int addr) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_addr query = { HLLAPI_PACKET_SET_CURSOR, (unsigned short) addr }; @@ -1242,7 +1242,7 @@ int pfkey(int key) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_keycode query = { HLLAPI_PACKET_PFKEY, (unsigned short) key }; @@ -1264,7 +1264,7 @@ int pakey(int key) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_keycode query = { HLLAPI_PACKET_PAKEY, (unsigned short) key }; @@ -1291,7 +1291,7 @@ int set_toggle(LIB3270_TOGGLE ix, bool value) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_set query = { HLLAPI_PACKET_SET_TOGGLE, (unsigned short) ix, (unsigned short) value }; @@ -1313,7 +1313,7 @@ int emulate_input(const char *str) { -#if defined(WIN32) +#if defined(_WIN32) size_t len = strlen(str); struct hllapi_packet_emulate_input * query; @@ -1341,7 +1341,7 @@ int action(const char *str) { -#if defined(WIN32) +#if defined(_WIN32) size_t len = strlen(str); struct hllapi_packet_text * query; @@ -1367,7 +1367,7 @@ int get_field_start(int baddr) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_START, (unsigned short) baddr }; @@ -1389,7 +1389,7 @@ int get_field_len(int baddr) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_LEN, (unsigned short) baddr }; @@ -1410,7 +1410,7 @@ int get_next_unprotected(int baddr) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_addr query = { HLLAPI_PACKET_NEXT_UNPROTECTED, (unsigned short) baddr }; @@ -1439,7 +1439,7 @@ int get_is_protected(int baddr) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_addr query = { HLLAPI_PACKET_IS_PROTECTED, (unsigned short) baddr }; @@ -1468,7 +1468,7 @@ int get_is_protected_at(int row,int col) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_query_at query = { HLLAPI_PACKET_IS_PROTECTED_AT, (unsigned short) row, (unsigned short) col, 0 }; @@ -1499,7 +1499,7 @@ int set_host_charset(const char *charset) { -#if defined(WIN32) +#if defined(_WIN32) size_t len = strlen(charset); struct hllapi_packet_set_text * query; @@ -1523,7 +1523,7 @@ string get_host_charset(void) { -#if defined(WIN32) +#if defined(_WIN32) struct hllapi_packet_query query = { HLLAPI_PACKET_GET_HOST_CHARSET }; return query_string(&query,sizeof(query),100); diff --git a/src/libpw3270cpp/session.cc b/src/libpw3270cpp/session.cc index b3dafc8..9358afd 100644 --- a/src/libpw3270cpp/session.cc +++ b/src/libpw3270cpp/session.cc @@ -344,7 +344,7 @@ string session::get_clipboard(void) { -#if defined(WIN32) +#if defined(_WIN32) if (! OpenClipboard(0)) { @@ -378,12 +378,12 @@ errno = EINVAL; return NULL; -#endif // WIN32 +#endif // _WIN32 } int session::set_clipboard(const char *text) { -#if defined(WIN32) +#if defined(_WIN32) if (! OpenClipboard(0)) { throw exception(GetLastError(),"%s","Can“t open system clipboard"); @@ -412,7 +412,7 @@ return EINVAL; -#endif // WIN32 +#endif // _WIN32 } @@ -649,7 +649,7 @@ return rc; } -#ifdef WIN32 +#ifdef _WIN32 string session::win32_strerror(int e) { static char buffer[4096]; @@ -672,7 +672,7 @@ return string(buffer); } -#endif // WIN32 +#endif // _WIN32 int session::erase(int mode) { diff --git a/src/plugins/dbus3270/iocallback.c b/src/plugins/dbus3270/iocallback.c index 21cfca4..5292f4c 100644 --- a/src/plugins/dbus3270/iocallback.c +++ b/src/plugins/dbus3270/iocallback.c @@ -70,7 +70,7 @@ static gboolean IO_closure(gpointer data); HANDLE source; #else int source; -#endif // WIN32 +#endif // _WIN32 void (*fn)(H3270 *session); H3270 *session; } IO_Source; @@ -94,11 +94,11 @@ static gboolean IO_closure(gpointer data); /*---[ Implement ]-----------------------------------------------------------------------------------------*/ -#ifdef WIN32 +#ifdef _WIN32 static void * AddSource(HANDLE source, H3270 *session, gushort events, void (*fn)(H3270 *session)) #else static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session)) -#endif // WIN32 +#endif // _WIN32 { IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source)); @@ -114,11 +114,11 @@ static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H return src; } -#ifdef WIN32 +#ifdef _WIN32 static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) #else static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) -#endif // WIN32 +#endif // _WIN32 { return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn); } @@ -129,7 +129,7 @@ static void static_RemoveSource(void *id) g_source_destroy((GSource *) id); } -#if defined(WIN32) +#if defined(_WIN32) static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) { return 0; @@ -139,7 +139,7 @@ static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *ses { return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn); } -#endif // WIN32 +#endif // _WIN32 static gboolean do_timer(TIMER *t) { diff --git a/src/plugins/hllapi/remotectl.h b/src/plugins/hllapi/remotectl.h index 5088912..e53ada2 100644 --- a/src/plugins/hllapi/remotectl.h +++ b/src/plugins/hllapi/remotectl.h @@ -44,9 +44,9 @@ typedef struct _remotequery { -#ifdef WIN32 +#ifdef _WIN32 HANDLE hPipe; /**< Pipe handle (for response) */ -#endif // WIN32 +#endif // _WIN32 H3270 * hSession; /**< 3270 Session */ int cmd; /**< Command */ @@ -68,14 +68,14 @@ // int run_hllapi(unsigned long function, char *string, unsigned short length, unsigned short rc); -#ifdef WIN32 +#ifdef _WIN32 #define PIPE_BUFFER_LENGTH 8192 void init_source_pipe(HANDLE hPipe); void popup_lasterror(const gchar *fmt, ...); -#endif // WIN32 +#endif // _WIN32 diff --git a/src/plugins/hllapi/server.h b/src/plugins/hllapi/server.h index 05e31d1..d99bf63 100644 --- a/src/plugins/hllapi/server.h +++ b/src/plugins/hllapi/server.h @@ -48,6 +48,6 @@ G_GNUC_INTERNAL void popup_lasterror(const gchar *fmt, ...); G_GNUC_INTERNAL void set_active(gboolean on); -#endif // WIN32 +#endif // _WIN32 diff --git a/src/pw3270/common/common.h b/src/pw3270/common/common.h index d9245f1..7714aba 100644 --- a/src/pw3270/common/common.h +++ b/src/pw3270/common/common.h @@ -29,72 +29,60 @@ #ifndef COMMON_H_INCLUDED - #define COMMON_H_INCLUDED 1 - - // "PW" Standards - #include - #include - #include - - #ifdef WIN32 + #include +#ifdef _WIN32 #include +#endif // _WIN32 - #ifndef KEY_WOW64_64KEY - #define KEY_WOW64_64KEY 0x0100 - #endif // KEY_WOW64_64KEY - - #ifndef KEY_WOW64_32KEY - #define KEY_WOW64_32KEY 0x0200 - #endif // KEY_WOW64_64KEY - - #endif // WIN32 - #define ENABLE_NLS + #define COMMON_H_INCLUDED 1 - #ifndef GETTEXT_PACKAGE - #define GETTEXT_PACKAGE PACKAGE_NAME - #endif + #include + #include - #include - #include - #include + #ifndef GETTEXT_PACKAGE + #define GETTEXT_PACKAGE PACKAGE_NAME + #endif - #if defined( DEBUG ) - #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr); - #else - #define trace(x, ...) /* */ - #endif + #include + #include + #include - // Configuration - void configuration_init(void); - void configuration_deinit(void); + #if defined( DEBUG ) + #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr); + #else + #define trace(x, ...) /* */ + #endif - gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def); - gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def); - gint get_integer_from_config(const gchar *group, const gchar *key, gint def); + // Configuration + void configuration_init(void); + void configuration_deinit(void); - void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...); - void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val); - void set_integer_to_config(const gchar *group, const gchar *key, gint val); + gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def); + gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def); + gint get_integer_from_config(const gchar *group, const gchar *key, gint def); - gchar * build_data_filename(const gchar *first_element, ...); - gchar * filename_from_va(const gchar *first_element, va_list args); + void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...); + void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val); + void set_integer_to_config(const gchar *group, const gchar *key, gint val); + gchar * build_data_filename(const gchar *first_element, ...); + gchar * filename_from_va(const gchar *first_element, va_list args); - void save_window_state_to_config(const gchar *group, const gchar *key, GdkWindowState CurrentState); - void save_window_size_to_config(const gchar *group, const gchar *key, GtkWidget *hwnd); + void save_window_state_to_config(const gchar *group, const gchar *key, GdkWindowState CurrentState); + void save_window_size_to_config(const gchar *group, const gchar *key, GtkWidget *hwnd); - void restore_window_from_config(const gchar *group, const gchar *key, GtkWidget *hwnd); + void restore_window_from_config(const gchar *group, const gchar *key, GtkWidget *hwnd); -#ifdef ENABLE_WINDOWS_REGISTRY - gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired); - void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data); - void registry_set_double(HKEY hKey, const gchar *key, gdouble value); - gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value); -#else - GKeyFile * get_application_keyfile(void); -#endif // ENABLE_WINDOWS_REGISTRY + #ifdef ENABLE_WINDOWS_REGISTRY + gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired); + void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data); + void registry_set_double(HKEY hKey, const gchar *key, gdouble value); + gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value); + #else + GKeyFile * get_application_keyfile(void); + #endif // ENABLE_WINDOWS_REGISTRY #endif diff --git a/src/pw3270/common/config.c b/src/pw3270/common/config.c index acbd839..3bd5a79 100644 --- a/src/pw3270/common/config.c +++ b/src/pw3270/common/config.c @@ -29,6 +29,12 @@ * */ +#ifdef _WIN32 + #include +#endif // _WIN32 + + #include + #define ENABLE_NLS #define GETTEXT_PACKAGE PACKAGE_NAME @@ -40,7 +46,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include @@ -52,7 +58,7 @@ #define KEY_WOW64_32KEY 0x0200 #endif // KEY_WOW64_64KEY -#endif // WIN32 +#endif // _WIN32 /*--[ Globals ]--------------------------------------------------------------------------------------*/ @@ -189,6 +195,7 @@ #else + static gchar * search_for_ini(void) { static const gchar * (*dir[])(void) = diff --git a/src/pw3270/dialog.c b/src/pw3270/dialog.c index eea7608..614b35d 100644 --- a/src/pw3270/dialog.c +++ b/src/pw3270/dialog.c @@ -33,7 +33,7 @@ #include "globals.h" #include - #if defined WIN32 + #ifdef _WIN32 #include struct file { @@ -45,7 +45,7 @@ }; - #endif // WIN32 + #endif // _WIN32 #if defined(HAVE_LIBSSL) #include @@ -579,7 +579,7 @@ g_free(info); } -#ifdef WIN32 +#ifdef _WIN32 static gpointer select_file(struct file *fl) { @@ -722,7 +722,7 @@ static gpointer select_file(struct file *fl) { } gtk_widget_destroy(dialog); -#endif // WIN32 +#endif // _WIN32 if(filename && *filename) set_string_to_config("files",name,"%s",filename); diff --git a/src/pw3270/main.c b/src/pw3270/main.c index fd2fc63..4a2cf3d 100644 --- a/src/pw3270/main.c +++ b/src/pw3270/main.c @@ -31,7 +31,7 @@ #include -#if defined( _WIN32 ) +#ifdef _WIN32 #include #endif // _WIN32 @@ -237,6 +237,10 @@ int main(int argc, char *argv[]) { const gchar * pluginpath = NULL; +#ifdef _WIN32 + const char * app_name = PACKAGE_NAME; +#endif // _WIN32 + #ifdef DEFAULT_SESSION_NAME const gchar * session_name = G_STRINGIFY(DEFAULT_SESSION_NAME); #else @@ -263,8 +267,6 @@ int main(int argc, char *argv[]) g_autofree gchar * appdir = g_win32_get_package_installation_directory_of_module(NULL); g_autofree gchar * locdir = g_build_filename(appdir,"locale",NULL); - g_set_application_name(PACKAGE_NAME); - trace("appdir=\"%s\"",appdir); trace("locdir=\"%s\"",locdir); @@ -341,6 +343,7 @@ int main(int argc, char *argv[]) } #else { + #error aqui bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); textdomain(PACKAGE_NAME); } @@ -351,27 +354,31 @@ int main(int argc, char *argv[]) const GOptionEntry app_options[] = { #ifdef DEFAULT_SESSION_NAME - { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), G_STRINGIFY(DEFAULT_SESSION_NAME) }, + { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), G_STRINGIFY(DEFAULT_SESSION_NAME) }, #else - { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), PACKAGE_NAME }, + { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), PACKAGE_NAME }, #endif // DEFAULT_SESSION_NAME - { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), host }, - { "colors", 'c', 0, G_OPTION_ARG_CALLBACK, optcolors, N_( "Set reported colors (8/16)" ), "16" }, - { "systype", 't', 0, G_OPTION_ARG_STRING, &systype, N_( "Host system type" ), "S390" }, - { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL }, - { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL }, - { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL }, - { "remap", 'm', 0, G_OPTION_ARG_FILENAME, &remap, N_( "Remap charset from xml file" ), NULL }, - { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, - { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, - { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL }, + { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), host }, + { "colors", 'c', 0, G_OPTION_ARG_CALLBACK, optcolors, N_( "Set reported colors (8/16)" ), "16" }, + { "systype", 't', 0, G_OPTION_ARG_STRING, &systype, N_( "Host system type" ), "S390" }, + { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL }, + { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL }, + { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL }, + { "remap", 'm', 0, G_OPTION_ARG_FILENAME, &remap, N_( "Remap charset from xml file" ), NULL }, + { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, + { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, + { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL }, + +#ifdef _WIN32 + { "application-name", 'A', 0, G_OPTION_ARG_STRING, &app_name, N_( "Application name" ), PACKAGE_NAME }, +#endif // _WIN32 #if defined( HAVE_SYSLOG ) - { "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL }, + { "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL }, #endif - { "tracefile", 'T', 0, G_OPTION_ARG_FILENAME, &tracefile, N_( "Set trace filename" ), NULL }, - { "log", 'L', 0, G_OPTION_ARG_FILENAME, &logfile, N_( "Log to file" ), NULL }, + { "tracefile", 'T', 0, G_OPTION_ARG_FILENAME, &tracefile, N_( "Set trace filename" ), NULL }, + { "log", 'L', 0, G_OPTION_ARG_FILENAME, &logfile, N_( "Log to file" ), NULL }, { NULL } }; @@ -413,6 +420,10 @@ int main(int argc, char *argv[]) } } +#ifdef _WIN32 + g_set_application_name(app_name); +#endif // _WIN32 + // Init GTK gtk_init(&argc, &argv); diff --git a/src/pw3270/plugin.c b/src/pw3270/plugin.c index 5bdf053..c1e397d 100644 --- a/src/pw3270/plugin.c +++ b/src/pw3270/plugin.c @@ -45,9 +45,9 @@ const gchar * name; GError * err = NULL; GList * lst = NULL; -#ifdef WIN32 +#ifdef _WIN32 UINT errorMode; -#endif // WIN32 +#endif // _WIN32 trace("Loading plugins from %s",path); @@ -63,11 +63,11 @@ return; } -#ifdef WIN32 +#ifdef _WIN32 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx errorMode = SetErrorMode(1); SetErrorMode(errorMode); -#endif // WIN32 +#endif // _WIN32 name = g_dir_read_name(dir); while(name) @@ -133,9 +133,9 @@ name = g_dir_read_name(dir); } -#ifdef WIN32 +#ifdef _WIN32 SetErrorMode(errorMode); -#endif // WIN32 +#endif // _WIN32 g_dir_close(dir); diff --git a/src/pw3270/print.c b/src/pw3270/print.c index e7117eb..e49c0bb 100644 --- a/src/pw3270/print.c +++ b/src/pw3270/print.c @@ -199,7 +199,7 @@ } } -#ifdef WIN32 +#ifdef _WIN32 #define save_string(h,k,v) save_settings(k,v,h) #define save_double(h,k,v) registry_set_double(h,k,v) @@ -233,7 +233,7 @@ static gchar * enum_to_string(GType type, guint enum_value) return retval; } -#endif // WIN32 +#endif // _WIN32 static void show_print_error(GtkWidget *widget, GError *err) { @@ -555,7 +555,7 @@ static gchar * enum_to_string(GType type, guint enum_value) } -#ifdef WIN32 +#ifdef _WIN32 void update_settings(const gchar *key, const gchar *val, gpointer *settings) { trace("%s: %s=\"%s\"",__FUNCTION__,key,val); @@ -586,7 +586,7 @@ static gchar * enum_to_string(GType type, guint enum_value) } } -#endif // WIN32 +#endif // _WIN32 static GtkPrintOperation * begin_print_operation(GObject *obj, GtkWidget *widget, PRINT_INFO **info) { @@ -621,7 +621,7 @@ static gchar * enum_to_string(GType type, guint enum_value) g_signal_connect(print,"custom-widget-apply",G_CALLBACK(custom_widget_apply), *info); #else load_settings(*info); -#endif // WIN32 +#endif // _WIN32 // Load page and print settings { diff --git a/src/pw3270/tools.c b/src/pw3270/tools.c index 1c9b9d8..be93246 100644 --- a/src/pw3270/tools.c +++ b/src/pw3270/tools.c @@ -30,7 +30,7 @@ #include "globals.h" #include -#if defined WIN32 +#ifdef _WIN32 BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd); static int libpw3270_loaded(void); @@ -43,7 +43,7 @@ /*--[ Implement ]------------------------------------------------------------------------------------*/ -#if defined WIN32 +#ifdef _WIN32 BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) { @@ -63,7 +63,7 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) return TRUE; } -#endif // WIN32 +#endif // _WIN32 int libpw3270_loaded(void) { diff --git a/src/pw3270/uiparser/parsefile.c b/src/pw3270/uiparser/parsefile.c index 4c78bca..bd35ce9 100644 --- a/src/pw3270/uiparser/parsefile.c +++ b/src/pw3270/uiparser/parsefile.c @@ -173,7 +173,7 @@ name = ui_get_attribute("platform",names,values); if(name) { -#if defined(WIN32) +#if defined(_WIN32) static const gchar *platname = "windows"; #elif defined(linux) static const gchar *platname = "linux"; -- libgit2 0.21.2