1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 /** \file
18  * \ingroup DNA
19  */
20 
21 #pragma once
22 
23 struct GHash;
24 struct MemArena;
25 
26 int DNA_elem_array_size(const char *str);
27 
28 uint DNA_elem_id_offset_start(const char *elem_full);
29 uint DNA_elem_id_offset_end(const char *elem_full);
30 uint DNA_elem_id_strip_copy(char *elem_dst, const char *elem_src);
31 uint DNA_elem_id_strip(char *elem);
32 bool DNA_elem_id_match(const char *elem_search,
33                        const int elem_search_len,
34                        const char *elem_full,
35                        uint *r_elem_full_offset);
36 char *DNA_elem_id_rename(struct MemArena *mem_arena,
37                          const char *elem_src,
38                          const int elem_src_len,
39                          const char *elem_dst,
40                          const int elem_dst_len,
41                          const char *elem_src_full,
42                          const int elem_src_full_len,
43                          const uint elem_src_full_offset_len);
44 
45 /* When requesting version info, support both directions. */
46 enum eDNA_RenameDir {
47   DNA_RENAME_STATIC_FROM_ALIAS = -1,
48   DNA_RENAME_ALIAS_FROM_STATIC = 1,
49 };
50 void DNA_alias_maps(enum eDNA_RenameDir version_dir,
51                     struct GHash **r_struct_map,
52                     struct GHash **r_elem_map);
53 
54 const char *DNA_struct_rename_legacy_hack_alias_from_static(const char *name);
55 const char *DNA_struct_rename_legacy_hack_static_from_alias(const char *name);
56