1 /* indx_blk.h
2  *
3  * ===========================================================================
4  *
5  *                            PUBLIC DOMAIN NOTICE
6  *               National Center for Biotechnology Information
7  *
8  *  This software/database is a "United States Government Work" under the
9  *  terms of the United States Copyright Act.  It was written as part of
10  *  the author's official duties as a United States Government employee and
11  *  thus cannot be copyrighted.  This software/database is freely available
12  *  to the public for use. The National Library of Medicine and the U.S.
13  *  Government have not placed any restriction on its use or reproduction.
14  *
15  *  Although all reasonable efforts have been taken to ensure the accuracy
16  *  and reliability of the software and data, the NLM and the U.S.
17  *  Government do not and cannot warrant the performance or results that
18  *  may be obtained by using this software or data. The NLM and the U.S.
19  *  Government disclaim all warranties, express or implied, including
20  *  warranties of performance, merchantability or fitness for any particular
21  *  purpose.
22  *
23  *  Please cite the author in any work or product based on this material.
24  *
25  * ===========================================================================
26  *
27  * File Name:  indx_blk.h
28  *
29  * Author: Karl Sirotkin, Hsiu-Chuan Chen
30  *
31  * File Description:
32  * -----------------
33  */
34 
35 #ifndef _INDEXBLOCK_
36 #define _INDEXBLOCK_
37 
38 #include "ftablock.h"
39 
40 BEGIN_NCBI_SCOPE
41 
42 struct FinfoBlk {
43     Char   str[256];                    /* the current string data */
44     Int4   line;                        /* the current line number */
45     size_t pos;                         /* the current file position */
46 };
47 
48 using FinfoBlkPtr = FinfoBlk*;
49 
50 
51 
52 
53 
54 typedef struct ind_blk_next {
55     IndexblkPtr              ibp;
56     struct ind_blk_next *next;
57 } IndBlkNext, *IndBlkNextPtr;
58 
59 CRef<objects::CDate_std> GetUpdateDate(char* ptr, Parser::ESource source);
60 
61 /**********************************************************/
62 bool        XReadFileBuf(FileBuf& fileBuf, FinfoBlkPtr finfo);
63 bool        SkipTitleBuf(FileBuf& fileBuf, FinfoBlkPtr finfo, const Char *str, Int2 len);
64 bool        SkipTitleBuf(FileBuf& fileBuf, FinfoBlkPtr finfo, const CTempString& keyword);
65 bool        FindNextEntryBuf(bool end_of_file, FileBuf& fileBuf,
66                              FinfoBlkPtr finfo, const char* str, Int2 len);
67 bool        FindNextEntryBuf(bool end_of_file, FileBuf& fileBuf,
68                              FinfoBlkPtr finfo, const CTempString& keyword);
69 
70 IndexblkPtr InitialEntry(ParserPtr pp, FinfoBlkPtr finfo);
71 bool        GetAccession(ParserPtr pp, char* str, IndexblkPtr entry, Int4 skip);
72 //bool        GetAccession(const Parser& parseInfo, const CTempString& str, IndexblkPtr entry, int skip);
73 void        CloseFiles(ParserPtr pp);
74 void        MsgSkipTitleFail(const Char *flatfile, FinfoBlkPtr finfo);
75 bool        FlatFileIndex(ParserPtr pp, void(*fun)(IndexblkPtr entry, char* offset, Int4 len));
76 void        ResetParserStruct(ParserPtr pp);
77 bool        QSIndex(ParserPtr pp, IndBlkNextPtr ibnp);
78 
79 //bool  IsValidAccessPrefix(char* acc, char** accpref);
80 
81 void  DelNoneDigitTail(char* str);
82 int  fta_if_wgs_acc(const CTempString& accession);
83 Int2  CheckSTRAND(const char* str);
84 Int2  CheckTPG(char* str);
85 Int2  CheckDIV(char* str);
86 Int4  IsNewAccessFormat(const char* acnum);
87 bool  IsSPROTAccession(const char* acc);
88 Int2  XMLCheckSTRAND(char* str);
89 Int2  XMLCheckTPG(char* str);
90 Int2  CheckNADDBJ(char* str);
91 Int2  CheckNA(char* str);
92 
93 bool CkLocusLinePos(char* offset, Parser::ESource source, LocusContPtr lcp, bool is_mga);
94 
95 const Char **GetAccArray(Parser::ESource source);
96 objects::CSeq_id::E_Choice  GetNucAccOwner(const char* accession, bool is_tpa);
97 Uint1        GetProtAccOwner(const char* acc);
98 //void    FreeParser(ParserPtr pp);
99 END_NCBI_SCOPE
100 
101 #endif
102