File: STypes.h

package info (click to toggle)
yudit 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 18,472 kB
  • sloc: cpp: 76,344; perl: 5,630; makefile: 989; ansic: 823; sh: 441
file content (117 lines) | stat: -rw-r--r-- 3,204 bytes parent folder | download
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
/** 
 *  Yudit Unicode Editor Source File
 *
 *  GNU Copyright (C) 1997-2023  Gaspar Sinai <gaspar@yudit.org>  
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License, version 2,
 *  dated June 1991. See file COPYYING for details.
 *
 *  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; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
#ifndef STypes_h
#define STypes_h

#define SD_YUDIT_VERSION "3.1.0"

#define SB_YUDIT_MAX_SCALE 3.0

/* search this many subdirectories */
#define SB_YUDIT_SUBDIR_LEVEL 5

// Speed tests: 5: 655ms 8: 1394ms / 1000 complex kanji.
#define SS_RASTERIZER_OVERSAMPLE 8

// Get the SS_WORD16_t and u_int_32
#include <sys/types.h>
#include "stoolkit/SBinVector.h"
#include "stoolkit/SStringVector.h"
#include <string.h>

#ifdef HAVE_UTYPES
 typedef u_int8_t SS_WORD8;
 typedef u_int16_t SS_WORD16;
 typedef u_int32_t SS_WORD32;
 typedef int32_t  SS_SINT_32
 typedef int16_t  SS_SINT_16

#ifdef HAVE_LONG_LONG
  typedef u_int64_t SS_WORD64;
#else /* HAVE_LONG_LONG */
  typedef u_int32_t SS_WORD64;
#endif /* HAVE_LONG_LONG */

#else /* HAVE_UTYPES */
 typedef unsigned char SS_WORD8;
 typedef unsigned short SS_WORD16;
 typedef unsigned int SS_WORD32;
 typedef int  SS_SINT_32;
 typedef short  SS_SINT_16;

#ifdef HAVE_LONG_LONG
  typedef unsigned long long  SS_WORD64;
#else /* HAVE_LONG_LONG */
  typedef unsigned long  SS_WORD64;
#endif /* HAVE_LONG_LONG */

#endif /* HAVE_UTYPES */

typedef SS_WORD16 SS_UCS2;
typedef SS_WORD32 SS_UCS4;

typedef SBinVector<SS_UCS2> SV_UCS2;
typedef SBinVector<SS_UCS4> SV_UCS4;

/* processors calculate with integers fast */
typedef unsigned int SS_UINT;
typedef int SS_INT;

typedef SBinVector<SS_UINT> SV_UINT;
typedef SBinVector<SS_INT> SV_INT;

/*
 * SStringVector column0 = SStringTable[0];
 */
typedef SVector<SStringVector> SStringTable;

typedef int SAlignment;

typedef SS_WORD16 SS_GlyphIndex;
typedef SBinVector<SS_GlyphIndex> SV_GlyphIndex;

typedef  SBinVector<int> SSyntaxRow;
typedef  SBinVector<SSyntaxRow*> SSyntaxData;
typedef  SBinVector<SV_UCS4*> SUnicodeData;

#define SD_Left ((SAlignment)-1)
#define SD_Right ((SAlignment)1)
#define SD_Center ((SAlignment)0)

/* char can be only positive on some platforms */
#define SD_NOSHAPE ((char)0x7f)

/* This many lines are pre-expanded around cursor, for efficiencey */
#define SD_PRE_EXPAND 50
#define DEBUG_PARSER 0

#define SD_MATCH_EOD 0x7ffffff
// to provide timer based solution
#define SD_MATCH_AGAIN 0x7fffffe

#if defined NO_SNPRINTF && !defined snprintf 
// This may look unsafe but we never pass a buffer that is too small.
// For portablity I dont use ## __VA_ARGS__, there is always at least
// one argument in our codebase.
#define snprintf(str, size, fmt, ...) sprintf(str, fmt,  __VA_ARGS__)
#endif


#endif /* STypes_h */