Blender  V2.59
Classes | Defines | Typedefs | Functions | Variables
makesrna.c File Reference
#include <float.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "MEM_guardedalloc.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_types.h"
#include "rna_internal.h"
#include <sys/stat.h>

Go to the source code of this file.

Classes

struct  RNAProcessItem

Defines

#define RNA_VERSION_DATE   "$Id: makesrna.c 37749 2011-06-23 07:50:28Z campbellbarton $"
#define TMP_EXT   ".tmp"
#define REN_IF_DIFF

Typedefs

typedef struct RNAProcessItem RNAProcessItem

Functions

static int file_older (const char *file1, const char *file2)
static int replace_if_different (char *tmpfile, const char *dep_files[])
static const char * rna_safe_id (const char *id)
static int cmp_struct (const void *a, const void *b)
static int cmp_property (const void *a, const void *b)
static int cmp_def_struct (const void *a, const void *b)
static int cmp_def_property (const void *a, const void *b)
static void rna_sortlist (ListBase *listbase, int(*cmp)(const void *, const void *))
static void rna_print_c_string (FILE *f, const char *str)
static void rna_print_data_get (FILE *f, PropertyDefRNA *dp)
static void rna_print_id_get (FILE *f, PropertyDefRNA *dp)
static char * rna_alloc_function_name (const char *structname, const char *propname, const char *type)
static StructRNArna_find_struct (const char *identifier)
static const char * rna_find_type (const char *type)
static const char * rna_find_dna_type (const char *type)
static const char * rna_type_type_name (PropertyRNA *prop)
static const char * rna_type_type (PropertyRNA *prop)
static const char * rna_type_struct (PropertyRNA *prop)
static const char * rna_parameter_type_name (PropertyRNA *parm)
static int rna_enum_bitmask (PropertyRNA *prop)
static int rna_color_quantize (PropertyRNA *prop, PropertyDefRNA *dp)
static const char * rna_function_string (void *func)
static void rna_float_print (FILE *f, float num)
static void rna_int_print (FILE *f, int num)
static char * rna_def_property_get_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
static void rna_clamp_value_range (FILE *f, PropertyRNA *prop)
static void rna_clamp_value (FILE *f, PropertyRNA *prop, int array)
static char * rna_def_property_set_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
static char * rna_def_property_length_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
static char * rna_def_property_begin_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
static char * rna_def_property_lookup_int_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc, char *nextfunc)
static char * rna_def_property_next_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
static char * rna_def_property_end_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
static void rna_set_raw_property (PropertyDefRNA *dp, PropertyRNA *prop)
static void rna_set_raw_offset (FILE *f, StructRNA *srna, PropertyRNA *prop)
static void rna_def_property_funcs (FILE *f, StructRNA *srna, PropertyDefRNA *dp)
static void rna_def_property_funcs_header (FILE *f, StructRNA *srna, PropertyDefRNA *dp)
static void rna_def_property_funcs_header_cpp (FILE *f, StructRNA *srna, PropertyDefRNA *dp)
static void rna_def_property_funcs_impl_cpp (FILE *f, StructRNA *srna, PropertyDefRNA *dp)
static void rna_def_function_funcs (FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc)
static void rna_auto_types (void)
static void rna_sort (BlenderRNA *brna)
static const char * rna_property_structname (PropertyType type)
static const char * rna_property_subtypename (PropertySubType type)
static const char * rna_property_subtype_unit (PropertySubType type)
static void rna_generate_prototypes (BlenderRNA *brna, FILE *f)
static void rna_generate_blender (BlenderRNA *brna, FILE *f)
static void rna_generate_property_prototypes (BlenderRNA *brna, StructRNA *srna, FILE *f)
static void rna_generate_parameter_prototypes (BlenderRNA *brna, StructRNA *srna, FunctionRNA *func, FILE *f)
static void rna_generate_function_prototypes (BlenderRNA *brna, StructRNA *srna, FILE *f)
static void rna_generate_static_parameter_prototypes (BlenderRNA *brna, StructRNA *srna, FunctionDefRNA *dfunc, FILE *f)
static void rna_generate_static_function_prototypes (BlenderRNA *brna, StructRNA *srna, FILE *f)
static void rna_generate_property (FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop)
static void rna_generate_struct (BlenderRNA *brna, StructRNA *srna, FILE *f)
static void rna_generate (BlenderRNA *brna, FILE *f, const char *filename, const char *api_filename)
static void rna_generate_header (BlenderRNA *brna, FILE *f)
static void rna_generate_header_cpp (BlenderRNA *brna, FILE *f)
static void make_bad_file (char *file, int line)
static int rna_preprocess (char *outfile)
static void mem_error_cb (const char *errorStr)
int main (int argc, char **argv)

