~ubuntu-branches/ubuntu/maverick/tn5250/maverick

« back to all changes in this revision

Viewing changes to lib5250/utility.h

  • Committer: Bazaar Package Importer
  • Author(s): Carey Evans
  • Date: 2009-12-17 22:23:00 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20091217222300-cyutcin1bc0m9wrd
Tags: 0.17.4-2
Fix many compiler warnings, especially implicit pointer conversions
(closes: #561165, #561166).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* TN5250 - An implementation of the 5250 telnet protocol.
 
2
 * Copyright (C) 1997-2008 Michael Madore
 
3
 * 
 
4
 * This file is part of TN5250.
 
5
 *
 
6
 * TN5250 is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU Lesser General Public License as published by
 
8
 * the Free Software Foundation; either version 2.1, or (at your option)
 
9
 * any later version.
 
10
 * 
 
11
 * TN5250 is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU Lesser General Public License for more details.
 
15
 * 
 
16
 * You should have received a copy of the GNU Lesser General Public License
 
17
 * along with this software; see the file COPYING.  If not, write to
 
18
 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 
19
 * Boston, MA 02111-1307 USA
 
20
 * 
 
21
 */
 
22
#ifndef UTILITY_H
 
23
#define UTILITY_H
 
24
 
 
25
#ifdef __cplusplus
 
26
extern "C" {
 
27
#endif
 
28
 
 
29
#if SIZEOF_SHORT == 2
 
30
typedef unsigned short Tn5250Uint16;
 
31
typedef signed short Tn5250Sint16;
 
32
#elif SIZEOF_INT == 2
 
33
typedef unsigned int Tn5250Uint16;
 
34
typedef signed int Tn5250Sint16;
 
35
#else
 
36
   ACK!  Need a 16-bit type!
 
37
#endif
 
38
 
 
39
typedef unsigned char Tn5250Char;
 
40
 
 
41
/****s* lib5250/Tn5250CharMap
 
42
 * NAME
 
43
 *    Tn5250CharMap
 
44
 * SYNOPSIS
 
45
 *    Tn5250CharMap *map = tn5250_char_map_new ("37");
 
46
 *    ac = tn5250_char_map_to_local(map,ec);
 
47
 *    ec = tn5250_char_map_to_remote(map,ac);
 
48
 *    if (tn5250_char_map_printable_p (map,ec))
 
49
 *       ;
 
50
 *    if (tn5250_char_map_attribute_p (map,ec))
 
51
 *       ;
 
52
 *    tn5250_char_map_destroy(map);
 
53
 * DESCRIPTION
 
54
 *    The Tn5250CharMap object embodies a translation map which can be
 
55
 *    used to translate characters from various flavours of ASCII and
 
56
 *    ISO character sets to various flavours of EBCDIC characters sets
 
57
 *    (and back).
 
58
 * SOURCE
 
59
 */
 
60
 
 
61
 
 
62
struct _Tn5250CharMap {
 
63
   const char *name;
 
64
   const unsigned char *to_remote_map;
 
65
   const unsigned char *to_local_map;
 
66
};
 
67
 
 
68
typedef struct _Tn5250CharMap Tn5250CharMap;
 
69
 
 
70
struct _clientaddr {
 
71
  unsigned long int address;
 
72
  unsigned long int mask;
 
73
};  
 
74
 
 
75
typedef struct _clientaddr clientaddr;
 
76
 
 
77
extern Tn5250CharMap tn5250_transmaps[];
 
78
/*******/
 
79
 
 
80
Tn5250CharMap *tn5250_char_map_new(const char *maping);
 
81
void tn5250_char_map_destroy(Tn5250CharMap *This);
 
82
 
 
83
void tn5250_closeall(int fd);
 
84
int tn5250_daemon(int nochdir, int noclose, int ignsigcld);
 
85
int tn5250_make_socket(unsigned short int port);
 
86
 
 
87
Tn5250Char tn5250_char_map_to_remote(Tn5250CharMap *This, Tn5250Char ascii);
 
88
Tn5250Char tn5250_char_map_to_local(Tn5250CharMap *This, Tn5250Char ebcdic);
 
89
 
 
90
int tn5250_char_map_printable_p(Tn5250CharMap *This, Tn5250Char data);
 
91
int tn5250_char_map_attribute_p(Tn5250CharMap *This, Tn5250Char data);
 
92
int tn5250_setenv(const char *name, const char *value, int overwrite);
 
93
 
 
94
/* Idea shamelessly stolen from GTK+ */
 
95
#define tn5250_new(type,count) (type *)malloc (sizeof (type) * (count))
 
96
 
 
97
#define TN5250_MAKESTRING(expr) #expr
 
98
#ifndef NDEBUG
 
99
void tn5250_log_open(const char *fname);
 
100
void tn5250_log_printf(const char *fmt,...);
 
101
void tn5250_log_close(void);
 
102
void tn5250_log_assert(int val, char const *expr, char const *file, int line);
 
103
#define TN5250_LOG(args) tn5250_log_printf args
 
104
#define TN5250_ASSERT(expr) \
 
105
   tn5250_log_assert((expr), TN5250_MAKESTRING(expr), __FILE__, __LINE__)
 
106
 
 
107
extern FILE * tn5250_logfile;
 
108
#else
 
109
#define TN5250_LOG(args)
 
110
#define TN5250_ASSERT(expr)
 
111
#endif
 
112
 
 
113
#include "conf.h"
 
114
 
 
115
int tn5250_parse_color(Tn5250Config *config, const char *colorname, 
 
116
                        int *r, int *g, int *b);
 
117
int tn5250_run_cmd(const char *cmd, int wait);
 
118
 
 
119
#ifdef __cplusplus
 
120
}
 
121
#endif
 
122
 
 
123
#endif                          /* UTILITY_H */
 
124
 
 
125
/* vi:set sts=3 sw=3: */