FreeCalypso > hg > fc-tourmaline
comparison src/ui/atb/ATBPb_i.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 /********************************************** | |
2 * T_PB_COMMAND | |
3 * | |
4 * Command ID of executing function | |
5 * | |
6 **********************************************/ | |
7 | |
8 typedef enum | |
9 { | |
10 PB_INITIALISE, | |
11 PB_READREC, | |
12 PB_WRITEREC, | |
13 PB_DELETEREC, | |
14 PB_FIND, | |
15 PB_READRECLIST, | |
16 PB_SEARCH | |
17 } | |
18 T_PB_COMMAND; | |
19 | |
20 | |
21 /********************************************** | |
22 * T_PB_STATUS | |
23 * | |
24 * Status of executing function | |
25 * | |
26 **********************************************/ | |
27 | |
28 typedef enum | |
29 { | |
30 PB_STATUS_NONE, | |
31 PB_STATUS_INIT, | |
32 PB_STATUS_EXEC, | |
33 PB_STATUS_COMPLETE | |
34 } T_PB_STATUS; | |
35 | |
36 typedef struct | |
37 { | |
38 T_PB_TYPE type; /* The type of phonebook */ | |
39 SHORT records_max; /* The maximum no. of records that can be stored */ | |
40 SHORT phys_index; | |
41 T_PB_RECORD *record; /* Currently read record */ | |
42 UBYTE first_record; /* Flag that is true when the first record is being read */ | |
43 } | |
44 T_PB_INITIALISE; | |
45 | |
46 typedef struct | |
47 { | |
48 SHORT log_index; | |
49 T_PB_INDEX index_type;/*a0393213 warnings removal-T_PB_TYPE changed to T_PB_INDEX*/ | |
50 SHORT phys_index; | |
51 T_PB_RECORD *record; | |
52 } | |
53 T_PB_WRITEREC; | |
54 | |
55 typedef struct | |
56 { | |
57 SHORT log_index; | |
58 T_PB_INDEX index_type;/*a0393213 warnings removal-T_PB_TYPE changed to T_PB_INDEX*/ | |
59 SHORT phys_index; | |
60 } | |
61 T_PB_DELETEREC; | |
62 | |
63 typedef union | |
64 { | |
65 T_PB_INITIALISE Initialise; | |
66 T_PB_WRITEREC WriteRec; | |
67 T_PB_DELETEREC DeleteRec; | |
68 } | |
69 T_PB_PARAM; | |
70 | |
71 /************************************************** | |
72 * T_PB_DATA | |
73 * | |
74 * Data structure to keep track of phonebook entries | |
75 * and index tables. | |
76 * | |
77 **************************************************/ | |
78 | |
79 typedef struct | |
80 { | |
81 T_PB_TYPE current_type; /* Currently selected phonebook */ | |
82 SHORT records_max; /* Total number of records available */ | |
83 SHORT records_used; /* Number of records that are in use */ | |
84 SHORT search_results; /* Number of results for last search */ | |
85 | |
86 SHORT alpha_max; /* Max size of alpha tag in bytes */ | |
87 SHORT number_max; /* Max size of phone number in bytes */ | |
88 SHORT ext_max; /* Max size of extended data in bytes */ | |
89 | |
90 SHORT* name_table; /* Index table, sorted by name. Dynamically updated. */ | |
91 SHORT* number_table; /* Index table, sorted by phone number. Dynamically updated. */ | |
92 SHORT* search_table; /* Search table, contains matching elements. Sorted by whichever field is searched. | |
93 Not dynamically updated. */ | |
94 | |
95 SHORT* in_memory; /* -1 if the record does not exist | |
96 * 0 if the record is not in RAM | |
97 * >0 - number of times record has been read */ | |
98 SHORT cache_max; /* Maximum number of records that can be stored in memory concurrently*/ | |
99 SHORT cache_size; /* Current size of the cache */ | |
100 T_PB_RECORD** cache; /* List of entries in cache */ | |
101 | |
102 T_PB_COMMAND command_id; /* Currently processing command */ | |
103 T_PB_STATUS status; /* Status of current command */ | |
104 T_PB_PARAM param; /* Parameter storage for current command */ | |
105 } | |
106 T_PB_DATA; | |
107 | |
108 | |
109 /* FUNCTION PROTOTYPES */ | |
110 T_PB_DATA* ATB_hnd_GetPbData(SHORT phonebook_id); | |
111 void ATB_hnd_SetPbData(SHORT phonebook_id, T_PB_DATA *data); | |
112 PB_RET ATB_status_Initialise(SHORT phonebook_id); | |
113 PB_RET ATB_status_WriteRec(SHORT phonebook_id); | |
114 PB_RET ATB_status_DeleteRec(SHORT phonebook_id); | |
115 | |
116 PB_RET ATB_index_Find (SHORT phonebook_id, T_PB_INDEX index_type, T_PB_RECORD *record, SHORT *new_log_index, T_PB_MATCH *match); | |
117 SHORT *ATB_index_GetTable(SHORT phonebook_id, T_PB_INDEX index_type); | |
118 SHORT ATB_index_GetPhysIndex(SHORT phonebook_id, T_PB_INDEX index_type, SHORT log_index); | |
119 SHORT ATB_index_GetLogIndex(SHORT phonebook_id, T_PB_INDEX index_type, SHORT phys_index); | |
120 void ATB_index_AddRec(SHORT phonebook_id, T_PB_INDEX index_type, SHORT phys_index, T_PB_RECORD *record, SHORT *new_log_index); | |
121 void ATB_index_RemoveRec(SHORT phonebook_id, T_PB_INDEX index_type, SHORT log_index); | |
122 | |
123 T_PB_MATCH ATB_index_Match(T_PB_RECORD *record1, T_PB_RECORD *record2, T_PB_INDEX index_type); | |
124 T_PB_COMPARE ATB_index_Compare(T_PB_RECORD *record1, T_PB_RECORD *record2, T_PB_INDEX index_type); | |
125 T_PB_MATCH ATB_alpha_Match(T_PB_ALPHA *alpha1, T_PB_ALPHA *alpha2);/*a0393213 warnings removal-return type changed from T_PB_COMPARE*/ | |
126 T_PB_COMPARE ATB_alpha_Compare(T_PB_ALPHA *Alpha_1, T_PB_ALPHA *Alpha_2); | |
127 UBYTE ATB_num_Digit(UBYTE *num, SHORT numIndex); | |
128 T_PB_MATCH ATB_num_Match(UBYTE *num1, UBYTE *num2); | |
129 T_PB_COMPARE ATB_num_Compare(UBYTE *num1, UBYTE *num2); | |
130 void ATB_mem_UpdateCache(SHORT phonebook_id, SHORT phys_index, T_PB_RECORD *record); | |
131 PB_RET ATB_mem_ReadRec(SHORT phonebook_id, T_PB_INDEX index_type, SHORT log_index, T_PB_RECORD *record); |