1
/* $XTermId: ptyx.h,v 1.656 2010/01/04 09:09:29 tom Exp $ */
1
/* $XTermId: ptyx.h,v 1.668 2010/06/04 09:41:40 tom Exp $ */
4
4
* Copyright 1999-2009,2010 by Thomas E. Dickey
77
77
#define MyStackAlloc(size, stack_cache_array) \
78
78
((size) <= sizeof(stack_cache_array) \
79
79
? (XtPointer)(stack_cache_array) \
80
: (XtPointer)malloc((unsigned)(size)))
80
: (XtPointer)malloc((size_t)(size)))
82
82
#define MyStackFree(pointer, stack_cache_array) \
83
83
if ((pointer) != ((char *)(stack_cache_array))) free(pointer)
85
85
/* adapted from vile (vi-like-emacs) */
86
#define TypeCallocN(type,n) (type *)calloc((n), sizeof(type))
87
#define TypeCalloc(type) TypeCallocN(type,1)
86
#define TypeCallocN(type,n) (type *)calloc((size_t) (n), sizeof(type))
87
#define TypeCalloc(type) TypeCallocN(type, 1)
89
#define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (n))
90
#define TypeMalloc(type) TypeMallocN(type,1)
89
#define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (size_t) (n))
90
#define TypeMalloc(type) TypeMallocN(type, 1)
92
92
#define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type))
94
94
/* use these to allocate partly-structured data */
95
#define CastMallocN(type,n) (type *)malloc(sizeof(type) + (n))
95
#define CastMallocN(type,n) (type *)malloc(sizeof(type) + (size_t) (n))
96
96
#define CastMalloc(type) CastMallocN(type,0)
98
98
#define BumpBuffer(type, buffer, size, want) \
910
#define COLOR_DEFINED(s,w) ((s)->which & (1<<(w)))
916
#define COLOR_DEFINED(s,w) ((s)->which & (unsigned) (1<<(w)))
911
917
#define COLOR_VALUE(s,w) ((s)->colors[w])
912
#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), ((s)->which |= (1<<(w))))
918
#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), UIntSet((s)->which, (1<<(w))))
914
920
#define COLOR_NAME(s,w) ((s)->names[w])
915
#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (1<<(w))))
921
#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (unsigned) (1<<(w))))
917
923
#define UNDEFINE_COLOR(s,w) ((s)->which &= (~((w)<<1)))
1803
1809
unsigned restore_height;
1813
Boolean allowScrollLock;/* ScrollLock mode */
1814
Boolean allowScrollLock0;/* initial ScrollLock mode */
1815
Boolean scroll_lock; /* true to keep buffer in view */
1816
Boolean scroll_dirty; /* scrolling makes screen dirty */
1806
1819
#if OPT_VT52_MODE
1807
1820
int vt52_save_level; /* save-area for DECANM */
1808
1821
Char vt52_save_curgl;
1980
1993
#if OPT_READLINE
1981
1994
#define SCREEN_FLAG(screenp,f) (1&(screenp)->f)
1982
1995
#define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1)
1983
#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= ~1L)
1996
#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= (unsigned) ~1L)
1984
1997
#define SCREEN_FLAG_save(screenp,f) \
1985
1998
((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f))
1986
1999
#define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1))
2056
2069
#define KEYBOARD_TYPES NAME_TCAP_KT NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT
2072
#define TRACE_RC(code,func) code = func
2074
#define TRACE_RC(code,func) func
2059
2078
extern const char * visibleKeyboardType(xtermKeyboardType);
2167
2186
#if OPT_NUM_LOCK
2168
2187
Boolean real_NumLock; /* true if we treat NumLock key specially */
2169
2188
Boolean alwaysUseMods; /* true if we always want f-key modifiers */
2170
unsigned long num_lock; /* modifier for Num_Lock */
2171
unsigned long alt_mods; /* modifier for Alt_L or Alt_R */
2172
unsigned long meta_mods; /* modifier for Meta_L or Meta_R */
2173
unsigned long other_mods; /* conflicting modifiers, e.g., Mode_Switch */
2189
unsigned num_lock; /* modifier for Num_Lock */
2190
unsigned alt_mods; /* modifier for Alt_L or Alt_R */
2191
unsigned meta_mods; /* modifier for Meta_L or Meta_R */
2192
unsigned other_mods; /* conflicting modifiers, e.g., Mode_Switch */
2175
2194
#if OPT_RENDERFONT
2176
2195
char *face_name;