comparison src/ui/atb/ATBCommon.h @ 3:67bfe9f274f6

src/ui: import of src/ui3 from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:33:10 +0000
parents
children
comparison
equal deleted inserted replaced
2:3a14ee9a9843 3:67bfe9f274f6
1 #ifndef ATB_COMMON_H
2 #define ATB_COMMON_H
3
4 /**********************************************
5 * STANDARD DEFINITIONS
6 *
7 **********************************************/
8 #ifndef USHORT
9 #define EXTERN extern
10 #define GLOBAL
11 #define LOCAL static
12 #define ULONG unsigned long
13 #define LONG long
14 #define USHORT unsigned short
15 #define SHORT short
16 #define UBYTE unsigned char
17 #define BYTE unsigned char
18 #define BOOL unsigned char
19 #endif
20 #ifndef TRUE
21 #define TRUE 1
22 #define FALSE 0
23 #endif
24
25 /* UNICODE CHARACTERS */
26
27 #define UNICODE_EOLN 0x0000
28 #define UNICODE_STARTHIGHLIGHT 0x0100
29 #define UNICODE_ENDHIGHLIGHT 0x0200
30 #define UNICODE_LINEFEED 0x0A00
31 #define UNICODE_CR 0x0D00
32
33 #define UNICODE_SPACE 0x2000
34 #define UNICODE_HASH 0x2300
35 #define UNICODE_STAR 0x2A00
36 #define UNICODE_PLUS 0x2B00
37 #define UNICODE_FULLSTOP 0x2E00
38 #define UNICODE_EXCLAMATION 0x2100
39 #define UNICODE_QUESTION 0x3F00
40
41 #define UNICODE_ASCII 0xFF00
42 #define UNICODE_NONASCII 0x00FF
43 #define UNICODE_EXTENDEDASCII 0x8000
44
45 #define WHOLESTRING 0xFFFF // parameter for length in uc... functions, copies until null is found
46 #define UNICODE_WIDEST_CHAR 0xFFFF /* Used to return width of widest character in font */
47
48
49 /**********************************************
50 * T_ATB_TEXT
51 *
52 * Standard text data structure
53 *********************************************/
54
55 typedef struct
56 {
57 UBYTE dcs;
58 USHORT len;
59 UBYTE *data;
60 }
61 T_ATB_TEXT;
62
63
64 /**********************************************
65 * T_ATB_DCS
66 *
67 * Data coding schemes for text
68 *********************************************/
69
70 typedef enum
71 {
72 ATB_DCS_ASCII,
73 ATB_DCS_UNICODE
74 }
75 T_ATB_DCS;
76
77
78 /**********************************************
79 * T_ATB_WIN_SIZE
80 *
81 * Size of editor window
82 *********************************************/
83
84 typedef struct
85 {
86 SHORT px;
87 SHORT py;
88 SHORT sx;
89 SHORT sy;
90 }
91 T_ATB_WIN_SIZE;
92
93
94 /**********************************************
95 * FUNCTION PROTOTYPES
96 *
97 *********************************************/
98
99 /* ATB memory allocation */
100
101 UBYTE* ATB_mem_Alloc(USHORT size);
102 void ATB_mem_Free(UBYTE* address, USHORT size);
103
104 /* Character and string handling */
105
106 /*SPR2175, new function for conversion*/
107 int ATB_convert_String( char * ipString, UBYTE ipDataType, int ipLength,
108 char * opString, UBYTE opDataType, int opLength, UBYTE addNull);
109 void convertUnpacked7To8 (char * ipString, int ipLength,
110 char * opString, int opLength);
111
112 char ATB_char_GSM(char ascii_character);
113 char ATB_char_Ascii(USHORT character);
114 USHORT ATB_char_Unicode(char character);
115 BOOL ATB_char_IsAscii(USHORT character);
116 BOOL ATB_char_IsAlphabetic(USHORT character);
117 BOOL ATB_char_IsNumeric(USHORT character);
118 BOOL ATB_char_IsVisible(USHORT character);
119 UBYTE ATB_string_Size(T_ATB_TEXT *text);
120 void ATB_string_SetChar(T_ATB_TEXT *text, USHORT textIndex, USHORT character);
121 USHORT ATB_string_GetChar(T_ATB_TEXT *text, USHORT textIndex);
122 BOOL ATB_string_MoveLeft(T_ATB_TEXT *text, USHORT textIndex, USHORT offset);
123 BOOL ATB_string_MoveRight(T_ATB_TEXT *text, USHORT textIndex, USHORT offset, USHORT size);
124 USHORT ATB_string_Length(T_ATB_TEXT* text);
125 USHORT ATB_string_UCLength(USHORT* text);
126 void ATB_string_Copy(T_ATB_TEXT* dest, T_ATB_TEXT* src);
127 void ATB_string_Concat(T_ATB_TEXT* dest, T_ATB_TEXT* srcen);
128 SHORT ATB_string_FindChar(T_ATB_TEXT* text, USHORT character);
129 void ATB_string_ToUnicode(T_ATB_TEXT *dest, T_ATB_TEXT *src);
130 void ATB_string_ToAscii(T_ATB_TEXT *dest, T_ATB_TEXT *src);
131 USHORT ATB_string_IndexMove(T_ATB_TEXT *text, USHORT textIndex, SHORT offset);
132
133 /* Added to remove warnings Aug -11 */
134 EXTERN UBYTE utl_cvt8To7 ( const UBYTE* source,
135 UBYTE source_len,
136 UBYTE* dest,
137 UBYTE bit_offset);
138 /* End - remove warning Aug -11 */
139
140 #endif