Variables

const char * makesrna_path = NULL
static RNAProcessItem PROCESS_ITEMS []
static const char * cpp_classes = "\n"

Detailed Description

Definition in file makesrna.c.


Define Documentation

#define REN_IF_DIFF
Value:
{ \
                FILE *file_test= fopen(orgfile, "rb"); \
                if(file_test) { \
                        fclose(file_test); \
                        if(fp_org) fclose(fp_org); \
                        if(fp_new) fclose(fp_new); \
                        if(remove(orgfile) != 0) { \
                                fprintf(stderr, "%s:%d, Remove Error (%s): \"%s\"\n", __FILE__, __LINE__, strerror(errno), orgfile); \
                                return -1; \
                        } \
                } \
        } \
        if(rename(tmpfile, orgfile) != 0) { \
                fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", __FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \
                return -1; \
        } \
        remove(tmpfile); \
        return 1; \

Referenced by replace_if_different().

#define RNA_VERSION_DATE   "$Id: makesrna.c 37749 2011-06-23 07:50:28Z campbellbarton $"

Definition at line 45 of file makesrna.c.

Referenced by main().

#define TMP_EXT   ".tmp"

Definition at line 54 of file makesrna.c.

Referenced by replace_if_different(), and rna_preprocess().


Typedef Documentation


Function Documentation

static int cmp_def_property ( const void *  a,
const void *  b 
) [static]

Definition at line 240 of file makesrna.c.

References cmp_property(), and PropertyDefRNA::prop.

Referenced by rna_sort().

static int cmp_def_struct ( const void *  a,
const void *  b 
) [static]

Definition at line 232 of file makesrna.c.

References cmp_struct(), and StructDefRNA::srna.

Referenced by rna_sort().

static int cmp_property ( const void *  a,
const void *  b 
) [static]

Definition at line 218 of file makesrna.c.

References PropertyRNA::identifier, and PropertyRNA::name.

Referenced by cmp_def_property(), and rna_sort().

static int cmp_struct ( const void *  a,
const void *  b 
) [static]

Definition at line 210 of file makesrna.c.

References StructRNA::identifier.

Referenced by cmp_def_struct(), and rna_sort().

static int file_older ( const char *  file1,
const char *  file2 
) [static]

Definition at line 59 of file makesrna.c.

Referenced by replace_if_different().

int main ( int  argc,
char **  argv 
)
static void make_bad_file ( char *  file,
int  line 
) [static]

Definition at line 2760 of file makesrna.c.

Referenced by rna_preprocess().

static void mem_error_cb ( const char *  errorStr) [static]

Definition at line 2881 of file makesrna.c.

Referenced by main().

static int replace_if_different ( char *  tmpfile,
const char *  dep_files[] 
) [static]

Definition at line 71 of file makesrna.c.

References file_older(), L, makesrna_path, MEM_freeN(), MEM_mallocN(), NULL, REN_IF_DIFF, and TMP_EXT.

Referenced by rna_preprocess().

static char* rna_alloc_function_name ( const char *  structname,
const char *  propname,
const char *  type 
) [static]
static void rna_auto_types ( void  ) [static]
static void rna_clamp_value ( FILE *  f,
PropertyRNA prop,
int  array 
) [static]
static void rna_clamp_value_range ( FILE *  f,
PropertyRNA prop 
) [static]
static int rna_color_quantize ( PropertyRNA prop,
PropertyDefRNA dp 
) [static]
static void rna_def_function_funcs ( FILE *  f,
StructDefRNA dsrna,
FunctionDefRNA dfunc 
) [static]
static char* rna_def_property_begin_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
char *  manualfunc 
) [static]
static char* rna_def_property_end_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
char *  manualfunc 
) [static]
static void rna_def_property_funcs ( FILE *  f,
StructRNA srna,
PropertyDefRNA dp 
) [static]
static void rna_def_property_funcs_header ( FILE *  f,
StructRNA srna,
PropertyDefRNA dp 
) [static]
static void rna_def_property_funcs_header_cpp ( FILE *  f,
StructRNA srna,
PropertyDefRNA dp 
) [static]
static void rna_def_property_funcs_impl_cpp ( FILE *  f,
StructRNA srna,
PropertyDefRNA dp 
) [static]
static char* rna_def_property_get_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
const char *  manualfunc 
) [static]
static char* rna_def_property_length_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
char *  manualfunc 
) [static]
static char* rna_def_property_lookup_int_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
char *  manualfunc,
char *  nextfunc 
) [static]
static char* rna_def_property_next_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
char *  manualfunc 
) [static]
static char* rna_def_property_set_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
char *  manualfunc 
) [static]
static int rna_enum_bitmask ( PropertyRNA prop) [static]
static const char* rna_find_dna_type ( const char *  type) [static]
static StructRNA* rna_find_struct ( const char *  identifier) [static]
static const char* rna_find_type ( const char *  type) [static]
static void rna_float_print ( FILE *  f,
float  num 
) [static]

