+/*
+ * InitModule: this function is called once and only once, when the module
+ * is looked at for the first time. We get the useful data from it, for
+ * instance the module name, its shortcuts, its capabilities... we also create
+ * a copy of its config because the module can be unloaded at any time.
+ */
+#define vlc_module_begin( ) \
+ DECLARE_SYMBOLS; \
+ EXTERN_SYMBOL DLL_SYMBOL int CDECL_SYMBOL \
+ __VLC_SYMBOL(vlc_entry) ( module_t *p_module ) \
+ { \
+ int i_shortcut = 1, i_config = 0; \
+ module_config_t p_config[ 100 ]; \
+ STORE_SYMBOLS; \
+ p_module->b_submodule = VLC_FALSE; \
+ p_module->b_unloadable = VLC_TRUE; \
+ p_module->b_reentrant = VLC_TRUE; \
+ p_module->psz_object_name = MODULE_STRING; \
+ p_module->psz_longname = MODULE_STRING; \
+ p_module->pp_shortcuts[ 0 ] = MODULE_STRING; \
+ p_module->i_cpu = 0; \
+ p_module->psz_program = NULL; \
+ p_module->psz_capability = ""; \
+ p_module->i_score = 1; \
+ p_module->pf_activate = NULL; \
+ p_module->pf_deactivate = NULL; \
+ { \
+ module_t *p_submodule = p_module /* the ; gets added */
+
+#define vlc_module_end( ) \
+ p_submodule->pp_shortcuts[ i_shortcut ] = NULL; \
+ } \
+ { \
+ static module_config_t tmp = { CONFIG_HINT_END, NULL, NULL, '\0', \
+ NULL, NULL, NULL, 0, 0.0, 0, 0, \
+ 0.0, 0.0, NULL,NULL, NULL, \
+ VLC_FALSE }; \
+ p_config[ i_config ] = tmp; \
+ } \
+ config_Duplicate( p_module, p_config ); \
+ if( p_module->p_config == NULL ) \
+ { \
+ return VLC_EGENERIC; \
+ } \
+ return VLC_SUCCESS && i_shortcut; \
+ } \
+ struct _u_n_u_s_e_d_ /* the ; gets added */
+
+
+#define add_submodule( ) \
+ p_submodule->pp_shortcuts[ i_shortcut ] = NULL; \
+ p_submodule = \
+ (module_t *)vlc_object_create( p_module, VLC_OBJECT_MODULE ); \
+ vlc_object_attach( p_submodule, p_module ); \
+ p_submodule->b_submodule = VLC_TRUE; \
+ /* Nuahahaha! Heritage! Polymorphism! Ugliness!! */ \
+ for( i_shortcut = 0; p_module->pp_shortcuts[ i_shortcut ]; i_shortcut++ ) \
+ { \
+ p_submodule->pp_shortcuts[ i_shortcut ] = \
+ p_module->pp_shortcuts[ i_shortcut ]; \
+ } \
+ p_submodule->psz_object_name = p_module->psz_object_name; \
+ p_submodule->psz_longname = p_module->psz_longname; \
+ p_submodule->psz_program = p_module->psz_program; \
+ p_submodule->psz_capability = p_module->psz_capability; \
+ p_submodule->i_score = p_module->i_score; \
+ p_submodule->i_cpu = p_module->i_cpu; \
+ p_submodule->pf_activate = NULL; \
+ p_submodule->pf_deactivate = NULL
+
+#define add_requirement( cap ) \
+ p_module->i_cpu |= CPU_CAPABILITY_##cap
+
+#define add_shortcut( shortcut ) \
+ p_submodule->pp_shortcuts[ i_shortcut ] = shortcut; \
+ i_shortcut++
+
+#define set_description( desc ) \
+ p_submodule->psz_longname = desc
+
+#define set_capability( cap, score ) \
+ p_submodule->psz_capability = cap; \
+ p_submodule->i_score = score
+
+#define set_program( program ) \
+ p_submodule->psz_program = program
+
+#define set_callbacks( activate, deactivate ) \
+ p_submodule->pf_activate = activate; \
+ p_submodule->pf_deactivate = deactivate
+
+#define linked_with_a_crap_library_which_uses_atexit( ) \
+ p_module->b_unloadable = VLC_FALSE