comparison g23m/condat/ms/src/atb/ATBCommon.h @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
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
110 char ATB_char_GSM(char ascii_character);
111 char ATB_char_Ascii(USHORT character);
112 USHORT ATB_char_Unicode(char character);
113 BOOL ATB_char_IsAscii(USHORT character);
114 BOOL ATB_char_IsAlphabetic(USHORT character);
115 BOOL ATB_char_IsNumeric(USHORT character);
116 BOOL ATB_char_IsVisible(USHORT character);
117 UBYTE ATB_string_Size(T_ATB_TEXT *text);
118 void ATB_string_SetChar(T_ATB_TEXT *text, USHORT textIndex, USHORT character);
119 USHORT ATB_string_GetChar(T_ATB_TEXT *text, USHORT textIndex);
120 BOOL ATB_string_MoveLeft(T_ATB_TEXT *text, USHORT textIndex, USHORT offset);
121 BOOL ATB_string_MoveRight(T_ATB_TEXT *text, USHORT textIndex, USHORT offset, USHORT size);
122 USHORT ATB_string_Length(T_ATB_TEXT* text);
123 USHORT ATB_string_UCLength(USHORT* text);
124 void ATB_string_Copy(T_ATB_TEXT* dest, T_ATB_TEXT* src);
125 void ATB_string_Concat(T_ATB_TEXT* dest, T_ATB_TEXT* srcen);
126 SHORT ATB_string_FindChar(T_ATB_TEXT* text, USHORT character);
127 void ATB_string_ToUnicode(T_ATB_TEXT *dest, T_ATB_TEXT *src);
128 void ATB_string_ToAscii(T_ATB_TEXT *dest, T_ATB_TEXT *src);
129 USHORT ATB_string_IndexMove(T_ATB_TEXT *text, USHORT textIndex, SHORT offset);
130 #endif