extension.h
5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*
* Copyright 2008, Banco do Brasil S.A.
*
* This file is part of g3270
*
* This program file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 3 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program in a file named COPYING; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authors:
*
* Perry Werneck<perry.werneck@gmail.com>
*
*/
#ifndef G3270_EXTENSION_H_INCLUDED
#include <gtk/gtk.h>
#include <sys/time.h>
#ifdef G3270_CORE
#include <lib/localdefs.h>
#include <lib/lib3270.h>
#else
#include <g3270/localdefs.h>
#include <g3270/lib3270.h>
#endif
#define G3270_EXTENSION_H_INCLUDED
enum status_codes
{
STATUS_DISCONNECTED, /* 0 X Not Connected */
STATUS_RESOLVING, /* 1 X Resolving */
STATUS_CONNECTING, /* 2 X Connecting */
STATUS_NONSPECIFIC, /* 3 X */
STATUS_INHIBIT, /* 4 X Inhibit */
STATUS_BLANK, /* 5 (blank) */
STATUS_TWAIT, /* 6 X Wait */
STATUS_SYSWAIT, /* 7 X SYSTEM */
STATUS_PROTECTED, /* 8 X Protected */
STATUS_NUMERIC, /* 9 X Numeric */
STATUS_OVERFLOW, /* 10 X Overflow */
STATUS_DBCS, /* 11 X DBCS */
STATUS_SCROLLED, /* 12 X Scrolled */
STATUS_MINUS, /* 13 X -f */
STATUS_AWAITING_FIRST, /* 14 X Wait */
STATUS_CONNECTED, /* 15 Connected */
STATUS_RECONNECTING
};
enum cursor_types
{
CURSOR_TYPE_OVER,
CURSOR_TYPE_INSERT,
CURSOR_TYPE_CROSSHAIR // Must be the last one!
};
#define CURSOR_TYPE_NONE -1
enum _STATUS_COLORS
{
STATUS_COLOR_BACKGROUND,
STATUS_COLOR_SEPARATOR,
STATUS_COLOR_CURSOR_POSITION,
STATUS_COLOR_LUNAME,
STATUS_COLOR_ERROR,
STATUS_COLOR_TIME,
STATUS_COLOR_WARNING,
STATUS_COLOR_NORMAL,
STATUS_COLOR_TOOGLE,
STATUS_COLOR_SSL,
STATUS_COLOR_CONNECTED,
STATUS_COLOR_KEYBOARD,
STATUS_COLOR_CONNECT_ICON,
STATUS_COLORS // Must be the last one
};
#define STATUS_COLOR_CNCT STATUS_COLOR_CONNECT_ICON
#define STATUS_COLOR_TYPEAHEAD STATUS_COLOR_TOOGLE
#ifndef GDK_NUMLOCK_MASK
#define GDK_NUMLOCK_MASK GDK_MOD2_MASK
#endif
#ifndef GDK_ALT_MASK
#define GDK_ALT_MASK GDK_MOD1_MASK
#endif
#define LockThreads() gdk_lock()
#define UnlockThreads() gdk_unlock()
#ifdef __cplusplus
extern "C" {
#endif
/*---[ Macros ]---------------------------------------------------------------*/
#define Log(...) g3270_log(MODULE, __VA_ARGS__)
#define WriteLog(...) g3270_log(MODULE, __VA_ARGS__)
#define WriteError(e,...) g3270_logRC(MODULE, e, __VA_ARGS__)
#define Error(...) g3270_logRC(MODULE, -1, __VA_ARGS__)
#define ErrorPopup(...) g3270_popup(MODULE, -1, __VA_ARGS__)
#define Exec(...) g3270_logExec(MODULE, __VA_ARGS__)
#define NOT_IMPLEMENTED( ... ) g3270_log(MODULE, "*** NOT IMPLEMENTED CALL ***: " __FILE__ " " __VA_ARGS__)
#if defined( DEBUG )
#define DBGFILE stderr
#define CHKPoint() fprintf(DBGFILE,"%s(%d):\t%s\t\t(" __DATE__ " " __TIME__")\n",__FILE__,__LINE__,__FUNCTION__);fflush(DBGFILE);
#define DBGMessage(x) fprintf(DBGFILE,"%s(%d):\t%s\n",__FILE__,__LINE__,x);fflush(DBGFILE);
#define DBGTrace(x) fprintf(DBGFILE,"%s(%d):\t%s = %ld\n",__FILE__,__LINE__,#x, (unsigned long) x);fflush(DBGFILE);
#define DBGTracex(x) fprintf(DBGFILE,"%s(%d):\t%s = %08lx\n",__FILE__,__LINE__,#x, (unsigned long) x);fflush(DBGFILE);
#define DBGPrintf(x, ...) fprintf(DBGFILE,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__);fflush(DBGFILE);
#else
#define DBGMessage(x) /* x */
#define DBGTrace(x) /* x */
#define DBGTracex(x) /* x */
#define CHKPoint() /* */
#define DBGPrintf(x, ...) /* */
#endif
#ifndef BUILD
#define BUILD 20070425
#endif
/*---[ Prototipes ]-----------------------------------------------------------*/
int g3270_logRC(const char *, int, const char *, ...);
int g3270_popup(const char *, int, const char *, ...);
int g3270_log(const char *, const char *, ...);
int g3270_logExec(const char *, const char *, ...);
int g3270_logName(const char *);
int g3270_lock(void);
int g3270_unlock(void);
void gdk_lock(void);
void gdk_unlock(void);
/*---[ Extension entry points ]-----------------------------------------------*/
int g3270OpenExtension(GtkWidget *TopWindow);
int g3270CloseExtension(GtkWidget *TopWindow);
void g3270LUChanged(GtkWidget *widget, const char *lu);
void g3270ServerChanged(GtkWidget *widget, const char *server);
#ifdef __cplusplus
}
#endif
#endif