Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/ttssh2/ttxssh/util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10615 - (show annotations) (download) (as text)
Wed Mar 1 14:18:31 2023 UTC (12 months, 1 week ago) by zmatsuo
File MIME type: text/x-chdr
File size: 3922 byte(s)
ttxssh内 lngファイル名変数を ANSI版から Unicode 版へ切り替え

- UTIL_get_lang_fixedfont()
  - 引数をUnicode版lngファイル名に変更
  - LOGFONTをUnicode版に切り替え
- SetI18nMenuStrs() -> SetI18nMenuStrsW()
- TTMessageBoxA() -> TTMessageBoxW()
1 /*
2 * Copyright (c) 1998-2001, Robert O'Callahan
3 * (C) 2004- TeraTerm Project
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 /*
31 This code is copyright (C) 1998-1999 Robert O'Callahan.
32 See LICENSE.TXT for the license.
33 */
34
35 #ifndef __UTIL_H
36 #define __UTIL_H
37
38 typedef unsigned long uint32;
39 typedef unsigned short uint16;
40
41 #define NUM_ELEM(a) (sizeof(a) / sizeof((a)[0]))
42
43 #define buf_create(buf, len) (*(buf) = 0, *(len) = 0)
44
45 #define buf_ensure_size(buf, len, desired) \
46 (*(len) < (desired) ? (*(buf) = realloc(*(buf), (desired)), *(len) = (desired)) : *(len))
47
48 #define buf_ensure_size_growing(buf, len, desired) \
49 (*(len) < (desired) ? (*(buf) = realloc(*(buf), (desired)*2), *(len) = (desired)*2) : *(len))
50
51 #define buf_destroy(buf, len) (free(*(buf)), *(buf) = 0, *(len) = 0)
52
53 #define get_uint32_MSBfirst(buf) \
54 (((uint32)(unsigned char)(buf)[0] << 24) + ((uint32)(unsigned char)(buf)[1] << 16) + \
55 ((uint32)(unsigned char)(buf)[2] << 8) + (uint32)(unsigned char)(buf)[3])
56
57 #define get_ushort16_MSBfirst(buf) \
58 (((uint32)(unsigned char)(buf)[0] << 8) + (uint32)(unsigned char)(buf)[1])
59
60 #define set_ushort16_MSBfirst(buf, v) \
61 ((buf)[0] = (unsigned char)((uint16)(v) >> 8), \
62 (buf)[1] = (unsigned char)(uint16)(v))
63
64 #define set_uint32_MSBfirst(buf, v) \
65 ((buf)[0] = (unsigned char)((uint32)(v) >> 24), \
66 (buf)[1] = (unsigned char)((uint32)(v) >> 16), \
67 (buf)[2] = (unsigned char)((uint32)(v) >> 8), \
68 (buf)[3] = (unsigned char)(uint32)(v))
69
70 typedef struct _UTILSockWriteBuf {
71 char *bufdata;
72 int buflen;
73 int datastart;
74 int datalen;
75 } UTILSockWriteBuf;
76
77 typedef BOOL (* UTILBlockingWriteCallback)(PTInstVar pvar,
78 SOCKET socket, const char *data, int len);
79
80 void UTIL_init_sock_write_buf(UTILSockWriteBuf *buf);
81 BOOL UTIL_sock_buffered_write(PTInstVar pvar, UTILSockWriteBuf *buf,
82 UTILBlockingWriteCallback blocking_write, SOCKET socket, const char *data, int len);
83 BOOL UTIL_sock_write_more(PTInstVar pvar, UTILSockWriteBuf *buf, SOCKET socket);
84 void UTIL_destroy_sock_write_buf(UTILSockWriteBuf *buf);
85 BOOL UTIL_is_sock_deeply_buffered(UTILSockWriteBuf *buf);
86
87 void UTIL_get_lang_msg(const char *key, PTInstVar pvar, const char *def);
88 void UTIL_get_lang_msgW(const char *key, PTInstVar pvar, const wchar_t *def, wchar_t *UIMsg);
89 void UTIL_get_lang_msgU8(const char *key, PTInstVar pvar, const char *def);
90 HFONT UTIL_get_lang_fixedfont(HWND hWnd, const wchar_t *UILanguageFile);
91
92 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26