diff --git a/Makefile.in b/Makefile.in index b2ee58c..ccba747 100644 --- a/Makefile.in +++ b/Makefile.in @@ -26,10 +26,15 @@ # kraucer@bb.com.br (Kraucer Fernandes Mazuco) # +PACKAGE=@PACKAGE_NAME@ + CFLAGS=@CFLAGS@ -DAPPDATA=\"$(datarootdir)/$(PACKAGE_NAME)\" -I../../src/include SSL_CFLAGS=@SSL_CFLAGS@ -LIBS=@LIBS@ @SSL_LIBS@ +DLL_FLAGS=@DLL_FLAGS@ +LDFLAGS=@LDFLAGS@ + +LIBS=@LIBS@ @SSL_LIBS@ @SOCKET_LIBS@ DEBUG_CFLAGS=-DDEBUG=1 -g DEPENDS ?= *.h ../../src/include/*.h @@ -50,6 +55,10 @@ OBJEXT=.o ROOTDIR ?= . OBJDIR ?= $(ROOTDIR)/.obj BINDIR ?= $(ROOTDIR)/.bin +DEPENDS ?= *.h Makefile +BINDBG ?= $(BINDIR)/Debug + +OBJDBG = $(OBJDIR)/Debug #---[ Rules ]------------------------------------------------------------------ @@ -69,6 +78,14 @@ SOURCES = XtGlue.c actions.c ansi.c charset.c ctlr.c \ #---[ Misc targets ]----------------------------------------------------------- +Debug: $(BINDBG)/@DLLPREFIX@3270@DLLEXT@ + + +$(BINDBG)/@DLLPREFIX@3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) + @echo $@ ... + @$(MKDIR) `dirname $@` + @$(LD) $(DLL_FLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + version.c: ./mkversion.sh @echo $@ ... @chmod +x ./mkversion.sh @@ -80,7 +97,7 @@ fallbacks.c: $(BINDIR)/mkfb@EXEEXT@ X3270.xad $(BINDIR)/mkfb@EXEEXT@: mkfb.c Makefile @echo $@ ... - @$(MKDIR) $(BINDIR) + @$(MKDIR) `dirname $@` @$(HOST_CC) -g -o $@ -D_WIN32 mkfb.c clean: diff --git a/XtGlue.c b/XtGlue.c index 6814365..327909b 100644 --- a/XtGlue.c +++ b/XtGlue.c @@ -39,6 +39,7 @@ #include "trace_dsc.h" #include "xioc.h" #endif /*]*/ +#include "utilc.h" #include #include diff --git a/api.h b/api.h index 6ac2da3..8dc0faf 100644 --- a/api.h +++ b/api.h @@ -44,12 +44,10 @@ #if defined(_WIN32) #include - #define LIB3270_EXPORT __declspec (dllexport) - #if defined (HAVE_GNUC_VISIBILITY) - #define LOCAL_EXTERN __attribute__((visibility("hidden"))) extern + #define LOCAL_EXTERN __attribute__((visibility("hidden"))) extern #else - #define LOCAL_EXTERN extern + #define LOCAL_EXTERN extern #endif #else @@ -57,14 +55,11 @@ // http://gcc.gnu.org/wiki/Visibility #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) - #define LOCAL_EXTERN __hidden extern - #define LIB3270_EXPORT + #define LOCAL_EXTERN __hidden extern #elif defined (HAVE_GNUC_VISIBILITY) - #define LOCAL_EXTERN __attribute__((visibility("hidden"))) extern - #define LIB3270_EXPORT __attribute__((visibility("default"))) extern + #define LOCAL_EXTERN __attribute__((visibility("hidden"))) extern #else - #define LOCAL_EXTERN extern - #define LIB3270_EXPORT + #define LOCAL_EXTERN extern #endif @@ -103,9 +98,9 @@ #endif - LIB3270_EXPORT int Set3270Log(const char *filename); - LIB3270_EXPORT int WriteLog(const char *module, const char *fmt, ...); - LIB3270_EXPORT int WriteRCLog(const char *module, int rc, const char *fmt, ...); + LOCAL_EXTERN int Set3270Log(const char *filename); + LOCAL_EXTERN int WriteLog(const char *module, const char *fmt, ...); + LOCAL_EXTERN int WriteRCLog(const char *module, int rc, const char *fmt, ...); #ifdef LIB3270_MODULE_NAME #define Log(fmt, ...) WriteLog(LIB3270_MODULE_NAME,fmt,__VA_ARGS__) @@ -314,12 +309,12 @@ /** * Return a "malloced" copy of the device buffer, set number of elements */ - LIB3270_EXPORT struct ea * copy_device_buffer(int *el); +// LOCAL_EXTERN struct ea * copy_device_buffer(int *el); /** * Set the contents of the device buffer for debugging purposes */ - LIB3270_EXPORT int set_device_buffer(struct ea *src, int el); +// LOCAL_EXTERN int set_device_buffer(struct ea *src, int el); /* File transfer */ #define FT_FLAG_RECEIVE 0x0001 @@ -348,9 +343,9 @@ FT_ABORT_SENT /**< Abort sent; awaiting response */ }; - LIB3270_EXPORT int BeginFileTransfer(unsigned short flags, const char *local, const char *remote, int lrecl, int blksize, int primspace, int secspace, int dft); - LIB3270_EXPORT int CancelFileTransfer(int force); - LIB3270_EXPORT enum ft_state GetFileTransferState(void); + LOCAL_EXTERN int BeginFileTransfer(unsigned short flags, const char *local, const char *remote, int lrecl, int blksize, int primspace, int secspace, int dft); + LOCAL_EXTERN int CancelFileTransfer(int force); + LOCAL_EXTERN enum ft_state GetFileTransferState(void); struct filetransfer_callbacks { @@ -365,7 +360,7 @@ }; - LIB3270_EXPORT int RegisterFTCallbacks(const struct filetransfer_callbacks *cbk); + LOCAL_EXTERN int RegisterFTCallbacks(const struct filetransfer_callbacks *cbk); #define PCONNECTED lib3270_pconnected(NULL) #define HALF_CONNECTED lib3270_half_connected(NULL) @@ -380,7 +375,7 @@ #ifndef LIB3270 - LIB3270_EXPORT enum ft_state QueryFTstate(void); + LOCAL_EXTERN enum ft_state QueryFTstate(void); #endif @@ -411,7 +406,7 @@ COUNTER_ID_USER } COUNTER_ID; - LIB3270_EXPORT int query_counter(COUNTER_ID id); + LOCAL_EXTERN int query_counter(COUNTER_ID id); #define query_screen_change_counter() query_counter(COUNTER_ID_CTLR_DONE) @@ -485,67 +480,67 @@ const char *description; }; - LIB3270_EXPORT int Register3270ScreenCallbacks(const struct lib3270_screen_callbacks *cbk); + LOCAL_EXTERN int Register3270ScreenCallbacks(const struct lib3270_screen_callbacks *cbk); #define new_3270_session(m) lib3270_session_new(m) - LIB3270_EXPORT const struct lib3270_option * get_3270_option_table(int sz); + LOCAL_EXTERN const struct lib3270_option * get_3270_option_table(int sz); /* Popups */ - LIB3270_EXPORT void Error(const char *fmt, ...); - LIB3270_EXPORT void Warning(const char *fmt, ...); - LIB3270_EXPORT void show_3270_popup_dialog(H3270 *session, PW3270_DIALOG type, const char *title, const char *msg, const char *fmt, ...); + LOCAL_EXTERN void Error(const char *fmt, ...); + LOCAL_EXTERN void Warning(const char *fmt, ...); + LOCAL_EXTERN void show_3270_popup_dialog(H3270 *session, PW3270_DIALOG type, const char *title, const char *msg, const char *fmt, ...); /* Set/Get screen contents */ - LIB3270_EXPORT int find_field_attribute(H3270 *session, int baddr); - LIB3270_EXPORT int find_field_length(H3270 *session, int baddr); - LIB3270_EXPORT unsigned char get_field_attribute(H3270 *session, int baddr); - LIB3270_EXPORT int screen_read(char *dest, int baddr, int count); - LIB3270_EXPORT void Input_String(const unsigned char *str); - LIB3270_EXPORT void screen_size(int *rows, int *cols); + LOCAL_EXTERN int find_field_attribute(H3270 *session, int baddr); + LOCAL_EXTERN int find_field_length(H3270 *session, int baddr); + LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr); + LOCAL_EXTERN int screen_read(char *dest, int baddr, int count); + LOCAL_EXTERN void Input_String(const unsigned char *str); + LOCAL_EXTERN void screen_size(int *rows, int *cols); #define query_secure_connection(h) lib3270_get_ssl_state(h) #define lib3270_paste_string(str) lib3270_set_string(NULL,str) #define get_3270_terminal_size(h,r,c) lib3270_get_screen_size(h,r,c) /* Keyboard */ - LIB3270_EXPORT int emulate_input(char *s, int len, int pasting); + LOCAL_EXTERN int emulate_input(char *s, int len, int pasting); /* Network related calls */ - LIB3270_EXPORT int Get3270Socket(void); + LOCAL_EXTERN int Get3270Socket(void); /* Misc calls */ - LIB3270_EXPORT void popup_an_error(const char *fmt, ...); - LIB3270_EXPORT void popup_system_error(const char *title, const char *message, const char *system); - LIB3270_EXPORT void popup_a_sockerr(char *fmt, ...); + LOCAL_EXTERN void popup_an_error(const char *fmt, ...); + LOCAL_EXTERN void popup_system_error(const char *title, const char *message, const char *system); + LOCAL_EXTERN void popup_a_sockerr(char *fmt, ...); #define query_3270_terminal_status(void) lib3270_get_program_message(NULL) #define set_3270_model(h,m) lib3270_set_model(h,m) #define get_3270_model(h) lib3270_get_model(h) - LIB3270_EXPORT int lib3270_set_model(H3270 *session, int model); - LIB3270_EXPORT int lib3270_get_model(H3270 *session); + LOCAL_EXTERN int lib3270_set_model(H3270 *session, int model); + LOCAL_EXTERN int lib3270_get_model(H3270 *session); /* Get connection info */ #define get_connected_lu(h) lib3270_get_luname(h) #define get_current_host(h) lib3270_get_host(h) - LIB3270_EXPORT SCRIPT_STATE status_script(SCRIPT_STATE state); + LOCAL_EXTERN SCRIPT_STATE status_script(SCRIPT_STATE state); #define Toggled(ix) lib3270_get_toggle(NULL,ix) #define CallAndWait(c,h,p) lib3270_call_thread(c,h,p) - LIB3270_EXPORT void RunPendingEvents(int wait); - LIB3270_EXPORT int Wait(int seconds); + LOCAL_EXTERN void RunPendingEvents(int wait); + LOCAL_EXTERN int Wait(int seconds); - LIB3270_EXPORT int ctlr_get_cols(void) __attribute__ ((deprecated)); - LIB3270_EXPORT int ctlr_get_rows(void) __attribute__ ((deprecated)); + LOCAL_EXTERN int ctlr_get_cols(void) __attribute__ ((deprecated)); + LOCAL_EXTERN int ctlr_get_rows(void) __attribute__ ((deprecated)); /* Screen calls */ - LIB3270_EXPORT void screen_resume(H3270 *session); - LIB3270_EXPORT void screen_suspend(H3270 *session); - LIB3270_EXPORT void screen_disp(H3270 *session); + LOCAL_EXTERN void screen_resume(H3270 *session); + LOCAL_EXTERN void screen_suspend(H3270 *session); + LOCAL_EXTERN void screen_disp(H3270 *session); /* Cursor calls */ #define cursor_get_addr(void) lib3270_get_cursor_address(NULL) @@ -560,10 +555,10 @@ #define register_schange(tx,func) lib3270_register_schange(NULL,tx,func,NULL) /* Console/Trace window */ - LIB3270_EXPORT HCONSOLE console_window_new(const char *title, const char *label); - LIB3270_EXPORT void console_window_delete(HCONSOLE hwnd); - LIB3270_EXPORT int console_window_append(HCONSOLE hwnd, const char *fmt, ...); - LIB3270_EXPORT char * console_window_wait_for_user_entry(HCONSOLE hwnd); + LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label); + LOCAL_EXTERN void console_window_delete(HCONSOLE hwnd); + LOCAL_EXTERN int console_window_append(HCONSOLE hwnd, const char *fmt, ...); + LOCAL_EXTERN char * console_window_wait_for_user_entry(HCONSOLE hwnd); #ifdef __cplusplus } diff --git a/charset.c b/charset.c index 386ee5c..8b25cfc 100644 --- a/charset.c +++ b/charset.c @@ -63,10 +63,6 @@ #define EURO_SUFFIX "-euro" #define ES_SIZE (sizeof(EURO_SUFFIX) - 1) -#if defined(_WIN32) || defined(LIB3270) /*[*/ -extern void set_display_charset(char *dcs); -#endif /*]*/ - /* Globals. */ Boolean charset_changed = False; #define DEFAULT_CGEN 0x02b90000 @@ -431,23 +427,27 @@ resource_charset(char *csname, char *cs, char *ftcs) } #endif /*]*/ -#if defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32) && !defined(LIB3270)) /*[*/ + +/* +#if defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32) && !defined(LIB3270)) if (!screen_new_display_charsets( rcs? rcs: default_display_charset, csname)) { return CS_PREREQ; } -#else /*][*/ -#if !defined(_WIN32) /*[*/ +#else +*/ + +#if !defined(_WIN32) utf8_set_display_charsets(rcs? rcs: default_display_charset, csname); -#endif /*]*/ -#if defined(X3270_DBCS) /*[*/ +#endif +#if defined(X3270_DBCS) if (n_rcs > 1) dbcs = True; else dbcs = False; -#endif /*]*/ -#endif /*]*/ +#endif +/* #endif */ /* Set up the cgcsgid. */ set_cgcsgids(get_fresource("%s.%s", ResCodepage, csname)); diff --git a/charsetc.h b/charsetc.h index c88b8bf..002f912 100644 --- a/charsetc.h +++ b/charsetc.h @@ -37,3 +37,5 @@ enum cs_result { CS_OKAY, CS_NOTFOUND, CS_BAD, CS_PREREQ, CS_ILLEGAL }; LIB3270_INTERNAL enum cs_result charset_init(char *csname); LIB3270_INTERNAL char *get_charset_name(void); +LIB3270_INTERNAL void set_display_charset(char *dcs); + diff --git a/ctlr.c b/ctlr.c index 192cf67..5b885bf 100644 --- a/ctlr.c +++ b/ctlr.c @@ -1910,7 +1910,7 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) unsigned char *cp = buf; int s_row; unsigned char c; - int baddr; +// int baddr; /* * The 3174 Functionl Description says that anything but NL, NULL, FM, @@ -1956,8 +1956,8 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) rcba(buffer_addr)); break; case ORDER_SBA: - baddr = DECODE_BADDR(*(cp+1), *(cp+2)); - trace_ds(" SetBufferAddress%s [ignored]\n", rcba(baddr)); +// baddr = DECODE_BADDR(*(cp+1), *(cp+2)); + trace_ds(" SetBufferAddress%s [ignored]\n", rcba(DECODE_BADDR(*(cp+1), *(cp+2)))); cp += 2; i += 2; break; diff --git a/ft.c b/ft.c index 75c79b6..ec02637 100644 --- a/ft.c +++ b/ft.c @@ -102,7 +102,7 @@ static const struct filetransfer_callbacks *callbacks = NULL; // Callbacks to m register_schange(ST_3270_MODE, ft_in3270); } - enum ft_state QueryFTstate(void) + enum ft_state QueryFTstate(void) { return ft_state; } @@ -124,12 +124,12 @@ static const struct filetransfer_callbacks *callbacks = NULL; // Callbacks to m return errcode; } - LIB3270_EXPORT enum ft_state GetFileTransferState(void) + enum ft_state GetFileTransferState(void) { return ft_state; } - LIB3270_EXPORT int CancelFileTransfer(int force) + int CancelFileTransfer(int force) { if (ft_state == FT_RUNNING) { @@ -148,7 +148,7 @@ static const struct filetransfer_callbacks *callbacks = NULL; // Callbacks to m return ECANCELED; } - LIB3270_EXPORT int BeginFileTransfer(unsigned short flags, const char *local, const char *remote, int lrecl, int blksize, int primspace, int secspace, int dft) + int BeginFileTransfer(unsigned short flags, const char *local, const char *remote, int lrecl, int blksize, int primspace, int secspace, int dft) { static const char *rec = "fvu"; static const char *un[] = { "tracks", "cylinders", "avblock" }; diff --git a/glue.c b/glue.c index c3e657e..b170c65 100644 --- a/glue.c +++ b/glue.c @@ -96,7 +96,7 @@ static int init_calls = 0; #endif -// extern void usage(char *); + static void lib3270_session_init(H3270 *hSession, const char *model); #define LAST_ARG "--" @@ -166,7 +166,7 @@ void lib3270_session_free(H3270 *h) } -void lib3270_session_init(H3270 *hSession, const char *model) +static void lib3270_session_init(H3270 *hSession, const char *model) { int ovc, ovr; char junk; diff --git a/lib3270.cbp b/lib3270.cbp index ff70cb2..3d9543f 100644 --- a/lib3270.cbp +++ b/lib3270.cbp @@ -9,8 +9,10 @@ + + @@ -171,6 +184,7 @@ diff --git a/localdefs.h b/localdefs.h index 44288ce..381cec6 100644 --- a/localdefs.h +++ b/localdefs.h @@ -55,10 +55,10 @@ typedef struct _XtActionsRec{ #define NoSymbol 0L /* These are local functions with similar semantics to X functions. */ -LIB3270_INTERNAL void *Malloc(size_t); -LIB3270_INTERNAL void Free(void *); -LIB3270_INTERNAL void *Calloc(size_t, size_t); -LIB3270_INTERNAL void *Realloc(void *, size_t); +void *Malloc(size_t); +void Free(void *); +void *Calloc(size_t, size_t); +void *Realloc(void *, size_t); #define NewString(x) strdup(x) //extern char *NewString(const char *); diff --git a/screen.c b/screen.c index 1368b31..63c689b 100644 --- a/screen.c +++ b/screen.c @@ -61,6 +61,7 @@ #include "statusc.h" #include "togglesc.h" #include "api.h" +#include "charsetc.h" #if defined(_WIN32) #include @@ -79,7 +80,7 @@ extern char *profile_name; #endif static const struct lib3270_screen_callbacks *callbacks = NULL; -static SCRIPT_STATE script_state = SCRIPT_STATE_NONE; +// static SCRIPT_STATE script_state = SCRIPT_STATE_NONE; int lib3270_event_counter[COUNTER_ID_USER] = { 0, 0 }; @@ -699,12 +700,14 @@ static void status_printer(H3270 *session, int on, void *dunno) set_status(session,OIA_FLAG_PRINTER,on); } -LIB3270_EXPORT SCRIPT_STATE status_script(SCRIPT_STATE state) +/* +SCRIPT_STATE status_script(SCRIPT_STATE state) { if(state != script_state && callbacks && callbacks->set_script) callbacks->set_script(state); return script_state = state; } +*/ void status_timing(H3270 *session, struct timeval *t0, struct timeval *t1) { @@ -781,7 +784,7 @@ int Register3270ScreenCallbacks(const struct lib3270_screen_callbacks *cbk) return 0; } -LIB3270_EXPORT void show_3270_popup_dialog(H3270 *session, PW3270_DIALOG type, const char *title, const char *msg, const char *fmt, ...) +void show_3270_popup_dialog(H3270 *session, PW3270_DIALOG type, const char *title, const char *msg, const char *fmt, ...) { if(!fmt) fmt = ""; @@ -887,7 +890,7 @@ extern void popup_an_error(const char *fmt, ...) } -LIB3270_EXPORT void popup_system_error(const char *title, const char *message, const char *system) +void popup_system_error(const char *title, const char *message, const char *system) { if(callbacks && callbacks->SysError) { @@ -898,7 +901,8 @@ LIB3270_EXPORT void popup_system_error(const char *title, const char *message, c popup_an_error("%s\n%s\n%s",title,message,system); } -LIB3270_EXPORT int set_device_buffer(struct ea *src, int el) +/* +int set_device_buffer(struct ea *src, int el) { if(el > (h3270.maxROWS * h3270.maxCOLS)) @@ -910,6 +914,7 @@ LIB3270_EXPORT int set_device_buffer(struct ea *src, int el) return 0; } +*/ LIB3270_ACTION( testpattern ) { @@ -997,6 +1002,7 @@ LIB3270_ACTION( testpattern ) return 0; } +/* LIB3270_EXPORT struct ea * copy_device_buffer(int *el) { int sz = sizeof(struct ea) * (h3270.maxROWS * h3270.maxCOLS); @@ -1006,7 +1012,9 @@ LIB3270_EXPORT struct ea * copy_device_buffer(int *el) *el = (h3270.maxROWS * h3270.maxCOLS); return ret; } +*/ +/* LIB3270_EXPORT HCONSOLE console_window_new(const char *title, const char *label) { if(callbacks && callbacks->console_new ) @@ -1041,5 +1049,5 @@ LIB3270_EXPORT char * console_window_wait_for_user_entry(HCONSOLE hwnd) return callbacks->console_entry(hwnd); return NULL; } - +*/ diff --git a/screenc.h b/screenc.h index c8c5e97..fbc3fa0 100644 --- a/screenc.h +++ b/screenc.h @@ -11,6 +11,9 @@ * FOR A PARTICULAR PURPOSE. See the file LICENSE for more details. */ +#ifndef SCREENC_H_INCLUDED + +#define SCREENC_H_INCLUDED 1 /* c3270 version of screenc.h */ #define blink_start() @@ -65,3 +68,5 @@ LIB3270_INTERNAL int windows_cp; */ LIB3270_INTERNAL void screen_title(char *text); + +#endif // SCREENC_H_INCLUDED diff --git a/telnet.c b/telnet.c index 13fa5a0..fcc4fbc 100644 --- a/telnet.c +++ b/telnet.c @@ -391,7 +391,7 @@ static union { socklen_t ha_len = sizeof(haddr); #if defined(_WIN32) -LIB3270_EXPORT void popup_a_sockerr(char *fmt, ...) +void popup_a_sockerr(char *fmt, ...) { va_list args; char buffer[4096]; @@ -404,7 +404,7 @@ LIB3270_EXPORT void popup_a_sockerr(char *fmt, ...) } #else -LIB3270_EXPORT void popup_a_sockerr(char *fmt, ...) +void popup_a_sockerr(char *fmt, ...) { va_list args; char buffer[4096]; diff --git a/utilc.h b/utilc.h index f3d987f..aba0baa 100644 --- a/utilc.h +++ b/utilc.h @@ -42,7 +42,7 @@ LIB3270_INTERNAL void RemoveInput(unsigned long); LIB3270_INTERNAL unsigned long AddTimeOut(unsigned long msec, H3270 *session, void (*fn)(H3270 *session)); LIB3270_INTERNAL void RemoveTimeOut(unsigned long cookie); -LIB3270_INTERNAL char *KeysymToString(KeySym k); +LIB3270_INTERNAL const char * KeysymToString(KeySym k); LIB3270_INTERNAL KeySym StringToKeysym(char *s); LIB3270_INTERNAL int read_resource_file(const char *filename, Boolean fatal); -- libgit2 0.21.2