Commit 3856aadb5ee58d3cd1ec2078f40d2f1bd595999f
1 parent
9ef16f95
Exists in
master
and in
5 other branches
Removendo includes obsoletas, sessão passa a ser criada automaticamente caso alg…
…uma função da lib seja chamada com NULL no handle
Showing
33 changed files
with
159 additions
and
147 deletions
Show diff stats
pw3270.cbp
| ... | ... | @@ -73,7 +73,6 @@ |
| 73 | 73 | <Unit filename="src/lib3270/3270ds.h" /> |
| 74 | 74 | <Unit filename="src/lib3270/Makefile.in" /> |
| 75 | 75 | <Unit filename="src/lib3270/X11keysym.h" /> |
| 76 | - <Unit filename="src/lib3270/actionsc.h" /> | |
| 77 | 76 | <Unit filename="src/lib3270/ansi.c"> |
| 78 | 77 | <Option compilerVar="CC" /> |
| 79 | 78 | </Unit> |
| ... | ... | @@ -88,7 +87,6 @@ |
| 88 | 87 | <Option compilerVar="CC" /> |
| 89 | 88 | </Unit> |
| 90 | 89 | <Unit filename="src/lib3270/charsetc.h" /> |
| 91 | - <Unit filename="src/lib3270/childc.h" /> | |
| 92 | 90 | <Unit filename="src/lib3270/ctlr.c"> |
| 93 | 91 | <Option compilerVar="CC" /> |
| 94 | 92 | </Unit> |
| ... | ... | @@ -119,11 +117,9 @@ |
| 119 | 117 | <Unit filename="src/lib3270/html.c"> |
| 120 | 118 | <Option compilerVar="CC" /> |
| 121 | 119 | </Unit> |
| 122 | - <Unit filename="src/lib3270/icmdc.h" /> | |
| 123 | 120 | <Unit filename="src/lib3270/iocalls.c"> |
| 124 | 121 | <Option compilerVar="CC" /> |
| 125 | 122 | </Unit> |
| 126 | - <Unit filename="src/lib3270/keypadc.h" /> | |
| 127 | 123 | <Unit filename="src/lib3270/kybd.c"> |
| 128 | 124 | <Option compilerVar="CC" /> |
| 129 | 125 | </Unit> |
| ... | ... | @@ -138,13 +134,10 @@ |
| 138 | 134 | <Unit filename="src/lib3270/mkfb.c"> |
| 139 | 135 | <Option compilerVar="CC" /> |
| 140 | 136 | </Unit> |
| 141 | - <Unit filename="src/lib3270/objects.h" /> | |
| 142 | 137 | <Unit filename="src/lib3270/paste.c"> |
| 143 | 138 | <Option compilerVar="CC" /> |
| 144 | 139 | </Unit> |
| 145 | 140 | <Unit filename="src/lib3270/popupsc.h" /> |
| 146 | - <Unit filename="src/lib3270/printc.h" /> | |
| 147 | - <Unit filename="src/lib3270/printerc.h" /> | |
| 148 | 141 | <Unit filename="src/lib3270/proxy.c"> |
| 149 | 142 | <Option compilerVar="CC" /> |
| 150 | 143 | </Unit> |
| ... | ... | @@ -160,13 +153,11 @@ |
| 160 | 153 | <Unit filename="src/lib3270/rpq.c"> |
| 161 | 154 | <Option compilerVar="CC" /> |
| 162 | 155 | </Unit> |
| 163 | - <Unit filename="src/lib3270/savec.h" /> | |
| 164 | 156 | <Unit filename="src/lib3270/screen.c"> |
| 165 | 157 | <Option compilerVar="CC" /> |
| 166 | 158 | </Unit> |
| 167 | 159 | <Unit filename="src/lib3270/screen.h" /> |
| 168 | 160 | <Unit filename="src/lib3270/screenc.h" /> |
| 169 | - <Unit filename="src/lib3270/scrollc.h" /> | |
| 170 | 161 | <Unit filename="src/lib3270/see.c"> |
| 171 | 162 | <Option compilerVar="CC" /> |
| 172 | 163 | </Unit> | ... | ... |
src/include/lib3270.h
| ... | ... | @@ -153,11 +153,10 @@ |
| 153 | 153 | { |
| 154 | 154 | LIB3270_FLAG_BOXSOLID, /**< System available */ |
| 155 | 155 | LIB3270_FLAG_UNDERA, /**< Control Unit STATUS */ |
| 156 | -// LIB3270_FLAG_SECURE, /**< Security status */ | |
| 157 | 156 | LIB3270_FLAG_TYPEAHEAD, |
| 158 | -// LIB3270_FLAG_PRINTER, | |
| 157 | + LIB3270_FLAG_PRINTER, /**< Printer session status */ | |
| 159 | 158 | LIB3270_FLAG_REVERSE, |
| 160 | - LIB3270_FLAG_SCRIPT, | |
| 159 | + LIB3270_FLAG_SCRIPT, /**< Script status */ | |
| 161 | 160 | |
| 162 | 161 | LIB3270_FLAG_COUNT |
| 163 | 162 | ... | ... |
src/include/lib3270/config.h.in
src/include/v3270.h
| ... | ... | @@ -104,7 +104,9 @@ |
| 104 | 104 | V3270_OIA_SHIFT, /**< Shift Status */ |
| 105 | 105 | V3270_OIA_TYPEAHEAD, /**< Typeahead indication ("T" or blank) */ |
| 106 | 106 | V3270_OIA_INSERT, /**< Insert mode indication (Special symbol/"I" or blank) */ |
| 107 | +#ifdef HAVE_SCRIPT | |
| 107 | 108 | V3270_OIA_SCRIPT, /**< Script indication ("S" or blank) */ |
| 109 | +#endif // HAVE_SCRIPT | |
| 108 | 110 | V3270_OIA_LUNAME, /**< LU Name */ |
| 109 | 111 | V3270_OIA_SPINNER, /**< command timing spinner */ |
| 110 | 112 | V3270_OIA_TIMER, /**< command timing (mmm:ss, or blank) */ | ... | ... |
src/lib3270/actionsc.h
| ... | ... | @@ -17,27 +17,21 @@ |
| 17 | 17 | * Global declarations for actions.c. |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | +#error Deprecated | |
| 21 | + | |
| 20 | 22 | // extern enum iaction ia_cause; |
| 21 | 23 | |
| 22 | -extern int actioncount; | |
| 24 | +// extern int actioncount; | |
| 23 | 25 | // extern XtActionsRec *actions; |
| 24 | 26 | |
| 25 | 27 | // extern const char *ia_name[]; |
| 26 | 28 | |
| 27 | -// #if defined(X3270_TRACE) /*[*/ | |
| 28 | -// extern void action_debug(XtActionProc action, XEvent *event, String *params, Cardinal *num_params); | |
| 29 | -// #else /*][*/ | |
| 30 | -// #define action_debug(a, e, p, n) | |
| 31 | -// #endif /*]*/ | |
| 32 | - | |
| 33 | -extern void action_init(void); | |
| 29 | +// extern void action_init(void); | |
| 34 | 30 | |
| 35 | 31 | // extern void action_internal(XtActionProc action, enum iaction cause, const char *parm1, const char *parm2); |
| 36 | 32 | |
| 37 | -#define action_name(x) #x | |
| 38 | -// extern const char *action_name(XtActionProc action); | |
| 39 | -// extern int check_usage(XtActionProc action, Cardinal nargs, Cardinal nargs_min, Cardinal nargs_max); | |
| 33 | +// #define action_name(x) #x | |
| 40 | 34 | |
| 41 | -extern Boolean event_is_meta(int state); | |
| 35 | +// extern Boolean event_is_meta(int state); | |
| 42 | 36 | |
| 43 | 37 | ... | ... |
src/lib3270/ansi.c
src/lib3270/api.h
| ... | ... | @@ -153,7 +153,7 @@ |
| 153 | 153 | // #define OIA_FLAG_SECURE LIB3270_FLAG_SECURE |
| 154 | 154 | #define OIA_FLAG_TYPEAHEAD LIB3270_FLAG_TYPEAHEAD |
| 155 | 155 | // #define OIA_FLAG_PRINTER LIB3270_FLAG_PRINTER |
| 156 | - #define OIA_FLAG_REVERSE LIB3270_FLAG_REVERSE | |
| 156 | +// #define OIA_FLAG_REVERSE LIB3270_FLAG_REVERSE | |
| 157 | 157 | #define OIA_FLAG_USER LIB3270_FLAG_COUNT |
| 158 | 158 | #define OIA_FLAG LIB3270_FLAG |
| 159 | 159 | ... | ... |
src/lib3270/charsetc.h
src/lib3270/childc.h
src/lib3270/ctlr.c
src/lib3270/ctlrc.h
| ... | ... | @@ -72,14 +72,14 @@ LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); |
| 72 | 72 | LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); |
| 73 | 73 | |
| 74 | 74 | enum dbcs_state { |
| 75 | - DBCS_NONE = 0, /* position is not DBCS */ | |
| 76 | - DBCS_LEFT, /* position is left half of DBCS character */ | |
| 77 | - DBCS_RIGHT, /* position is right half of DBCS character */ | |
| 78 | - DBCS_SI, /* position is SI terminating DBCS subfield */ | |
| 79 | - DBCS_SB, /* position is SBCS character after the SI */ | |
| 80 | - DBCS_LEFT_WRAP, /* position is left half of split DBCS */ | |
| 81 | - DBCS_RIGHT_WRAP, /* position is right half of split DBCS */ | |
| 82 | - DBCS_DEAD /* position is dead left-half DBCS */ | |
| 75 | + DBCS_NONE = 0, /**< position is not DBCS */ | |
| 76 | + DBCS_LEFT, /**< position is left half of DBCS character */ | |
| 77 | + DBCS_RIGHT, /**< position is right half of DBCS character */ | |
| 78 | + DBCS_SI, /**< position is SI terminating DBCS subfield */ | |
| 79 | + DBCS_SB, /**< position is SBCS character after the SI */ | |
| 80 | + DBCS_LEFT_WRAP, /**< position is left half of split DBCS */ | |
| 81 | + DBCS_RIGHT_WRAP, /**< position is right half of split DBCS */ | |
| 82 | + DBCS_DEAD /**< position is dead left-half DBCS */ | |
| 83 | 83 | }; |
| 84 | 84 | #define IS_LEFT(d) ((d) == DBCS_LEFT || (d) == DBCS_LEFT_WRAP) |
| 85 | 85 | #define IS_RIGHT(d) ((d) == DBCS_RIGHT || (d) == DBCS_RIGHT_WRAP) | ... | ... |
src/lib3270/ft.c
| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 | #endif // HAVE_MALLOC_H |
| 42 | 42 | |
| 43 | 43 | //#include "appres.h" |
| 44 | -#include "actionsc.h" | |
| 44 | +//#include "actionsc.h" | |
| 45 | 45 | #include "ft_cutc.h" |
| 46 | 46 | #include "ft_dftc.h" |
| 47 | 47 | #include "ftc.h" |
| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 52 | #endif |
| 53 | 53 | */ |
| 54 | 54 | #include "kybdc.h" |
| 55 | -#include "objects.h" | |
| 55 | +// #include "objects.h" | |
| 56 | 56 | #include "popupsc.h" |
| 57 | 57 | #include "screenc.h" |
| 58 | 58 | #include "tablesc.h" | ... | ... |
src/lib3270/ft_cut.c
src/lib3270/ft_dft.c
src/lib3270/globals.h
src/lib3270/glue.c
| ... | ... | @@ -53,11 +53,11 @@ |
| 53 | 53 | #include "3270ds.h" |
| 54 | 54 | #include "resources.h" |
| 55 | 55 | |
| 56 | -#include "actionsc.h" | |
| 56 | +//#include "actionsc.h" | |
| 57 | 57 | #include "ansic.h" |
| 58 | 58 | #include "charsetc.h" |
| 59 | 59 | #include "ctlrc.h" |
| 60 | -#include "gluec.h" | |
| 60 | +// #include "gluec.h" | |
| 61 | 61 | #include "hostc.h" |
| 62 | 62 | // #include "keymapc.h" |
| 63 | 63 | #include "kybdc.h" |
| ... | ... | @@ -71,7 +71,7 @@ |
| 71 | 71 | #include "trace_dsc.h" |
| 72 | 72 | #include "utilc.h" |
| 73 | 73 | // #include "idlec.h" |
| 74 | -#include "printerc.h" | |
| 74 | +// #include "printerc.h" | |
| 75 | 75 | |
| 76 | 76 | #if defined(X3270_FT) |
| 77 | 77 | #include "ftc.h" | ... | ... |
src/lib3270/gluec.h
| ... | ... | @@ -21,11 +21,13 @@ |
| 21 | 21 | // extern int parse_command_line(int argc, const char **argv, const char **cl_hostname); |
| 22 | 22 | // extern int parse_program_parameters(int argc, const char **argv); |
| 23 | 23 | // LIB3270_INTERNAL void parse_xrm(const char *arg, const char *where); |
| 24 | -LIB3270_INTERNAL void notify_ssl_error(H3270 *session, const char *title, const char *msg, const char *state, const char *alert); | |
| 24 | +// LIB3270_INTERNAL void notify_ssl_error(H3270 *session, const char *title, const char *msg, const char *state, const char *alert); | |
| 25 | 25 | |
| 26 | 26 | /* XtGlue.c */ |
| 27 | -LIB3270_INTERNAL void (*Warning_redirect)(const char *); | |
| 27 | +// LIB3270_INTERNAL void (*Warning_redirect)(const char *); | |
| 28 | 28 | |
| 29 | -#if !defined(_WIN32) /*[*/ | |
| 30 | -LIB3270_INTERNAL int select_setup(int *nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval **timeout, struct timeval *timebuf); | |
| 31 | -#endif /*]*/ | |
| 29 | +// #if !defined(_WIN32) | |
| 30 | +// LIB3270_INTERNAL int select_setup(int *nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval **timeout, struct timeval *timebuf); | |
| 31 | +// #endif | |
| 32 | + | |
| 33 | +#error Deprecated | ... | ... |
src/lib3270/host.c
src/lib3270/icmdc.h
src/lib3270/keypadc.h
src/lib3270/kybd.c
| ... | ... | @@ -59,7 +59,7 @@ struct ta; |
| 59 | 59 | // #include "ctlr.h" |
| 60 | 60 | #include "resources.h" |
| 61 | 61 | |
| 62 | -#include "actionsc.h" | |
| 62 | +//#include "actionsc.h" | |
| 63 | 63 | #include "ansic.h" |
| 64 | 64 | //#include "aplc.h" |
| 65 | 65 | #include "ctlrc.h" |
| ... | ... | @@ -68,7 +68,7 @@ struct ta; |
| 68 | 68 | // #include "keypadc.h" |
| 69 | 69 | #include "kybdc.h" |
| 70 | 70 | #include "popupsc.h" |
| 71 | -#include "printc.h" | |
| 71 | +// #include "printc.h" | |
| 72 | 72 | #include "screenc.h" |
| 73 | 73 | // #if defined(X3270_DISPLAY) /*[*/ |
| 74 | 74 | // #include "selectc.h" | ... | ... |
src/lib3270/localdefs.h
| ... | ... | @@ -33,12 +33,12 @@ |
| 33 | 33 | /* These first definitions were cribbed from X11 -- but no X code is used. */ |
| 34 | 34 | #define False 0 |
| 35 | 35 | #define True 1 |
| 36 | -typedef void *XtPointer; | |
| 37 | -typedef void *Widget; | |
| 38 | -typedef void *XEvent; | |
| 36 | +//typedef void *XtPointer; | |
| 37 | +// typedef void *Widget; | |
| 38 | +// typedef void *XEvent; | |
| 39 | 39 | typedef char Boolean; |
| 40 | 40 | typedef char *String; |
| 41 | -typedef unsigned int Cardinal; | |
| 41 | +// typedef unsigned int Cardinal; | |
| 42 | 42 | typedef unsigned long KeySym; |
| 43 | 43 | #define Bool int |
| 44 | 44 | ... | ... |
src/lib3270/objects.h
| ... | ... | @@ -20,7 +20,9 @@ |
| 20 | 20 | // #define ObjConfirmButton "confirmButton" |
| 21 | 21 | // #define ObjConfirm2Button "confirm2Button" |
| 22 | 22 | // #define ObjCancelButton "cancelButton" |
| 23 | -#define ObjDialog "dialog" | |
| 23 | +// #define ObjDialog "dialog" | |
| 24 | 24 | // #define ObjSmallLabel "smallLabel" |
| 25 | -#define ObjNameLabel "nameLabel" | |
| 26 | -#define ObjDataLabel "dataLabel" | |
| 25 | +// #define ObjNameLabel "nameLabel" | |
| 26 | +// #define ObjDataLabel "dataLabel" | |
| 27 | + | |
| 28 | +#error Deprecated | ... | ... |
src/lib3270/paste.c
| ... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 | #include "3270ds.h" |
| 50 | 50 | #include "resources.h" |
| 51 | 51 | |
| 52 | -#include "actionsc.h" | |
| 52 | +//#include "actionsc.h" | |
| 53 | 53 | #include "ansic.h" |
| 54 | 54 | //#include "aplc.h" |
| 55 | 55 | #include "ctlrc.h" |
| ... | ... | @@ -58,7 +58,7 @@ |
| 58 | 58 | // #include "keypadc.h" |
| 59 | 59 | #include "kybdc.h" |
| 60 | 60 | #include "popupsc.h" |
| 61 | -#include "printc.h" | |
| 61 | +// #include "printc.h" | |
| 62 | 62 | #include "screenc.h" |
| 63 | 63 | |
| 64 | 64 | /* | ... | ... |
src/lib3270/printc.h
| ... | ... | @@ -18,13 +18,10 @@ |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | // LIB3270_INTERNAL Boolean fprint_screen(FILE *f, Boolean even_if_empty, Boolean use_html); |
| 21 | -LIB3270_INTERNAL void PrintText_action(Widget w, XEvent *event, String *params, | |
| 22 | - Cardinal *num_params); | |
| 23 | -LIB3270_INTERNAL void PrintWindow_action(Widget w, XEvent *event, String *params, | |
| 24 | - Cardinal *num_params); | |
| 25 | -LIB3270_INTERNAL void print_text_option(Widget w, XtPointer client_data, | |
| 26 | - XtPointer call_data); | |
| 27 | -LIB3270_INTERNAL void print_window_option(Widget w, XtPointer client_data, | |
| 28 | - XtPointer call_data); | |
| 29 | -LIB3270_INTERNAL void save_text_option(Widget w, XtPointer client_data, | |
| 30 | - XtPointer call_data); | |
| 21 | +// LIB3270_INTERNAL void PrintText_action(Widget w, XEvent *event, String *params,Cardinal *num_params); | |
| 22 | +// LIB3270_INTERNAL void PrintWindow_action(Widget w, XEvent *event, String *params,Cardinal *num_params); | |
| 23 | +// LIB3270_INTERNAL void print_text_option(Widget w, XtPointer client_data,XtPointer call_data); | |
| 24 | +// LIB3270_INTERNAL void print_window_option(Widget w, XtPointer client_data,XtPointer call_data); | |
| 25 | +// LIB3270_INTERNAL void save_text_option(Widget w, XtPointer client_data,XtPointer call_data); | |
| 26 | + | |
| 27 | +#error Deprecated | ... | ... |
src/lib3270/printerc.h
src/lib3270/savec.h
src/lib3270/screen.c
src/lib3270/scrollc.h
src/lib3270/session.c
| ... | ... | @@ -48,7 +48,7 @@ |
| 48 | 48 | |
| 49 | 49 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
| 50 | 50 | |
| 51 | - static H3270 h3270; | |
| 51 | + static H3270 *default_session = NULL; | |
| 52 | 52 | |
| 53 | 53 | /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ |
| 54 | 54 | |
| ... | ... | @@ -60,6 +60,9 @@ void lib3270_session_free(H3270 *h) |
| 60 | 60 | { |
| 61 | 61 | int f; |
| 62 | 62 | |
| 63 | + if(!h) | |
| 64 | + return; | |
| 65 | + | |
| 63 | 66 | // Terminate session |
| 64 | 67 | if(lib3270_connected(h)) |
| 65 | 68 | lib3270_disconnect(h); |
| ... | ... | @@ -91,6 +94,11 @@ void lib3270_session_free(H3270 *h) |
| 91 | 94 | release_pointer(h->buffer[f]); |
| 92 | 95 | } |
| 93 | 96 | |
| 97 | + if(h == default_session) | |
| 98 | + default_session = NULL; | |
| 99 | + | |
| 100 | + lib3270_free(h); | |
| 101 | + | |
| 94 | 102 | } |
| 95 | 103 | |
| 96 | 104 | 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) |
| 169 | 177 | initialize_tables(hSession); |
| 170 | 178 | |
| 171 | 179 | // Default calls |
| 172 | - hSession->write = lib3270_sock_send; | |
| 173 | - hSession->disconnect = lib3270_sock_disconnect; | |
| 174 | - hSession->update = update_char; | |
| 175 | - hSession->update_model = update_model; | |
| 176 | - hSession->update_cursor = update_cursor; | |
| 177 | - hSession->set_selection = nop_char; | |
| 178 | - hSession->ctlr_done = nop; | |
| 179 | - hSession->changed = changed; | |
| 180 | - hSession->erase = screen_disp; | |
| 181 | - hSession->suspend = nop; | |
| 182 | - hSession->resume = screen_disp; | |
| 183 | - hSession->update_oia = update_oia; | |
| 184 | - hSession->update_selection = update_selection; | |
| 185 | - hSession->cursor = set_cursor; | |
| 186 | - hSession->message = message; | |
| 187 | - hSession->update_ssl = update_ssl; | |
| 188 | - hSession->display = screen_disp; | |
| 189 | - hSession->set_width = set_width; | |
| 180 | + hSession->write = lib3270_sock_send; | |
| 181 | + hSession->disconnect = lib3270_sock_disconnect; | |
| 182 | + hSession->update = update_char; | |
| 183 | + hSession->update_model = update_model; | |
| 184 | + hSession->update_cursor = update_cursor; | |
| 185 | + hSession->set_selection = nop_char; | |
| 186 | + hSession->ctlr_done = nop; | |
| 187 | + hSession->changed = changed; | |
| 188 | + hSession->erase = screen_disp; | |
| 189 | + hSession->suspend = nop; | |
| 190 | + hSession->resume = screen_disp; | |
| 191 | + hSession->update_oia = update_oia; | |
| 192 | + hSession->update_selection = update_selection; | |
| 193 | + hSession->cursor = set_cursor; | |
| 194 | + hSession->message = message; | |
| 195 | + hSession->update_ssl = update_ssl; | |
| 196 | + hSession->display = screen_disp; | |
| 197 | + hSession->set_width = set_width; | |
| 190 | 198 | |
| 191 | 199 | // Set the defaults. |
| 192 | - hSession->extended = 1; | |
| 193 | - hSession->typeahead = 1; | |
| 194 | - hSession->oerr_lock = 1; | |
| 195 | - hSession->unlock_delay = 1; | |
| 196 | - hSession->icrnl = 1; | |
| 197 | - hSession->onlcr = 1; | |
| 198 | - hSession->host_charset = "bracket"; | |
| 199 | - hSession->sock = -1; | |
| 200 | - hSession->model_num = -1; | |
| 201 | - hSession->cstate = LIB3270_NOT_CONNECTED; | |
| 202 | - hSession->oia_status = -1; | |
| 203 | - hSession->kybdlock = KL_NOT_CONNECTED; | |
| 204 | - hSession->aid = AID_NO; | |
| 205 | - hSession->reply_mode = SF_SRM_FIELD; | |
| 206 | - hSession->linemode = 1; | |
| 207 | - hSession->tn3270e_submode = E_NONE; | |
| 208 | - hSession->scroll_top = -1; | |
| 209 | - hSession->scroll_bottom = -1; | |
| 210 | - hSession->wraparound_mode = 1; | |
| 200 | + hSession->extended = 1; | |
| 201 | + hSession->typeahead = 1; | |
| 202 | + hSession->oerr_lock = 1; | |
| 203 | + hSession->unlock_delay = 1; | |
| 204 | + hSession->icrnl = 1; | |
| 205 | + hSession->onlcr = 1; | |
| 206 | + hSession->host_charset = "bracket"; | |
| 207 | + hSession->sock = -1; | |
| 208 | + hSession->model_num = -1; | |
| 209 | + hSession->cstate = LIB3270_NOT_CONNECTED; | |
| 210 | + hSession->oia_status = -1; | |
| 211 | + hSession->kybdlock = KL_NOT_CONNECTED; | |
| 212 | + hSession->aid = AID_NO; | |
| 213 | + hSession->reply_mode = SF_SRM_FIELD; | |
| 214 | + hSession->linemode = 1; | |
| 215 | + hSession->tn3270e_submode = E_NONE; | |
| 216 | + hSession->scroll_top = -1; | |
| 217 | + hSession->scroll_bottom = -1; | |
| 218 | + hSession->wraparound_mode = 1; | |
| 211 | 219 | hSession->saved_wraparound_mode = 1; |
| 212 | 220 | hSession->once_cset = -1; |
| 213 | 221 | hSession->state = LIB3270_ANSI_STATE_DATA; |
| ... | ... | @@ -222,19 +230,6 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
| 222 | 230 | #endif // _WIN32 |
| 223 | 231 | |
| 224 | 232 | |
| 225 | -/* | |
| 226 | -#if !defined(_WIN32) | |
| 227 | - hSession->host_charset = "bracket"; | |
| 228 | -#else | |
| 229 | - | |
| 230 | - if (is_nt) | |
| 231 | - hSession->host_charset = "bracket"; | |
| 232 | - else | |
| 233 | - hSession->host_charset = "bracket437"; | |
| 234 | -#endif | |
| 235 | -*/ | |
| 236 | - | |
| 237 | - | |
| 238 | 233 | // Initialize toggles |
| 239 | 234 | initialize_toggles(hSession); |
| 240 | 235 | |
| ... | ... | @@ -296,20 +291,18 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
| 296 | 291 | |
| 297 | 292 | H3270 * lib3270_session_new(const char *model) |
| 298 | 293 | { |
| 299 | - static int configured = 0; | |
| 300 | - | |
| 301 | - H3270 *hSession = &h3270; | |
| 294 | + H3270 * hSession; | |
| 302 | 295 | |
| 303 | - trace("%s - configured=%d",__FUNCTION__,configured); | |
| 296 | + trace("%s - configured=%s",__FUNCTION__,default_session ? "Yes" : "No"); | |
| 304 | 297 | |
| 305 | - if(configured) | |
| 298 | + if(default_session) | |
| 306 | 299 | { |
| 307 | 300 | // TODO (perry#5#): Allocate a new structure. |
| 308 | 301 | errno = EBUSY; |
| 309 | - return hSession; | |
| 302 | + return lib3270_get_default_session_handle(); | |
| 310 | 303 | } |
| 311 | 304 | |
| 312 | - configured = 1; | |
| 305 | + hSession = default_session = lib3270_malloc(sizeof(H3270)); | |
| 313 | 306 | |
| 314 | 307 | lib3270_session_init(hSession, model); |
| 315 | 308 | |
| ... | ... | @@ -343,10 +336,14 @@ H3270 * lib3270_session_new(const char *model) |
| 343 | 336 | return hSession; |
| 344 | 337 | } |
| 345 | 338 | |
| 346 | - /* | |
| 347 | -- * Parse the model number. | |
| 348 | -- * Returns -1 (error), 0 (default), or the specified number. | |
| 349 | -- */ | |
| 339 | + /** | |
| 340 | + * Parse the model number. | |
| 341 | + * | |
| 342 | + * @param session Session Handle. | |
| 343 | + * @param m Model number. | |
| 344 | + * | |
| 345 | + * @return -1 (error), 0 (default), or the specified number. | |
| 346 | + */ | |
| 350 | 347 | static int parse_model_number(H3270 *session, const char *m) |
| 351 | 348 | { |
| 352 | 349 | int sl; |
| ... | ... | @@ -426,17 +423,17 @@ void check_session_handle(H3270 **hSession) |
| 426 | 423 | if(*hSession) |
| 427 | 424 | return; |
| 428 | 425 | |
| 429 | -#ifdef DEBUG | |
| 430 | - trace("** %s called with hSession == NULL",fname); | |
| 431 | -#endif | |
| 426 | + *hSession = lib3270_get_default_session_handle(); | |
| 432 | 427 | |
| 433 | - *hSession = &h3270; | |
| 428 | + lib3270_write_log(*hSession,"%s called with empty session",__FUNCTION__); | |
| 434 | 429 | } |
| 435 | 430 | |
| 436 | - | |
| 437 | 431 | LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) |
| 438 | 432 | { |
| 439 | - return &h3270; | |
| 433 | + if(default_session) | |
| 434 | + return default_session; | |
| 435 | + | |
| 436 | + return lib3270_session_new(""); | |
| 440 | 437 | } |
| 441 | 438 | |
| 442 | 439 | LIB3270_EXPORT void * lib3270_get_widget(H3270 *h) | ... | ... |
src/lib3270/toggles.c
src/lib3270/trace_ds.c
| ... | ... | @@ -54,16 +54,16 @@ |
| 54 | 54 | #include <fcntl.h> |
| 55 | 55 | #include "3270ds.h" |
| 56 | 56 | //#include "appres.h" |
| 57 | -#include "objects.h" | |
| 57 | +// #include "objects.h" | |
| 58 | 58 | #include "resources.h" |
| 59 | 59 | // #include "ctlr.h" |
| 60 | 60 | |
| 61 | 61 | #include "charsetc.h" |
| 62 | -#include "childc.h" | |
| 62 | +// #include "childc.h" | |
| 63 | 63 | #include "ctlrc.h" |
| 64 | 64 | #include "popupsc.h" |
| 65 | -#include "printc.h" | |
| 66 | -#include "savec.h" | |
| 65 | +// #include "printc.h" | |
| 66 | +// #include "savec.h" | |
| 67 | 67 | #include "tablesc.h" |
| 68 | 68 | #include "telnetc.h" |
| 69 | 69 | #include "trace_dsc.h" | ... | ... |
src/pw3270/v3270/oia.c
| ... | ... | @@ -505,7 +505,9 @@ void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, struct v3270_me |
| 505 | 505 | #ifdef HAVE_PRINTER |
| 506 | 506 | { V3270_OIA_PRINTER, setup_single_char_right }, |
| 507 | 507 | #endif // HAVE_PRINTER |
| 508 | +#ifdef HAVE_SCRIPT | |
| 508 | 509 | { V3270_OIA_SCRIPT, setup_single_char_right }, |
| 510 | +#endif // HAVE_SCRIPT | |
| 509 | 511 | { V3270_OIA_INSERT, setup_insert_position }, |
| 510 | 512 | { V3270_OIA_TYPEAHEAD, setup_single_char_right }, |
| 511 | 513 | { V3270_OIA_SHIFT, setup_double_char_position }, |
| ... | ... | @@ -1051,7 +1053,20 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) |
| 1051 | 1053 | update_text_field(terminal,on,V3270_OIA_TYPEAHEAD,"T"); |
| 1052 | 1054 | break; |
| 1053 | 1055 | |
| 1056 | +#ifdef HAVE_PRINTER | |
| 1057 | + case LIB3270_FLAG_PRINTER: | |
| 1058 | + update_text_field(terminal,on,V3270_OIA_PRINTER,"P"); | |
| 1059 | + break; | |
| 1060 | +#endif // HAVE_PRINTER | |
| 1061 | + | |
| 1062 | +#ifdef HAVE_SCRIPT | |
| 1063 | + case LIB3270_FLAG_SCRIPT: | |
| 1064 | + update_text_field(terminal,on,V3270_OIA_SCRIPT,"S"); | |
| 1065 | + break; | |
| 1066 | +#endif // HAVE_SCRIPT | |
| 1067 | + | |
| 1054 | 1068 | default: |
| 1055 | 1069 | return; |
| 1056 | 1070 | } |
| 1071 | + | |
| 1057 | 1072 | } | ... | ... |