|
Blender V5.3
|
Struct parser for generating SDNA. More...
#include <algorithm>#include <cctype>#include <climits>#include <cstdio>#include <cstdlib>#include <cstring>#include "BLI_set.hh"#include "BLI_string_ref.hh"#include "BLI_sys_types.hh"#include "BLI_system.hh"#include "BLI_utildefines.hh"#include "BLI_vector.hh"#include "BLI_vector_set.hh"#include "DNA_genfile.h"#include "DNA_sdna_types.h"#include "dna_parse.h"#include "dna_utils.h"#include "dna_includes_all.h"#include "dna_rename_defs.h"Go to the source code of this file.
Classes | |
| struct | blender::TypeInfo |
| struct | blender::TypeTable |
| class | blender::TypeTable::GetIDFn |
Namespaces | |
| namespace | blender |
| BMesh Iterators. | |
Macros | |
| #define | DNA_DEPRECATED_ALLOW |
| #define | FORCE_ALIGN_4 " " |
| #define | DNA_STRUCT_RENAME(old, new) |
| #define | DNA_STRUCT_RENAME_MEMBER(new_struct_name, old, new) |
Functions | |
| int | main (int argc, char **argv) |
Type Table | |
| static TypeTable | blender::build_type_table (const Span< dna::ParsedStruct > parsed_structs) |
Type Sizes and Alignment | |
| static int | blender::member_size_native (const TypeInfo &member_type, const dna::ParsedMember &parsed_member) |
| static bool | blender::check_member_alignment (const TypeInfo &struct_info, const TypeInfo &member_type, const int len, const int member_align_override, const StringRefNull name, const StringRefNull detail) |
| static int | blender::compute_type_size_and_alignment (TypeTable &table, Span< dna::ParsedStruct > parsed_structs) |
DNA File Writing | |
| static void | blender::dna_write (FILE *file, const void *pntr, const int size) |
| static void | blender::write_sdna_blob (FILE *file, const TypeTable &table, const Span< dna::ParsedStruct > parsed_structs) |
Auxiliary files | |
| static void | blender::write_sdna_type_offsets (FILE *file, const Span< dna::ParsedStruct > parsed_structs) |
| static void | blender::write_sdna_struct_ids (FILE *file, const Span< dna::ParsedStruct > parsed_structs) |
| static void | blender::write_rna_defaults (FILE *file, const StringRefNull base_directory, const Span< dna::ParsedStruct > parsed_structs) |
| static void | blender::write_sdna_verify (FILE *file, const TypeTable &table, const Span< dna::ParsedStruct > parsed_structs, const StringRefNull base_directory) |
Renaming | |
Apply struct/member renames from dna_rename_defs.h. | |
| static bool | blender::apply_renames (Vector< dna::ParsedStruct > &parsed_structs) |
Make DNA | |
Parse header files to generate SDNA blob and auxiliary files. | |
| static bool | blender::make_structDNA (const StringRefNull base_directory, FILE *file, FILE *file_offsets, FILE *file_verify, FILE *file_ids, FILE *file_defaults) |
Variables | |
| static Span< const char * > | blender::includefiles = dna::default_dna_header_filenames() |
Debugging | |
| #define | DEBUG_PRINTF(debug_level, ...) |
| void | blender::BLI_system_backtrace (FILE *fp) |
Main Function | |
| #define | BASE_HEADER "../" |
| static void | blender::make_bad_file (const StringRefNull filename, int line) |
| static void | blender::print_usage (const char *argv0) |
Struct parser for generating SDNA.
makesdna creates a .c file with a long string of numbers that encode the Blender file format. It is fast, because it is basically a binary dump. There are some details to mind when reconstructing the file (endianness and byte-alignment).
This little program scans all structs that need to be serialized, and determined the names and types of all members. It calculates how much memory (on disk or in ram) is needed to store that struct, and the offsets for reaching a particular one.
There is a facility to get verbose output from sdna. Search for debugSDNA. This int can be set to 0 (no output) to some int. Higher numbers give more output.
Definition in file makesdna.cc.
| #define BASE_HEADER "../" |
Definition at line 939 of file makesdna.cc.
Referenced by main().
| #define DEBUG_PRINTF | ( | debug_level, | |
| ... ) |
Definition at line 71 of file makesdna.cc.
| #define DNA_DEPRECATED_ALLOW |
Definition at line 28 of file makesdna.cc.
| #define DNA_STRUCT_RENAME | ( | old, | |
| new ) |
| #define DNA_STRUCT_RENAME_MEMBER | ( | new_struct_name, | |
| old, | |||
| new ) |
| #define FORCE_ALIGN_4 " " |
Referenced by main().
| int main | ( | int | argc, |
| char ** | argv ) |
Definition at line 953 of file makesdna.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BASE_HEADER, blender::Vector< T, InlineBufferCapacity, Allocator >::data(), ELEM, FORCE_ALIGN_4, blender::includefiles, blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), main, blender::make_bad_file(), blender::make_structDNA(), blender::print_usage(), printf, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), Span< T >::Span(), and STREQ.