Blender  V2.93
Macros
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_assert.h"
#include "BLI_ghash.h"
#include "BLI_sys_types.h"
#include "BLI_utildefines.h"
#include "BLI_memarena.h"
#include "dna_utils.h"
#include "dna_rename_defs.h"

Go to the source code of this file.

Macros

#define DNA_STRUCT_RENAME(old, new)   {#old, #new},
 
#define DNA_STRUCT_RENAME_ELEM(struct_name, old, new)
 
#define DNA_STRUCT_RENAME(old, new)
 
#define DNA_STRUCT_RENAME_ELEM(struct_name, old, new)   {#struct_name, #old, #new},
 

Functions

Struct Member Evaluation
int DNA_elem_array_size (const char *str)
 
Struct Member Manipulation
static bool is_identifier (const char c)
 
uint DNA_elem_id_offset_start (const char *elem_full)
 
uint DNA_elem_id_offset_end (const char *elem_full)
 
uint DNA_elem_id_strip_copy (char *elem_dst, const char *elem_src)
 
uint DNA_elem_id_strip (char *elem)
 
bool DNA_elem_id_match (const char *elem_search, const int elem_search_len, const char *elem_full, uint *r_elem_full_offset)
 
char * DNA_elem_id_rename (struct MemArena *mem_arena, const char *elem_src, const int elem_src_len, const char *elem_dst, const int elem_dst_len, const char *elem_src_full, const int elem_src_full_len, const uint elem_src_full_offset_len)
 
Versioning
static uint strhash_pair_p (const void *ptr)
 
static bool strhash_pair_cmp (const void *a, const void *b)
 
void DNA_alias_maps (enum eDNA_RenameDir version_dir, GHash **r_struct_map, GHash **r_elem_map)
 
Struct Name Legacy Hack
const char * DNA_struct_rename_legacy_hack_static_from_alias (const char *name)
 
const char * DNA_struct_rename_legacy_hack_alias_from_static (const char *name)
 

Detailed Description

Utilities for stand-alone makesdna.c and Blender to share.

Definition in file dna_utils.c.

Macro Definition Documentation

◆ DNA_STRUCT_RENAME [1/2]

#define DNA_STRUCT_RENAME (   old,
  new 
)    {#old, #new},

◆ DNA_STRUCT_RENAME [2/2]

#define DNA_STRUCT_RENAME (   old,
  new 
)

◆ DNA_STRUCT_RENAME_ELEM [1/2]

#define DNA_STRUCT_RENAME_ELEM (   struct_name,
  old,
  new 
)

◆ DNA_STRUCT_RENAME_ELEM [2/2]

#define DNA_STRUCT_RENAME_ELEM (   struct_name,
  old,
  new 
)    {#struct_name, #old, #new},

Function Documentation

◆ DNA_alias_maps()

void DNA_alias_maps ( enum eDNA_RenameDir  version_dir,
GHash **  r_struct_map,
GHash **  r_elem_map 
)

◆ DNA_elem_array_size()

int DNA_elem_array_size ( const char *  str)

Parses the [n1][n2]... on the end of an array name and returns the number of array elements n1 * n2 ....

Definition at line 46 of file dna_utils.c.

References Freestyle::c, result, and str.

Referenced by calculate_struct_sizes(), init_structDNA(), and rna_find_sdna_member().

◆ DNA_elem_id_match()

bool DNA_elem_id_match ( const char *  elem_search,
const int  elem_search_len,
const char *  elem_full,
uint r_elem_full_offset 
)

Check if 'var' matches '*var[3]' for eg, return true if it does, with start/end offsets.

Definition at line 136 of file dna_utils.c.

References BLI_assert, Freestyle::c, DNA_elem_id_offset_start(), and is_identifier().

Referenced by DNA_sdna_patch_struct_member_nr().

◆ DNA_elem_id_offset_end()

uint DNA_elem_id_offset_end ( const char *  elem_full)

Definition at line 100 of file dna_utils.c.

References is_identifier().

Referenced by DNA_elem_id_strip(), and DNA_elem_id_strip_copy().

◆ DNA_elem_id_offset_start()

uint DNA_elem_id_offset_start ( const char *  elem_full)

◆ DNA_elem_id_rename()

char* DNA_elem_id_rename ( struct MemArena mem_arena,
const char *  elem_src,
const int  elem_src_len,
const char *  elem_dst,
const int  elem_dst_len,
const char *  elem_src_full,
const int  elem_src_full_len,
const uint  elem_src_full_offset_len 
)

◆ DNA_elem_id_strip()

uint DNA_elem_id_strip ( char *  elem)

Definition at line 122 of file dna_utils.c.

References DNA_elem_id_offset_end(), DNA_elem_id_offset_start(), and elem_offset().

Referenced by make_structDNA().

◆ DNA_elem_id_strip_copy()

uint DNA_elem_id_strip_copy ( char *  elem_dst,
const char *  elem_src 
)

elem_dst must be at least the size of elem_src.

Definition at line 112 of file dna_utils.c.

References DNA_elem_id_offset_end(), and DNA_elem_id_offset_start().

Referenced by calculate_struct_sizes(), dna_sdna_alias_from_static_elem_full(), is_name_legal(), and version_elem_static_from_alias().

◆ DNA_struct_rename_legacy_hack_alias_from_static()

const char* DNA_struct_rename_legacy_hack_alias_from_static ( const char *  name)

Definition at line 327 of file dna_utils.c.

References STREQ.

Referenced by DNA_sdna_alias_data_ensure().

◆ DNA_struct_rename_legacy_hack_static_from_alias()

const char* DNA_struct_rename_legacy_hack_static_from_alias ( const char *  name)

DNA Compatibility Hack

Only keep this for compatibility: NEVER ADD NEW STRINGS HERE.

The renaming here isn't complete, references to the old struct names are still included in DNA, now fixing these struct names properly breaks forward compatibility. Leave these as-is, but don't add to them! See D4342#98780

Definition at line 311 of file dna_utils.c.

References STREQ.

Referenced by DNA_struct_find_nr_wrapper(), and init_structDNA().

◆ is_identifier()

static bool is_identifier ( const char  c)
static

Definition at line 85 of file dna_utils.c.

References Freestyle::c.

Referenced by DNA_elem_id_match(), DNA_elem_id_offset_end(), and DNA_elem_id_offset_start().

◆ strhash_pair_cmp()

static bool strhash_pair_cmp ( const void *  a,
const void *  b 
)
static

Definition at line 203 of file dna_utils.c.

References Freestyle::a, and STREQ.

Referenced by DNA_alias_maps().

◆ strhash_pair_p()

static uint strhash_pair_p ( const void *  ptr)
static

Definition at line 197 of file dna_utils.c.

References BLI_ghashutil_strhash_p(), and ptr.

Referenced by DNA_alias_maps().