diff --git a/actionsc.h b/actionsc.h index 91d8a94..f2f0dcd 100644 --- a/actionsc.h +++ b/actionsc.h @@ -17,27 +17,21 @@ * Global declarations for actions.c. */ +#error Deprecated + // extern enum iaction ia_cause; -extern int actioncount; +// extern int actioncount; // extern XtActionsRec *actions; // extern const char *ia_name[]; -// #if defined(X3270_TRACE) /*[*/ -// extern void action_debug(XtActionProc action, XEvent *event, String *params, Cardinal *num_params); -// #else /*][*/ -// #define action_debug(a, e, p, n) -// #endif /*]*/ - -extern void action_init(void); +// extern void action_init(void); // extern void action_internal(XtActionProc action, enum iaction cause, const char *parm1, const char *parm2); -#define action_name(x) #x -// extern const char *action_name(XtActionProc action); -// extern int check_usage(XtActionProc action, Cardinal nargs, Cardinal nargs_min, Cardinal nargs_max); +// #define action_name(x) #x -extern Boolean event_is_meta(int state); +// extern Boolean event_is_meta(int state); diff --git a/ansi.c b/ansi.c index 12c1297..9774c34 100644 --- a/ansi.c +++ b/ansi.c @@ -52,7 +52,7 @@ #include "ctlrc.h" #include "hostc.h" #include "screenc.h" -#include "scrollc.h" +// #include "scrollc.h" #include "tablesc.h" #include "telnetc.h" #include "trace_dsc.h" diff --git a/api.h b/api.h index 5f22fcd..056dc5e 100644 --- a/api.h +++ b/api.h @@ -153,7 +153,7 @@ // #define OIA_FLAG_SECURE LIB3270_FLAG_SECURE #define OIA_FLAG_TYPEAHEAD LIB3270_FLAG_TYPEAHEAD // #define OIA_FLAG_PRINTER LIB3270_FLAG_PRINTER - #define OIA_FLAG_REVERSE LIB3270_FLAG_REVERSE +// #define OIA_FLAG_REVERSE LIB3270_FLAG_REVERSE #define OIA_FLAG_USER LIB3270_FLAG_COUNT #define OIA_FLAG LIB3270_FLAG diff --git a/charsetc.h b/charsetc.h index ab2e612..ff5ce31 100644 --- a/charsetc.h +++ b/charsetc.h @@ -25,7 +25,7 @@ */ // LIB3270_INTERNAL Boolean charset_changed; -LIB3270_INTERNAL unsigned long cgcsgid; +// LIB3270_INTERNAL unsigned long cgcsgid; /* #if defined(X3270_DBCS) diff --git a/childc.h b/childc.h index b3dd5ab..4fbef59 100644 --- a/childc.h +++ b/childc.h @@ -26,3 +26,5 @@ LIB3270_INTERNAL void child_ignore_output(void); #define child_ignore_output() #endif */ + +#error Deprecated diff --git a/ctlr.c b/ctlr.c index eb774dc..d97ca9a 100644 --- a/ctlr.c +++ b/ctlr.c @@ -53,7 +53,7 @@ #include "kybdc.h" #include "popupsc.h" #include "screenc.h" -#include "scrollc.h" +// #include "scrollc.h" #include "seec.h" #include "sf.h" #include "statusc.h" diff --git a/ctlrc.h b/ctlrc.h index ca2cd44..6f8fac1 100644 --- a/ctlrc.h +++ b/ctlrc.h @@ -72,14 +72,14 @@ LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); enum dbcs_state { - DBCS_NONE = 0, /* position is not DBCS */ - DBCS_LEFT, /* position is left half of DBCS character */ - DBCS_RIGHT, /* position is right half of DBCS character */ - DBCS_SI, /* position is SI terminating DBCS subfield */ - DBCS_SB, /* position is SBCS character after the SI */ - DBCS_LEFT_WRAP, /* position is left half of split DBCS */ - DBCS_RIGHT_WRAP, /* position is right half of split DBCS */ - DBCS_DEAD /* position is dead left-half DBCS */ + DBCS_NONE = 0, /**< position is not DBCS */ + DBCS_LEFT, /**< position is left half of DBCS character */ + DBCS_RIGHT, /**< position is right half of DBCS character */ + DBCS_SI, /**< position is SI terminating DBCS subfield */ + DBCS_SB, /**< position is SBCS character after the SI */ + DBCS_LEFT_WRAP, /**< position is left half of split DBCS */ + DBCS_RIGHT_WRAP, /**< position is right half of split DBCS */ + DBCS_DEAD /**< position is dead left-half DBCS */ }; #define IS_LEFT(d) ((d) == DBCS_LEFT || (d) == DBCS_LEFT_WRAP) #define IS_RIGHT(d) ((d) == DBCS_RIGHT || (d) == DBCS_RIGHT_WRAP) diff --git a/ft.c b/ft.c index e8ac46d..2c505f5 100644 --- a/ft.c +++ b/ft.c @@ -41,7 +41,7 @@ #endif // HAVE_MALLOC_H //#include "appres.h" -#include "actionsc.h" +//#include "actionsc.h" #include "ft_cutc.h" #include "ft_dftc.h" #include "ftc.h" @@ -52,7 +52,7 @@ #endif */ #include "kybdc.h" -#include "objects.h" +// #include "objects.h" #include "popupsc.h" #include "screenc.h" #include "tablesc.h" diff --git a/ft_cut.c b/ft_cut.c index a8ac0b6..5809aca 100644 --- a/ft_cut.c +++ b/ft_cut.c @@ -42,7 +42,7 @@ #if defined(X3270_FT) /*[*/ #include "3270ds.h" -#include "actionsc.h" +//#include "actionsc.h" #include "ctlrc.h" #include "ft_cutc.h" #include "ft_cut_ds.h" diff --git a/ft_dft.c b/ft_dft.c index 53a20a2..95f34e7 100644 --- a/ft_dft.c +++ b/ft_dft.c @@ -45,7 +45,7 @@ #include "3270ds.h" #include "ft_dft_ds.h" -#include "actionsc.h" +//#include "actionsc.h" #include "kybdc.h" #include "ft_dftc.h" #include "ftc.h" diff --git a/globals.h b/globals.h index 5abd741..0b6a30b 100644 --- a/globals.h +++ b/globals.h @@ -69,6 +69,7 @@ #define N_( x ) x #endif // HAVE_LIBINTL +#define action_name(x) #x /* * OS-specific #defines. Except for the blocking-connect workarounds, these diff --git a/glue.c b/glue.c index 7c8210d..8c457ec 100644 --- a/glue.c +++ b/glue.c @@ -53,11 +53,11 @@ #include "3270ds.h" #include "resources.h" -#include "actionsc.h" +//#include "actionsc.h" #include "ansic.h" #include "charsetc.h" #include "ctlrc.h" -#include "gluec.h" +// #include "gluec.h" #include "hostc.h" // #include "keymapc.h" #include "kybdc.h" @@ -71,7 +71,7 @@ #include "trace_dsc.h" #include "utilc.h" // #include "idlec.h" -#include "printerc.h" +// #include "printerc.h" #if defined(X3270_FT) #include "ftc.h" diff --git a/gluec.h b/gluec.h index e1c5956..f359f30 100644 --- a/gluec.h +++ b/gluec.h @@ -21,11 +21,13 @@ // extern int parse_command_line(int argc, const char **argv, const char **cl_hostname); // extern int parse_program_parameters(int argc, const char **argv); // LIB3270_INTERNAL void parse_xrm(const char *arg, const char *where); -LIB3270_INTERNAL void notify_ssl_error(H3270 *session, const char *title, const char *msg, const char *state, const char *alert); +// LIB3270_INTERNAL void notify_ssl_error(H3270 *session, const char *title, const char *msg, const char *state, const char *alert); /* XtGlue.c */ -LIB3270_INTERNAL void (*Warning_redirect)(const char *); +// LIB3270_INTERNAL void (*Warning_redirect)(const char *); -#if !defined(_WIN32) /*[*/ -LIB3270_INTERNAL int select_setup(int *nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval **timeout, struct timeval *timebuf); -#endif /*]*/ +// #if !defined(_WIN32) +// LIB3270_INTERNAL int select_setup(int *nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval **timeout, struct timeval *timebuf); +// #endif + +#error Deprecated diff --git a/host.c b/host.c index dd22be3..0b495ed 100644 --- a/host.c +++ b/host.c @@ -42,7 +42,7 @@ // #include "appres.h" #include "resources.h" -#include "actionsc.h" +//#include "actionsc.h" #include "hostc.h" #include "statusc.h" #include "popupsc.h" diff --git a/icmdc.h b/icmdc.h index 0171ebd..690c545 100644 --- a/icmdc.h +++ b/icmdc.h @@ -17,4 +17,6 @@ * Declarations for icmd.c. */ -LIB3270_INTERNAL int interactive_transfer(String **params, Cardinal *num_params); +// LIB3270_INTERNAL int interactive_transfer(String **params, Cardinal *num_params); + +#error Deprecated diff --git a/keypadc.h b/keypadc.h index 14d1ea3..0ff2bc1 100644 --- a/keypadc.h +++ b/keypadc.h @@ -49,3 +49,5 @@ LIB3270_INTERNAL Dimension min_keypad_width(void); #endif */ + +#error Deprecated diff --git a/kybd.c b/kybd.c index d389415..7a3ae40 100644 --- a/kybd.c +++ b/kybd.c @@ -59,7 +59,7 @@ struct ta; // #include "ctlr.h" #include "resources.h" -#include "actionsc.h" +//#include "actionsc.h" #include "ansic.h" //#include "aplc.h" #include "ctlrc.h" @@ -68,7 +68,7 @@ struct ta; // #include "keypadc.h" #include "kybdc.h" #include "popupsc.h" -#include "printc.h" +// #include "printc.h" #include "screenc.h" // #if defined(X3270_DISPLAY) /*[*/ // #include "selectc.h" diff --git a/localdefs.h b/localdefs.h index 0883085..b1226b4 100644 --- a/localdefs.h +++ b/localdefs.h @@ -33,12 +33,12 @@ /* These first definitions were cribbed from X11 -- but no X code is used. */ #define False 0 #define True 1 -typedef void *XtPointer; -typedef void *Widget; -typedef void *XEvent; +//typedef void *XtPointer; +// typedef void *Widget; +// typedef void *XEvent; typedef char Boolean; typedef char *String; -typedef unsigned int Cardinal; +// typedef unsigned int Cardinal; typedef unsigned long KeySym; #define Bool int diff --git a/objects.h b/objects.h index c0ce6bd..7e42ab4 100644 --- a/objects.h +++ b/objects.h @@ -20,7 +20,9 @@ // #define ObjConfirmButton "confirmButton" // #define ObjConfirm2Button "confirm2Button" // #define ObjCancelButton "cancelButton" -#define ObjDialog "dialog" +// #define ObjDialog "dialog" // #define ObjSmallLabel "smallLabel" -#define ObjNameLabel "nameLabel" -#define ObjDataLabel "dataLabel" +// #define ObjNameLabel "nameLabel" +// #define ObjDataLabel "dataLabel" + +#error Deprecated diff --git a/paste.c b/paste.c index 5b5bf28..8cf93e5 100644 --- a/paste.c +++ b/paste.c @@ -49,7 +49,7 @@ #include "3270ds.h" #include "resources.h" -#include "actionsc.h" +//#include "actionsc.h" #include "ansic.h" //#include "aplc.h" #include "ctlrc.h" @@ -58,7 +58,7 @@ // #include "keypadc.h" #include "kybdc.h" #include "popupsc.h" -#include "printc.h" +// #include "printc.h" #include "screenc.h" /* diff --git a/printc.h b/printc.h index 4b4a64f..f49332c 100644 --- a/printc.h +++ b/printc.h @@ -18,13 +18,10 @@ */ // LIB3270_INTERNAL Boolean fprint_screen(FILE *f, Boolean even_if_empty, Boolean use_html); -LIB3270_INTERNAL void PrintText_action(Widget w, XEvent *event, String *params, - Cardinal *num_params); -LIB3270_INTERNAL void PrintWindow_action(Widget w, XEvent *event, String *params, - Cardinal *num_params); -LIB3270_INTERNAL void print_text_option(Widget w, XtPointer client_data, - XtPointer call_data); -LIB3270_INTERNAL void print_window_option(Widget w, XtPointer client_data, - XtPointer call_data); -LIB3270_INTERNAL void save_text_option(Widget w, XtPointer client_data, - XtPointer call_data); +// LIB3270_INTERNAL void PrintText_action(Widget w, XEvent *event, String *params,Cardinal *num_params); +// LIB3270_INTERNAL void PrintWindow_action(Widget w, XEvent *event, String *params,Cardinal *num_params); +// LIB3270_INTERNAL void print_text_option(Widget w, XtPointer client_data,XtPointer call_data); +// LIB3270_INTERNAL void print_window_option(Widget w, XtPointer client_data,XtPointer call_data); +// LIB3270_INTERNAL void save_text_option(Widget w, XtPointer client_data,XtPointer call_data); + +#error Deprecated diff --git a/printerc.h b/printerc.h index 00d6dd3..bf4eff2 100644 --- a/printerc.h +++ b/printerc.h @@ -25,3 +25,5 @@ #if defined(_WIN32) /*[*/ // LIB3270_INTERNAL void printer_check(void); #endif /*]*/ + +#error Deprecated diff --git a/savec.h b/savec.h index 5aa4bf6..27646a4 100644 --- a/savec.h +++ b/savec.h @@ -20,3 +20,6 @@ LIB3270_INTERNAL char *command_string; */ + + +#error Deprecated diff --git a/screen.c b/screen.c index 8608848..4842f40 100644 --- a/screen.c +++ b/screen.c @@ -42,7 +42,7 @@ #include "resources.h" // #include "ctlr.h" -#include "actionsc.h" +//#include "actionsc.h" #include "ctlrc.h" #include "hostc.h" #include "kybdc.h" diff --git a/scrollc.h b/scrollc.h index 4cfb82e..93a98b1 100644 --- a/scrollc.h +++ b/scrollc.h @@ -16,3 +16,5 @@ // #define scroll_save(n, trim_blanks) // #define scroll_to_bottom() + +#error Deprecated diff --git a/session.c b/session.c index 3993b41..3b16911 100644 --- a/session.c +++ b/session.c @@ -48,7 +48,7 @@ /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ - static H3270 h3270; + static H3270 *default_session = NULL; /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ @@ -60,6 +60,9 @@ void lib3270_session_free(H3270 *h) { int f; + if(!h) + return; + // Terminate session if(lib3270_connected(h)) lib3270_disconnect(h); @@ -91,6 +94,11 @@ void lib3270_session_free(H3270 *h) release_pointer(h->buffer[f]); } + if(h == default_session) + default_session = NULL; + + lib3270_free(h); + } static void update_char(H3270 *session, int addr, unsigned char chr, unsigned short attr, unsigned char cursor) @@ -169,45 +177,45 @@ static void lib3270_session_init(H3270 *hSession, const char *model) initialize_tables(hSession); // Default calls - hSession->write = lib3270_sock_send; - hSession->disconnect = lib3270_sock_disconnect; - hSession->update = update_char; - hSession->update_model = update_model; - hSession->update_cursor = update_cursor; - hSession->set_selection = nop_char; - hSession->ctlr_done = nop; - hSession->changed = changed; - hSession->erase = screen_disp; - hSession->suspend = nop; - hSession->resume = screen_disp; - hSession->update_oia = update_oia; - hSession->update_selection = update_selection; - hSession->cursor = set_cursor; - hSession->message = message; - hSession->update_ssl = update_ssl; - hSession->display = screen_disp; - hSession->set_width = set_width; + hSession->write = lib3270_sock_send; + hSession->disconnect = lib3270_sock_disconnect; + hSession->update = update_char; + hSession->update_model = update_model; + hSession->update_cursor = update_cursor; + hSession->set_selection = nop_char; + hSession->ctlr_done = nop; + hSession->changed = changed; + hSession->erase = screen_disp; + hSession->suspend = nop; + hSession->resume = screen_disp; + hSession->update_oia = update_oia; + hSession->update_selection = update_selection; + hSession->cursor = set_cursor; + hSession->message = message; + hSession->update_ssl = update_ssl; + hSession->display = screen_disp; + hSession->set_width = set_width; // Set the defaults. - hSession->extended = 1; - hSession->typeahead = 1; - hSession->oerr_lock = 1; - hSession->unlock_delay = 1; - hSession->icrnl = 1; - hSession->onlcr = 1; - hSession->host_charset = "bracket"; - hSession->sock = -1; - hSession->model_num = -1; - hSession->cstate = LIB3270_NOT_CONNECTED; - hSession->oia_status = -1; - hSession->kybdlock = KL_NOT_CONNECTED; - hSession->aid = AID_NO; - hSession->reply_mode = SF_SRM_FIELD; - hSession->linemode = 1; - hSession->tn3270e_submode = E_NONE; - hSession->scroll_top = -1; - hSession->scroll_bottom = -1; - hSession->wraparound_mode = 1; + hSession->extended = 1; + hSession->typeahead = 1; + hSession->oerr_lock = 1; + hSession->unlock_delay = 1; + hSession->icrnl = 1; + hSession->onlcr = 1; + hSession->host_charset = "bracket"; + hSession->sock = -1; + hSession->model_num = -1; + hSession->cstate = LIB3270_NOT_CONNECTED; + hSession->oia_status = -1; + hSession->kybdlock = KL_NOT_CONNECTED; + hSession->aid = AID_NO; + hSession->reply_mode = SF_SRM_FIELD; + hSession->linemode = 1; + hSession->tn3270e_submode = E_NONE; + hSession->scroll_top = -1; + hSession->scroll_bottom = -1; + hSession->wraparound_mode = 1; hSession->saved_wraparound_mode = 1; hSession->once_cset = -1; hSession->state = LIB3270_ANSI_STATE_DATA; @@ -222,19 +230,6 @@ static void lib3270_session_init(H3270 *hSession, const char *model) #endif // _WIN32 -/* -#if !defined(_WIN32) - hSession->host_charset = "bracket"; -#else - - if (is_nt) - hSession->host_charset = "bracket"; - else - hSession->host_charset = "bracket437"; -#endif -*/ - - // Initialize toggles initialize_toggles(hSession); @@ -296,20 +291,18 @@ static void lib3270_session_init(H3270 *hSession, const char *model) H3270 * lib3270_session_new(const char *model) { - static int configured = 0; - - H3270 *hSession = &h3270; + H3270 * hSession; - trace("%s - configured=%d",__FUNCTION__,configured); + trace("%s - configured=%s",__FUNCTION__,default_session ? "Yes" : "No"); - if(configured) + if(default_session) { // TODO (perry#5#): Allocate a new structure. errno = EBUSY; - return hSession; + return lib3270_get_default_session_handle(); } - configured = 1; + hSession = default_session = lib3270_malloc(sizeof(H3270)); lib3270_session_init(hSession, model); @@ -343,10 +336,14 @@ H3270 * lib3270_session_new(const char *model) return hSession; } - /* -- * Parse the model number. -- * Returns -1 (error), 0 (default), or the specified number. -- */ + /** + * Parse the model number. + * + * @param session Session Handle. + * @param m Model number. + * + * @return -1 (error), 0 (default), or the specified number. + */ static int parse_model_number(H3270 *session, const char *m) { int sl; @@ -426,17 +423,17 @@ void check_session_handle(H3270 **hSession) if(*hSession) return; -#ifdef DEBUG - trace("** %s called with hSession == NULL",fname); -#endif + *hSession = lib3270_get_default_session_handle(); - *hSession = &h3270; + lib3270_write_log(*hSession,"%s called with empty session",__FUNCTION__); } - LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) { - return &h3270; + if(default_session) + return default_session; + + return lib3270_session_new(""); } LIB3270_EXPORT void * lib3270_get_widget(H3270 *h) diff --git a/toggles.c b/toggles.c index 5b3a8f9..291c2aa 100644 --- a/toggles.c +++ b/toggles.c @@ -43,7 +43,7 @@ //#include "appres.h" #include "ansic.h" -#include "actionsc.h" +//#include "actionsc.h" #include "ctlrc.h" #include "popupsc.h" #include "screenc.h" diff --git a/trace_ds.c b/trace_ds.c index 8b40239..cc283d9 100644 --- a/trace_ds.c +++ b/trace_ds.c @@ -54,16 +54,16 @@ #include #include "3270ds.h" //#include "appres.h" -#include "objects.h" +// #include "objects.h" #include "resources.h" // #include "ctlr.h" #include "charsetc.h" -#include "childc.h" +// #include "childc.h" #include "ctlrc.h" #include "popupsc.h" -#include "printc.h" -#include "savec.h" +// #include "printc.h" +// #include "savec.h" #include "tablesc.h" #include "telnetc.h" #include "trace_dsc.h" -- libgit2 0.21.2