示例#1
0
文件: __init__.c 项目: RONNCC/pysoy
PyMODINIT_FUNC
PyInit_soy_widgets(void) {
    PyObject *module, *dict;

    /////////////////////////////////////////////////////////////////////////
    // Initialize all types prior to module creation
    //
    //  int PyType_Ready(PyTypeObject*)
    //    Finalize a type object. This should be called on all type objects to
    //    finish their initialization. This function is responsible for adding
    //    inherited slots from a type's base class.
    //    Return 0 on success, or return -1 and sets an exception on error.

    // init Widget type
    PYSOY_TYPEINIT(widgets, Widget);

    // init Canvas type
    PYSOY_TYPEINIT(widgets, Canvas);

    // init Container type
    PYSOY_TYPEINIT(widgets, Container);

    // init HBox type
    PYSOY_TYPEINIT(widgets, HBox);

    // init HBox type
    PYSOY_TYPEINIT(widgets, VBox);

    // init Projector type
    PYSOY_TYPEINIT(widgets, Projector);

    // init Window type
    PYSOY_TYPEINIT(widgets, Window);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    module = PyModule_Create(&module_def);
    dict = PyModule_GetDict(module);

    // add additional pydoc strings
    PyModule_AddStringConstant(module, "__credits__", PYSOY_CREDITS);
    PyModule_AddStringConstant(module, "__version__", SOY_VERSION);


    /////////////////////////////////////////////////////////////////////////
    // add each type to the module object

    // add Widget type
    PYSOY_TYPEADD_G(widgets, widget, Widget);

    // add Canvas type
    PYSOY_TYPEADD_G(widgets, canvas, Canvas);

    // add Container type
    PYSOY_TYPEADD_G(widgets, container, Container);

    // add HBox type
    PYSOY_TYPEADD_G(widgets, hbox, HBox);

    // add VBox type
    PYSOY_TYPEADD_G(widgets, vbox, VBox);

    // add Projector type
    PYSOY_TYPEADD_G(widgets, projector, Projector);

    // add Window type
    PYSOY_TYPEADD_G(widgets, window, Window);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    if (PyErr_Occurred()) {
        PyErr_SetString(PyExc_ImportError, "PySoy_widgets: init failed");
        return NULL;
    }
    else
        return module;
}
示例#2
0
PyMODINIT_FUNC
PyInit_soy_textures(void) {
    PyObject *module, *dict;

    /////////////////////////////////////////////////////////////////////////
    // Initialize all types prior to module creation
    //
    //  int PyType_Ready(PyTypeObject*)
    //    Finalize a type object. This should be called on all type objects to
    //    finish their initialization. This function is responsible for adding
    //    inherited slots from a type's base class.
    //    Return 0 on success, or return -1 and sets an exception on error.

    // init Texture type
    PYSOY_TYPEINIT(textures, Texture);

    // init Cubemap type
    PYSOY_TYPEINIT(textures, Cubemap);

    // init Bumpmap type
    PYSOY_TYPEINIT(textures, Bumpmap);

    // init Heightmap type
    PYSOY_TYPEINIT(textures, Heightmap);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    module = PyModule_Create(&module_def);
    dict = PyModule_GetDict(module);
    
    // add additional pydoc strings
    PyModule_AddStringConstant(module, "__credits__", PYSOY_CREDITS);
    PyModule_AddStringConstant(module, "__version__", SOY_VERSION);


    /////////////////////////////////////////////////////////////////////////
    // add each type to the module object

    // add Texture type
    PYSOY_TYPEADD_G(textures, texture, Texture);

    // add Cubemap type
    PYSOY_TYPEADD_G(textures, cubemap, Cubemap);

    // add Bumpmap type
    PYSOY_TYPEADD_G(textures, bumpmap, Bumpmap);

    // add Heightmap type
    PYSOY_TYPEADD_G(textures, heightmap, Heightmap);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    if (PyErr_Occurred()) {
        PyErr_SetString(PyExc_ImportError, "PySoy_textures: init failed");
        return NULL;
    }
    else
        return module;
}
示例#3
0
PyMODINIT_FUNC
PyInit_soy_atoms (void) {
    PyObject *module;

    /////////////////////////////////////////////////////////////////////////
    // Initialize all types prior to module creation
    //
    //  int PyType_Ready(PyTypeObject*)
    //    Finalize a type object. This should be called on all type objects to
    //    finish their initialization. This function is responsible for adding
    //    inherited slots from a type's base class.
    //    Return 0 on success, or return -1 and sets an exception on error.

    // init Area type
    PYSOY_TYPEINIT(atoms, Area);

    // init Axis type
    PYSOY_TYPEINIT(atoms, Axis);

    // init Color type
    PYSOY_TYPEINIT(atoms, Color);
    PYSOY_TYPEINIT_PROP(atoms, color, Color, names,
                        &soy_atoms_color_colormap_get_color,
                        &soy_atoms_color_colormap_set_color,
                        &soy_atoms_color_colormap_check_type);

    // init Face type
    PYSOY_TYPEINIT(atoms, Face);

    // init Morph type
    PYSOY_TYPEINIT(atoms, Morph);

    // init Position type
    PYSOY_TYPEINIT(atoms, Position);

    // init Rotation type
    PYSOY_TYPEINIT(atoms, Rotation);

    // init Size type
    PYSOY_TYPEINIT(atoms, Size);

    // init Vector type
    PYSOY_TYPEINIT(atoms, Vector);

    // init Vertex type
    PYSOY_TYPEINIT(atoms, Vertex);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    module = PyModule_Create(&module_def);

    // add additional pydoc strings
    PyModule_AddStringConstant(module, "__credits__", PYSOY_CREDITS);
    PyModule_AddStringConstant(module, "__version__", SOY_VERSION);


    /////////////////////////////////////////////////////////////////////////
    // add each type to the module object

    // add Area type
    PYSOY_TYPEADD_G(atoms, area, Area);

    // add Axis type
    PYSOY_TYPEADD_G(atoms, axis, Axis);

    // add Color type
    PYSOY_TYPEADD_G(atoms, color, Color);

    // add Face type
    PYSOY_TYPEADD_G(atoms, face, Face);

    // add Morph type
    PYSOY_TYPEADD_G(atoms, morph, Morph);

    // add Position type
    PYSOY_TYPEADD_G(atoms, position, Position);

    // add Rotation type
    PYSOY_TYPEADD_G(atoms, rotation, Rotation);

    // add Size type
    PYSOY_TYPEADD_G(atoms, size, Size);

    // add Vector type
    PYSOY_TYPEADD_G(atoms, vector, Vector);

    // add Vertex type
    PYSOY_TYPEADD_G(atoms, vertex, Vertex);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    if (PyErr_Occurred()) {
        PyErr_SetString(PyExc_ImportError, "PySoy_atoms: init failed");
        return NULL;
    }

    return module;
}
示例#4
0
PyMODINIT_FUNC
PyInit_soy_bodies(void) {
    PyObject *module;
    /////////////////////////////////////////////////////////////////////////
    // Initialize all types prior to module creation
    //
    //  int PyType_Ready(PyTypeObject*)
    //    Finalize a type object. This should be called on all type objects to
    //    finish their initialization. This function is responsible for adding
    //    inherited slots from a type's base class.
    //    Return 0 on success, or return -1 and sets an exception on error.

    // init Billboard type
    PYSOY_TYPEINIT(bodies, Billboard);

    // init Body type
    PYSOY_TYPEINIT(bodies, Body);

    // init Box type
    PYSOY_TYPEINIT(bodies, Box);

    // init Camera type
    PYSOY_TYPEINIT(bodies, Camera);

    // init Cylinder type
    PYSOY_TYPEINIT(bodies, Cylinder);

    // init Light type
    PYSOY_TYPEINIT(bodies, Light);

    // init Mesh type
    PYSOY_TYPEINIT(bodies, Mesh);

    // init Portal type
    PYSOY_TYPEINIT(bodies, Portal);

    // init Sphere type
    PYSOY_TYPEINIT(bodies, Sphere);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    module = PyModule_Create(&module_def);

    // add additional pydoc strings
    PyModule_AddStringConstant(module, "__credits__", PYSOY_CREDITS);
    PyModule_AddStringConstant(module, "__version__", SOY_VERSION);


    /////////////////////////////////////////////////////////////////////////
    // add each type to the module object

    // add Billboard type
    PYSOY_TYPEADD_G(bodies, billboard, Billboard);

    // add Body type
    PYSOY_TYPEADD_G(bodies, body, Body);

    // add Box type
    PYSOY_TYPEADD_G(bodies, box, Box);

    // add Camera type
    PYSOY_TYPEADD_G(bodies, camera, Camera);

    // add Cylinder type
    PYSOY_TYPEADD_G(bodies, cylinder, Cylinder);

    // add Light type
    PYSOY_TYPEADD_G(bodies, light, Light);

    // add Mesh type
    PYSOY_TYPEADD_G(bodies, mesh, Mesh);

    // add Portal type
    PYSOY_TYPEADD_G(bodies, portal, Portal);

    // add Sphere type
    PYSOY_TYPEADD_G(bodies, sphere, Sphere);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    if (PyErr_Occurred()) {
        PyErr_SetString(PyExc_ImportError, "PySoy_bodies: init failed");
        return NULL;
    }

    return module;
}
示例#5
0
PyMODINIT_FUNC
PyInit_soy_actions(void) {
    PyObject *module;
    /////////////////////////////////////////////////////////////////////////
    // Initialize all types prior to module creation
    //
    //  int PyType_Ready(PyTypeObject*)
    //    Finalize a type object. This should be called on all type objects to
    //    finish their initialization. This function is responsible for adding
    //    inherited slots from a type's base class.
    //    Return 0 on success, or return -1 and sets an exception on error.

    // init Action type
    PYSOY_TYPEINIT(actions, Action);

    // init Hover type
    PYSOY_TYPEINIT(actions, Hover);

    // init Jump type
    PYSOY_TYPEINIT(actions, Jump);

    // init Look type
    PYSOY_TYPEINIT(actions, Look);

    // init Select type
    PYSOY_TYPEINIT(actions, Select);

    // init Thrust type
    PYSOY_TYPEINIT(actions, Thrust);

    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    module = PyModule_Create(&module_def);

    // add additional pydoc strings
    PyModule_AddStringConstant(module, "__credits__", PYSOY_CREDITS);
    PyModule_AddStringConstant(module, "__version__", SOY_VERSION);


    /////////////////////////////////////////////////////////////////////////
    // add each type to the module object

    // add Action type
    PYSOY_TYPEADD_G(actions, action, Action);

    // add Hover type
    PYSOY_TYPEADD_G(actions, hover, Hover);

    // add Jump type
    PYSOY_TYPEADD_G(actions, jump, Jump);

    // add Look type
    PYSOY_TYPEADD_G(actions, look, Look);

    // add Select type
    PYSOY_TYPEADD_G(actions, select, Select);

    // add Thrust type
    PYSOY_TYPEADD_G(actions, thrust, Thrust);
    
    // additional types above this line in alphabetical order
    /////////////////////////////////////////////////////////////////////////


    if (PyErr_Occurred()) {
        PyErr_SetString(PyExc_ImportError, "PyInit_soy_actions: init failed");
        return NULL;
    }

    return module;
}