Definition at line 462 of file makesrna.c.

References FLT_MAX.

Referenced by rna_clamp_value(), and rna_generate_property().

static const char* rna_function_string ( void *  func) [static]

Definition at line 457 of file makesrna.c.

Referenced by rna_clamp_value_range(), rna_generate_property(), and rna_generate_struct().

static void rna_generate ( BlenderRNA brna,
FILE *  f,
const char *  filename,
const char *  api_filename 
) [static]
static void rna_generate_blender ( BlenderRNA brna,
FILE *  f 
) [static]

Definition at line 1869 of file makesrna.c.

References ListBase::first, StructRNA::identifier, ListBase::last, and BlenderRNA::structs.

Referenced by rna_generate().

static void rna_generate_function_prototypes ( BlenderRNA brna,
StructRNA srna,
FILE *  f 
) [static]
static void rna_generate_header ( BlenderRNA brna,
FILE *  f 
) [static]
static void rna_generate_header_cpp ( BlenderRNA brna,
FILE *  f 
) [static]
static void rna_generate_parameter_prototypes ( BlenderRNA brna,
StructRNA srna,
FunctionRNA func,
FILE *  f 
) [static]
static void rna_generate_property ( FILE *  f,
StructRNA srna,
const char *  nest,
PropertyRNA prop 
) [static]

Definition at line 2062 of file makesrna.c.

References PropertyRNA::arraydimension, PropertyRNA::arraylength, CollectionPropertyRNA::begin, BooleanPropertyRNA::defaultarray, IntPropertyRNA::defaultarray, FloatPropertyRNA::defaultarray, BooleanPropertyRNA::defaultvalue, IntPropertyRNA::defaultvalue, FloatPropertyRNA::defaultvalue, StringPropertyRNA::defaultvalue, EnumPropertyRNA::defaultvalue, DefRNA, PropertyRNA::description, EnumPropertyItem::description, PropertyRNA::editable, CollectionPropertyRNA::end, BlenderDefRNA::error, PropertyRNA::flag, BooleanPropertyRNA::get, IntPropertyRNA::get, FloatPropertyRNA::get, StringPropertyRNA::get, EnumPropertyRNA::get, PointerPropertyRNA::get, CollectionPropertyRNA::get, BooleanPropertyRNA::getarray, IntPropertyRNA::getarray, FloatPropertyRNA::getarray, PropertyRNA::getlength, IntPropertyRNA::hardmax, FloatPropertyRNA::hardmax, IntPropertyRNA::hardmin, FloatPropertyRNA::hardmin, i, PropertyRNA::icon, EnumPropertyItem::icon, PropertyRNA::identifier, EnumPropertyItem::identifier, StructRNA::identifier, EnumPropertyRNA::item, CollectionPropertyRNA::item_type, PropertyRNA::itemeditable, EnumPropertyRNA::itemf, StringPropertyRNA::length, CollectionPropertyRNA::length, CollectionPropertyRNA::lookupint, CollectionPropertyRNA::lookupstring, PropertyRNA::magic, StringPropertyRNA::maxlength, MEM_freeN(), MEM_mallocN(), PropertyRNA::name, EnumPropertyItem::name, PropertyRNA::next, CollectionPropertyRNA::next, PropertyRNA::noteflag, NULL, PointerPropertyRNA::poll, FloatPropertyRNA::precision, PropertyRNA::prev, PROP_BOOLEAN, PROP_COLLECTION, PROP_CONTEXT_UPDATE, PROP_ENUM, PROP_ENUM_FLAG, PROP_EXPORT, PROP_FLOAT, PROP_INT, PROP_POINTER, PROP_RAW_ACCESS, PROP_STRING, IntPropertyRNA::range, FloatPropertyRNA::range, rna_float_print(), rna_function_string(), rna_int_print(), rna_print_c_string(), rna_property_structname(), rna_property_subtype_unit(), rna_property_subtypename(), RNA_property_typename(), rna_set_raw_offset(), BooleanPropertyRNA::set, IntPropertyRNA::set, FloatPropertyRNA::set, StringPropertyRNA::set, EnumPropertyRNA::set, PointerPropertyRNA::set, BooleanPropertyRNA::setarray, IntPropertyRNA::setarray, FloatPropertyRNA::setarray, IntPropertyRNA::softmax, FloatPropertyRNA::softmax, IntPropertyRNA::softmin, FloatPropertyRNA::softmin, PropertyRNA::srna, IntPropertyRNA::step, FloatPropertyRNA::step, PropertyRNA::subtype, PropertyRNA::totarraylength, EnumPropertyRNA::totitem, PropertyRNA::type, PointerPropertyRNA::type, PointerPropertyRNA::typef, PropertyRNA::update, and EnumPropertyItem::value.

