define_instantiation_functions.h

Go to the documentation of this file.
00001 /*  
00002  *      define_instantiation_functions.h - macros for making instantiating declarations
00003  *                                  for MAXScript functions
00004  *
00005  *  This will typically be used along with protocol definition files in 
00006  *  distinguished Value subclasses that will host the static instantiation
00007  *  of MAXScript function objects.
00008  *
00009  *  see def_abstract_functions.h for more info.
00010  *
00011  *  
00012  *  Copyright � John Wainwright 1996
00013  *
00014  */
00015 /* def_generic macro for instantiation declarations */
00016 
00017 #include "..\foundation\functions.h"
00018 
00019 #ifdef def_generic
00020 #   undef def_generic
00021 #   undef def_node_generic
00022 #   undef def_mapped_generic
00023 #   undef def_visible_generic
00024 #   undef def_struct_generic
00025 #   undef def_generic_debug_ok
00026 #   undef def_node_generic_debug_ok
00027 #   undef def_mapped_generic_debug_ok
00028 #   undef def_visible_generic_debug_ok
00029 #   undef def_struct_generic_debug_ok
00030 #   undef use_generic
00031 #   undef def_primitive
00032 #   undef def_mapped_primitive
00033 #   undef def_lazy_primitive
00034 #   undef def_visible_lazy_primitive
00035 #   undef def_visible_primitive
00036 #   undef def_struct_primitive
00037 #   undef def_primitive_debug_ok
00038 #   undef def_mapped_primitive_debug_ok
00039 #   undef def_lazy_primitive_debug_ok
00040 #   undef def_visible_lazy_primitive_debug_ok
00041 #   undef def_visible_primitive_debug_ok
00042 #   undef def_struct_primitive_debug_ok
00043 #   undef def_property
00044 #   undef def_property_alias
00045 #   undef def_2_prop_path
00046 #   undef def_2_prop_path_alias
00047 #   undef def_nested_prop
00048 #   undef def_nested_prop_alias
00049 #endif
00050 #ifdef def_prop_getter
00051 #   undef def_prop_getter
00052 #   undef def_prop_setter
00053 #endif
00054 
00055 #pragma pointers_to_members(full_generality, virtual_inheritance)
00056 
00057 #define def_generic(fn, name)                                           \
00058     Generic fn##_gf (_M("%"#name), &Value::fn##_vf)
00059 #define def_visible_generic(fn, name)                                   \
00060     Generic fn##_gf (_M(name), &Value::fn##_vf)
00061 #define def_struct_generic(fn, _struct, name)                           \
00062     Generic fn##_gf (_M(name), &Value::fn##_vf, _M(#_struct))
00063 #define def_node_generic(fn, name)                                      \
00064     NodeGeneric fn##_gf (_M(name), &Value::fn##_vf)
00065 #define def_mapped_generic(fn, name)                                    \
00066     MappedGeneric fn##_gf (_M(name), &Value::fn##_vf)
00067 #define use_generic(fn, name)
00068 
00069 #define def_generic_debug_ok(fn, name)                                          \
00070     Generic fn##_gf (_M("%"#name), &Value::fn##_vf, NULL, DEBUGGER_SAFE)
00071 #define def_visible_generic_debug_ok(fn, name)                                  \
00072     Generic fn##_gf (_M(name), &Value::fn##_vf, NULL, DEBUGGER_SAFE)
00073 #define def_struct_generic_debug_ok(fn, _struct, name)                          \
00074     Generic fn##_gf (_M(name), &Value::fn##_vf, _M(#_struct), DEBUGGER_SAFE)
00075 #define def_node_generic_debug_ok(fn, name)                                     \
00076     NodeGeneric fn##_gf (_M(name), &Value::fn##_vf, DEBUGGER_SAFE)
00077 #define def_mapped_generic_debug_ok(fn, name)                                   \
00078     MappedGeneric fn##_gf (_M(name), &Value::fn##_vf, DEBUGGER_SAFE)
00079 
00080 #define def_primitive(fn, name)                                         \
00081     Value* fn##_cf(Value**,int);                                        \
00082     Primitive fn##_pf (_M("%"#name), fn##_cf)  /* scripter-hidden name */
00083 #define def_visible_primitive(fn, name)                                 \
00084     Value* fn##_cf(Value**,int);                                        \
00085     Primitive fn##_pf (_M(name), fn##_cf)
00086 #define def_struct_primitive(fn, _struct, name)                         \
00087     Value* fn##_cf(Value**,int);                                        \
00088     Primitive fn##_pf (_M(name), _M(#_struct), fn##_cf)
00089 #define def_mapped_primitive(fn, name)                                  \
00090     Value* fn##_cf(Value**,int);                                        \
00091     MappedPrimitive fn##_pf (_M(name), fn##_cf)
00092 #define def_lazy_primitive(fn, name)                                    \
00093     Value* fn##_cf(Value**,int);                                        \
00094     Primitive fn##_pf (_M("%"#name), fn##_cf, LAZY_PRIMITIVE)
00095 #define def_visible_lazy_primitive(fn, name)                            \
00096     Value* fn##_cf(Value**,int);                                        \
00097     Primitive fn##_pf (_M(name), fn##_cf, LAZY_PRIMITIVE)
00098 
00099 #define def_primitive_debug_ok(fn, name)                                \
00100     Value* fn##_cf(Value**,int);                                        \
00101     Primitive fn##_pf (_M("%"#name), fn##_cf, DEBUGGER_SAFE)  /* scripter-hidden name */
00102 #define def_visible_primitive_debug_ok(fn, name)                        \
00103     Value* fn##_cf(Value**,int);                                        \
00104     Primitive fn##_pf (_M(name), fn##_cf, DEBUGGER_SAFE)
00105 #define def_struct_primitive_debug_ok(fn, _struct, name)                \
00106     Value* fn##_cf(Value**,int);                                        \
00107     Primitive fn##_pf (_M(name), _M(#_struct), fn##_cf, DEBUGGER_SAFE)
00108 #define def_mapped_primitive_debug_ok(fn, name)                         \
00109     Value* fn##_cf(Value**,int);                                        \
00110     MappedPrimitive fn##_pf (_M(name), fn##_cf, DEBUGGER_SAFE)
00111 #define def_lazy_primitive_debug_ok(fn, name)                           \
00112     Value* fn##_cf(Value**,int);                                        \
00113     Primitive fn##_pf (_M("%"#name), fn##_cf, LAZY_PRIMITIVE | DEBUGGER_SAFE)
00114 #define def_visible_lazy_primitive_debug_ok(fn, name)                   \
00115     Value* fn##_cf(Value**,int);                                        \
00116     Primitive fn##_pf (_M(name), fn##_cf, LAZY_PRIMITIVE | DEBUGGER_SAFE)
00117 
00118 #define def_property(p)                                                 \
00119     _M(#p), &Value::get_##p, &Value::set_##p,
00120 #define def_property_alias(p, real_p)                                   \
00121     _M(#p), &Value::get_##real_p, &Value::set_##real_p,
00122 #define def_2_prop_path(p1, p2)                                         \
00123     _M(#p1"."#p2), &Value::get_##p1##_##p2, &Value::set_##p1##_##p2,
00124 #define def_2_prop_path_alias(p1, p2, real_p1, real_p2)                 \
00125     _M(#p1"."#p2), &Value::get_##real_p1##_##real_p2, &Value::set_##real_p1##_##real_p2,
00126 #define def_nested_prop(p1)                                             \
00127     _M("*."#p1), &Value::get_nested_##p1, &Value::set_nested_##p1,
00128 #define def_nested_prop_alias(p1, real_p1)                              \
00129     _M("*."#p1), &Value::get_nested_##real_p1, &Value::set_nested_##real_p1,
00130 
00131 #undef def_name
00132 #define def_name(name)  ScripterExport Value* n_##name; 
00133     
00134 #undef def_marker
00135 #define def_marker(var, str) ScripterExport Name var (_M(str));
00136