1 /*
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name: findrepl.h
27 *
28 * Author:  Jonathan Kans, Tim Ford
29 *
30 * Version Creation Date:   10/17/00
31 *
32 * File Description:
33 *   Complete redesign of find/replace from original of Yuri Sadykov
34 *
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date     Name        Description of modification
39 * -------  ----------  -----------------------------------------------------
40 *
41 * ==========================================================================
42 *
43 *
44 */
45 
46 #ifndef __FINDREPL_H__
47 #define __FINDREPL_H__
48 
49 #include <ncbi.h>
50 
51 #undef NLM_EXTERN
52 #ifdef NLM_IMPORT
53 #define NLM_EXTERN NLM_IMPORT
54 #else
55 #define NLM_EXTERN extern
56 #endif
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif	/* __cplusplus */
61 
62 
63 /*** defines for send_update parameter below ***/
64 
65 #define UPDATE_NEVER 0  /* never send ObjMgrMessage (OM_MSG_UPDATE... */
66 #define UPDATE_EACH  1  /* send it on each replace */
67 #define UPDATE_ONCE  2  /* send once for whole entityID, if any replacements occur */
68 
69 typedef void (*FindReplProc) (Uint2 entityID, Uint4 itemID, Uint2 itemtype, Pointer userdata);
70 
71 typedef void (*StringActionFunc) (CharPtr PNTR strp, Pointer userdata, BoolPtr did_find, BoolPtr did_change);
72 /* EXTERNAL FIND-REPLACE FUNCTIONS */
73 NLM_EXTERN void StringActionInEntity (
74   Uint2 entityID,
75   Boolean select_item,
76   Int2 send_update,
77   BoolPtr descFilter,
78   BoolPtr featFilter,
79   BoolPtr seqidFilter,
80   Boolean do_seqid_local,
81   StringActionFunc action_func,
82   FindReplProc callback,
83   Pointer userdata
84 );
85 
86 NLM_EXTERN void StringActionForObject (
87   Uint2   datatype,
88   Pointer objdata,
89   Uint2 entityID,
90   Boolean select_item,
91   Int2 send_update,
92   StringActionFunc action_func,
93   FindReplProc callback,
94   Pointer userdata
95 );
96 
97 NLM_EXTERN void SpecialCharReplace (CharPtr PNTR strp, Pointer userdata, BoolPtr did_find, BoolPtr did_change);
98 NLM_EXTERN void SpecialCharFind (CharPtr PNTR strp, Pointer userdata, BoolPtr did_find, BoolPtr did_change);
99 NLM_EXTERN CharPtr GetSpecialCharacterReplacement (unsigned char ch);
100 NLM_EXTERN CharPtr GetSpecialWinCharacterReplacement (unsigned char ch);
101 NLM_EXTERN CharPtr GetSpecialMacCharacterReplacement (unsigned char ch);
102 
103 NLM_EXTERN void FindReplaceInEntity (
104   Uint2 entityID,
105   CharPtr find_string,
106   CharPtr replace_string,
107   Boolean case_counts,
108   Boolean whole_word,
109   Boolean do_replace,
110   Boolean select_item,
111   Int2 send_update,
112   BoolPtr descFilter,
113   BoolPtr featFilter,
114   BoolPtr seqidFilter,
115   Boolean do_seqid_local,
116   FindReplProc callback,
117   Pointer userdata
118 );
119 
120 NLM_EXTERN void FindReplaceString (
121   CharPtr PNTR strp,
122   CharPtr find_string,
123   CharPtr replace_string,
124   Boolean case_counts,
125   Boolean whole_word
126 );
127 
128 NLM_EXTERN void FindStringsInEntity (
129   Uint2 entityID,
130   CharPtr PNTR find_strings,
131   Boolean case_counts,
132   Boolean whole_word,
133   Boolean select_item,
134   Int2 send_update,
135   BoolPtr descFilter,
136   BoolPtr featFilter,
137   BoolPtr seqidFilter,
138   Boolean do_seqid_local,
139   FindReplProc callback,
140   Pointer userdata
141 );
142 
143 
144 extern void RemoveTaxRef (OrgRefPtr orp);
145 
146 
147 #ifdef __cplusplus
148 extern "C" }
149 #endif	/* __cplusplus */
150 
151 #undef NLM_EXTERN
152 #ifdef NLM_EXPORT
153 #define NLM_EXTERN NLM_EXPORT
154 #else
155 #define NLM_EXTERN
156 #endif
157 
158 #endif	/* __FINDREPL_H__ */
159