Referenced by rna_generate_struct().

static void rna_generate_property_prototypes ( BlenderRNA brna,
StructRNA srna,
FILE *  f 
) [static]
static void rna_generate_prototypes ( BlenderRNA brna,
FILE *  f 
) [static]
static void rna_generate_static_function_prototypes ( BlenderRNA brna,
StructRNA srna,
FILE *  f 
) [static]
static void rna_generate_static_parameter_prototypes ( BlenderRNA brna,
StructRNA srna,
FunctionDefRNA dfunc,
FILE *  f 
) [static]
static void rna_generate_struct ( BlenderRNA brna,
StructRNA srna,
FILE *  f 
) [static]
static void rna_int_print ( FILE *  f,
int  num 
) [static]
static const char* rna_parameter_type_name ( PropertyRNA parm) [static]
static int rna_preprocess ( char *  outfile) [static]
static void rna_print_c_string ( FILE *  f,
const char *  str 
) [static]

Definition at line 278 of file makesrna.c.

References i, and NULL.

Referenced by rna_generate_property(), and rna_generate_struct().

static void rna_print_data_get ( FILE *  f,
PropertyDefRNA dp 
) [static]
static void rna_print_id_get ( FILE *  f,
PropertyDefRNA dp 
) [static]

Definition at line 308 of file makesrna.c.

Referenced by rna_def_property_set_func().

static const char* rna_property_structname ( PropertyType  type) [static]
static const char* rna_property_subtype_unit ( PropertySubType  type) [static]
static const char* rna_property_subtypename ( PropertySubType  type) [static]
static const char* rna_safe_id ( const char *  id) [static]
static void rna_set_raw_offset ( FILE *  f,
StructRNA srna,
PropertyRNA prop 
) [static]
static void rna_set_raw_property ( PropertyDefRNA dp,
PropertyRNA prop 
) [static]
static void rna_sort ( BlenderRNA brna) [static]
static void rna_sortlist ( ListBase listbase,
int(*)(const void *, const void *)  cmp 
) [static]
static const char* rna_type_struct ( PropertyRNA prop) [static]

Definition at line 396 of file makesrna.c.

References rna_type_type_name().

Referenced by rna_def_function_funcs(), and rna_generate_static_parameter_prototypes().

static const char* rna_type_type ( PropertyRNA prop) [static]

Definition at line 384 of file makesrna.c.

References rna_type_type_name().

Referenced by rna_def_property_get_func(), and rna_def_property_set_func().

static const char* rna_type_type_name ( PropertyRNA prop) [static]

Variable Documentation

const char* cpp_classes = "\n" [static]

Definition at line 2596 of file makesrna.c.

const char* makesrna_path = NULL

Definition at line 69 of file makesrna.c.

Referenced by main(), and replace_if_different().

Definition at line 2417 of file makesrna.c.