Blender V2.61 - r43446
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   "FIXME-RNA_VERSION_DATE"
#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, const char *manualfunc)
static char * rna_def_property_length_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
static char * rna_def_property_begin_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
static char * rna_def_property_lookup_int_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *nextfunc)
static char * rna_def_property_next_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
static char * rna_def_property_end_func (FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const 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 (const char *file, int line)
static int rna_preprocess (const char *outfile)
static void mem_error_cb (const char *errorStr)
int main (int argc, char **argv)

Variables

static 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   "FIXME-RNA_VERSION_DATE"

Definition at line 43 of file makesrna.c.

Referenced by main().

#define TMP_EXT   ".tmp"

Definition at line 57 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 246 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 238 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 224 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 216 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 62 of file makesrna.c.

Referenced by replace_if_different().

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

Definition at line 2820 of file makesrna.c.

Referenced by rna_preprocess().

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

Definition at line 2941 of file makesrna.c.

Referenced by main().

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

Definition at line 74 of file makesrna.c.

References file_older(), L, makesrna_path, MEM_freeN(), MEM_mallocN(), NULL, REN_IF_DIFF, strlen(), 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,
const char *  manualfunc 
) [static]
static char* rna_def_property_end_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
const 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,
const char *  manualfunc 
) [static]
static char* rna_def_property_lookup_int_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
const char *  manualfunc,
const char *  nextfunc 
) [static]
static char* rna_def_property_next_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
const char *  manualfunc 
) [static]
static char* rna_def_property_set_func ( FILE *  f,
StructRNA srna,
PropertyRNA prop,
PropertyDefRNA dp,
const 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 466 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 461 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 1907 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 2106 of file makesrna.c.

References PropertyRNA::arraydimension, PropertyRNA::arraylength, CollectionPropertyRNA::assignint, CollectionPropertyRNA::begin, BoolPropertyRNA::defaultarray, IntPropertyRNA::defaultarray, FloatPropertyRNA::defaultarray, FloatPropertyRNA::defaultvalue, EnumPropertyRNA::defaultvalue, IntPropertyRNA::defaultvalue, StringPropertyRNA::defaultvalue, BoolPropertyRNA::defaultvalue, DefRNA, PropertyRNA::description, EnumPropertyItem::description, PropertyRNA::editable, CollectionPropertyRNA::end, BlenderDefRNA::error, PropertyRNA::flag, IntPropertyRNA::get, PointerPropertyRNA::get, BoolPropertyRNA::get, CollectionPropertyRNA::get, EnumPropertyRNA::get, FloatPropertyRNA::get, StringPropertyRNA::get, BoolPropertyRNA::getarray, FloatPropertyRNA::getarray, IntPropertyRNA::getarray, PropertyRNA::getlength, IntPropertyRNA::hardmax, FloatPropertyRNA::hardmax, FloatPropertyRNA::hardmin, IntPropertyRNA::hardmin, i, PropertyRNA::icon, EnumPropertyItem::icon, StructRNA::identifier, PropertyRNA::identifier, EnumPropertyItem::identifier, EnumPropertyRNA::item, CollectionPropertyRNA::item_type, PropertyRNA::itemeditable, EnumPropertyRNA::itemf, len(), CollectionPropertyRNA::length, StringPropertyRNA::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, FloatPropertyRNA::range, IntPropertyRNA::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(), PointerPropertyRNA::set, BoolPropertyRNA::set, EnumPropertyRNA::set, FloatPropertyRNA::set, IntPropertyRNA::set, StringPropertyRNA::set, FloatPropertyRNA::setarray, IntPropertyRNA::setarray, BoolPropertyRNA::setarray, IntPropertyRNA::softmax, FloatPropertyRNA::softmax, FloatPropertyRNA::softmin, IntPropertyRNA::softmin, PropertyRNA::srna, FloatPropertyRNA::step, IntPropertyRNA::step, strlen(), PropertyRNA::subtype, PropertyRNA::totarraylength, EnumPropertyRNA::totitem, PropertyRNA::translation_context, PointerPropertyRNA::type, PropertyRNA::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 ( const char *  outfile) [static]
static void rna_print_c_string ( FILE *  f,
const char *  str 
) [static]

Definition at line 284 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 314 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 402 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 390 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 2649 of file makesrna.c.

const char* makesrna_path = NULL [static]

Definition at line 72 of file makesrna.c.

Referenced by main(), and replace_if_different().

Definition at line 2466 of file makesrna.c.