1 /* @include ajtextdata ******************************************************** 2 ** 3 ** AJAX TEXT data structures 4 ** 5 ** @author Copyright (C) 2010 Peter Rice 6 ** @version $Revision: 1.16 $ 7 ** @modified Oct 5 pmr First version 8 ** @modified $Date: 2013/07/15 20:56:40 $ by $Author: rice $ 9 ** @@ 10 ** 11 ** This library is free software; you can redistribute it and/or 12 ** modify it under the terms of the GNU Lesser General Public 13 ** License as published by the Free Software Foundation; either 14 ** version 2.1 of the License, or (at your option) any later version. 15 ** 16 ** This library is distributed in the hope that it will be useful, 17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 ** Lesser General Public License for more details. 20 ** 21 ** You should have received a copy of the GNU Lesser General Public 22 ** License along with this library; if not, write to the Free Software 23 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 24 ** MA 02110-1301, USA. 25 ** 26 ******************************************************************************/ 27 28 #ifndef AJTEXTDATA_H 29 #define AJTEXTDATA_H 30 31 /* ========================================================================= */ 32 /* ============================= include files ============================= */ 33 /* ========================================================================= */ 34 35 #include "ajdefine.h" 36 #include "ajfile.h" 37 #include "ajquerydata.h" 38 39 AJ_BEGIN_DECLS 40 41 42 43 44 /* ========================================================================= */ 45 /* =============================== constants =============================== */ 46 /* ========================================================================= */ 47 48 49 50 51 /* ========================================================================= */ 52 /* ============================== public data ============================== */ 53 /* ========================================================================= */ 54 55 56 57 58 /* @enum AjETextqryType ******************************************************* 59 ** 60 ** Enumerated text query type 61 ** 62 ** @value TEXTQRY_UNKNOWN Unknown 63 ** @value TEXTQRY_ENTRY Single entry 64 ** @value TEXTQRY_QUERY Query 65 ** @value TEXTQRY_ALL All entries 66 ******************************************************************************/ 67 68 typedef enum AjOTextqryType 69 { 70 TEXTQRY_UNKNOWN, 71 TEXTQRY_ENTRY, 72 TEXTQRY_QUERY, 73 TEXTQRY_ALL 74 } AjETextqryType; 75 76 77 78 79 /* @enum AjETextqryLink ******************************************************* 80 ** 81 ** Text query link operators 82 ** 83 ** @value TEXTQRY_INIT Undefined 84 ** @value TEXTQRY_OR Current OR next 85 ** @value TEXTQRY_AND Current AND next 86 ** @value TEXTQRY_NOT Current but NOT next 87 ** @value TEXTQRY_EOR Current EOR next 88 ** @value TEXTQRY_MAX Beyond last defined value 89 ******************************************************************************/ 90 91 typedef enum AjOTextqryLink 92 { 93 TEXTQRY_INIT, 94 TEXTQRY_OR, 95 TEXTQRY_AND, 96 TEXTQRY_NOT, 97 TEXTQRY_EOR, 98 TEXTQRY_MAX 99 } AjETextqryLink; 100 101 102 103 104 /* @data AjPText ************************************************************** 105 ** 106 ** Ajax Text data object. 107 ** 108 ** Holds the input specification and information needed to read 109 ** the entry text and possible further entries 110 ** 111 ** @alias AjSText 112 ** @alias AjOText 113 ** 114 ** @attr Id [AjPStr] Id of text item 115 ** @attr Db [AjPStr] Database name from input 116 ** @attr Setdb [AjPStr] Database name from command line 117 ** @attr Full [AjPStr] Full name 118 ** @attr Qry [AjPStr] Query for re-reading 119 ** @attr Formatstr [AjPStr] Input format name 120 ** @attr Filename [AjPStr] Original filename 121 ** @attr Lines [AjPList] Lines of input data 122 ** @attr Fpos [ajlong] File position 123 ** @attr Format [AjEnum] Input format enum 124 ** @attr Count [ajuint] Number of lines read 125 ** @@ 126 ******************************************************************************/ 127 128 typedef struct AjSText 129 { 130 AjPStr Id; 131 AjPStr Db; 132 AjPStr Setdb; 133 AjPStr Full; 134 AjPStr Qry; 135 AjPStr Formatstr; 136 AjPStr Filename; 137 AjPList Lines; 138 ajlong Fpos; 139 AjEnum Format; 140 ajuint Count; 141 } AjOText; 142 143 #define AjPText AjOText* 144 145 146 147 148 /* @data AjPTextin ************************************************************ 149 ** 150 ** Ajax Text Input object. 151 ** 152 ** Holds the input specification and information needed to read 153 ** the entry text and possible further entries 154 ** 155 ** @alias AjSTextin 156 ** @alias AjOTextin 157 ** 158 ** @attr Db [AjPStr] Database name (from commandline, replace on reading) 159 ** @attr Qry [AjPStr] Querystring for the entry 160 ** @attr Formatstr [AjPStr] Input format name 161 ** @attr QryFields [AjPStr] Query fields or ID list 162 ** @attr Filename [AjPStr] Original filename 163 ** @attr List [AjPList] List of USAs to be read 164 ** @attr Filebuff [AjPFilebuff] Input buffered file 165 ** @attr Fpos [ajlong] Initial file position (fseek) for building USA 166 ** @attr Curpos [ajlong] Current file position (fseek) for latest read 167 ** @attr Query [AjPQuery] Query data 168 ** @attr TextData [void*] Format data for reuse, e.g. multiple entry input 169 ** @attr Search [AjBool] Search for more entries (always true?) 170 ** @attr Single [AjBool] Read single entries 171 ** @attr Multi [AjBool] Multiple entry input 172 ** @attr CaseId [AjBool] Id case sensitive (default false) 173 ** @attr Text [AjBool] true: save full text of entry 174 ** @attr ChunkEntries [AjBool] true: access method returns entries in chunks 175 ** and should be called again when input is empty 176 ** @attr Dataread [AjBool] true: input through a loader has started to read 177 ** @attr Datadone [AjBool] true: input through a loader has read everything 178 ** @attr Count [ajuint] count of entries so far. Used when ACD reads first 179 ** entry and we need to reuse it in a Next loop 180 ** @attr Filecount [ajuint] Number of files read 181 ** @attr Entrycount [ajuint] Number of entries in file 182 ** @attr Datacount [ajuint] Number of data values read in current entry 183 ** @attr Records [ajuint] Records processed 184 ** @attr TotRecords [ajuint] Records processed 185 ** @attr Format [AjEnum] Text input format enum 186 ** @attr TextFormat [AjEnum] Text input format enum 187 ** @@ 188 ******************************************************************************/ 189 190 typedef struct AjSTextin 191 { 192 AjPStr Db; 193 AjPStr Qry; 194 AjPStr Formatstr; 195 AjPStr QryFields; 196 AjPStr Filename; 197 AjPList List; 198 AjPFilebuff Filebuff; 199 ajlong Fpos; 200 ajlong Curpos; 201 AjPQuery Query; 202 void *TextData; 203 AjBool Search; 204 AjBool Single; 205 AjBool Multi; 206 AjBool CaseId; 207 AjBool Text; 208 AjBool ChunkEntries; 209 AjBool Dataread; 210 AjBool Datadone; 211 ajuint Count; 212 ajuint Filecount; 213 ajuint Entrycount; 214 ajuint Datacount; 215 ajuint Records; 216 ajuint TotRecords; 217 AjEnum Format; 218 AjEnum TextFormat; 219 } AjOTextin; 220 221 #define AjPTextin AjOTextin* 222 223 224 225 226 /* @data AjPTextall *********************************************************** 227 ** 228 ** Ajax text data all (stream) object. 229 ** 230 ** Inherits an AjPText but allows more text blocks to be read from the 231 ** same input by also inheriting the AjPTextin input object. 232 ** 233 ** @alias AjSTextall 234 ** @alias AjOTextall 235 ** 236 ** @attr Text [AjPText] Current text block 237 ** @attr Textin [AjPTextin] Text input for reading next 238 ** @attr Totterms [ajulong] Count of terms so far 239 ** @attr Count [ajuint] Count of terms so far 240 ** @attr Multi [AjBool] True if multiple values are expected 241 ** @attr Returned [AjBool] if true: Text object has been returned to a new owner 242 ** and is not to be deleted by the destructor 243 ** @attr Padding [char[4]] Padding to alignment boundary 244 ** @@ 245 ******************************************************************************/ 246 247 typedef struct AjSTextall 248 { 249 AjPText Text; 250 AjPTextin Textin; 251 ajulong Totterms; 252 ajuint Count; 253 AjBool Multi; 254 AjBool Returned; 255 char Padding[4]; 256 } AjOTextall; 257 258 #define AjPTextall AjOTextall* 259 260 261 262 263 /* @data AjPTextAccess ******************************************************** 264 ** 265 ** Ajax Text Access database reading object. 266 ** 267 ** Holds information needed to read a text entry from a database. 268 ** Access methods are defined for each known database type. 269 ** 270 ** Text entries are read from the database using the defined 271 ** database access function, which is usually a static function 272 ** within ajtextdb.c 273 ** 274 ** This should be a static data object but is needed for the definition 275 ** of AjPTextin. 276 ** 277 ** @alias AjSTextAccess 278 ** @alias AjOTextAccess 279 ** 280 ** @attr Name [const char*] Access method name used in emboss.default 281 ** @attr Access [AjBool function] Access function 282 ** @attr AccessFree [AjBool function] Access cleanup function 283 ** @attr Qlink [const char*] Supported query link operators 284 ** @attr Desc [const char*] Description 285 ** @attr Alias [AjBool] Alias for another name 286 ** @attr Entry [AjBool] Supports retrieval of single entries 287 ** @attr Query [AjBool] Supports retrieval of selected entries 288 ** @attr All [AjBool] Supports retrieval of all entries 289 ** @attr Chunked [AjBool] Supports retrieval of entries in chunks 290 ** @attr Padding [ajuint] Padding to alignment boundary 291 ** @@ 292 ******************************************************************************/ 293 294 typedef struct AjSTextAccess 295 { 296 const char *Name; 297 AjBool (*Access)(AjPTextin textin); 298 AjBool (*AccessFree)(void* qry); 299 const char* Qlink; 300 const char* Desc; 301 AjBool Alias; 302 AjBool Entry; 303 AjBool Query; 304 AjBool All; 305 AjBool Chunked; 306 ajuint Padding; 307 } AjOTextAccess; 308 309 #define AjPTextAccess AjOTextAccess* 310 311 312 313 314 /* ========================================================================= */ 315 /* =========================== public functions ============================ */ 316 /* ========================================================================= */ 317 318 319 320 321 /* 322 ** Prototype definitions 323 */ 324 325 /* 326 ** End of prototype definitions 327 */ 328 329 330 331 332 AJ_END_DECLS 333 334 #endif /* !AJTEXTDATA_H */ 335