⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extutils::xsbuilder.osc2002.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
\&    Will use mod_dav in C:\eperl\emsrc\ecvs\emod_dav\&    Will use Apache in c:\eprogramme\eapache group\eapache\&    Parse xsbuilder\emaps/_types.map...\&    WARNING: No *_function.map file found in xsbuilder\emaps\&    WARNING: No *_callback.map file found in xsbuilder\emaps\&    WARNING: No *_structure.map file found in xsbuilder\emaps\&    Write xsbuilder\emaps/new_function.map...\&    Write xsbuilder\emaps/new_callback.map...\&    Write xsbuilder\emaps/new_structure.map...\&    Write xsbuilder\emaps/new_type.map....Ve.Sh "Now we have four map files".IX Subsection "Now we have four map files".IP "new_types.map" 4.IX Item "new_types.map"Contains the mapping from C type to Perl classes.IP "new_functions.map" 4.IX Item "new_functions.map"Contains the mapping form C functions to Perl functions. Can be used to reorder arguments, tell XSBuilder which arguments are actualy return values and in which Perl package the function will be created..IP "new_structures.map" 4.IX Item "new_structures.map"Contains the mapping from C structures to Perl classes and defines for whichmembers a access methods should be created. You can also specify if you want a\&\f(CW\*(C`new\*(C'\fR method for the class..IP "new_callbacks.map" 4.IX Item "new_callbacks.map"Contains the mapping form C callback functions to Perl callback functions. Can be used to reorder arguments, tell XSBuilder which arguments are actualy return values and in which Perl package the function will be created..PPIt's a good idea to rename the prefix from \f(CW\*(C`new_\*(C'\fR to something unique, here we use \f(CW\*(C`dav\*(C'\fR.PPEverytime you rerun checkmaps, XSBuilder will create new_* files with the itemsthat are not already part of the other maps..Sh "Next step is to customize the maps...".IX Subsection "Next step is to customize the maps...".SH "type map".IX Header "type map".Sh "autogenerated dav_type.map".IX Subsection "autogenerated dav_type.map".Vb 10\&    DIR |\&    FILE        |\&    HANDLE      |\&    array_header        |\&    dav_buffer  |\&    dav_dyn_context     |\&    dav_dyn_hooks       |\&    dav_dyn_module      |\&    dav_dyn_provider    |\&    dav_error   |\&    dav_get_props_result        |\&    dav_hooks_liveprop  |\&    dav_hooks_locks     |\&    dav_hooks_repository        |\&    dav_if_header       |\&    dav_if_state_type   |\&    ....Ve.Sh "Add Perl classes".IX Subsection "Add Perl classes".Vb 10\&    struct array_header         | Apache::Array\&    struct dav_buffer           |\&    struct dav_datum            | Apache::DAV::Datum\&    struct dav_dyn_context      | Apache::DAV::DynContext\&    struct dav_dyn_hooks        | Apache::DAV::DynHooks\&    struct dav_dyn_module       | Apache::DAV::DynModule\&    struct dav_dyn_provider     | Apache::DAV::DynProvider\&    struct dav_error            | Apache::DAV::Error\&    struct dav_get_props_result | Apache::DAV::PropsResult\&    struct dav_hooks_db         | Apache::DAV::HooksDb\&    struct dav_hooks_liveprop   | Apache::DAV::HooksLiveprop\&    struct dav_hooks_locks      | Apache::DAV::HooksLocks\&    struct dav_hooks_repository | Apache::DAV::HooksRepository\&    struct dav_hooks_vsn        | \&    struct dav_if_header        | Apache::DAV::IfHeader\&    struct dav_if_state_list    | Apache::DAV::StateList\&    ...\&    struct pool                 | Apache::Pool\&    struct request_rec          | Apache::\&    struct server_rec           | Apache::Server\&    ....Ve.PPDefines the mapping from C datatypes to Perl datatypes and classesand tells XSBuilder which datatype are (like) structures.SH "function map".IX Header "function map"Function map defines the mapping from C functions arguments to Perl arguments.IP "Tell XSBuilder where to place functions and which prefix to strip" 4.IX Item "Tell XSBuilder where to place functions and which prefix to strip".Vb 1\&    MODULE=Apache::DAV   PACKAGE=guess  PREFIX=dav_.Ve.IP "Simple entries in the function map will be mapped 1:1 from C to Perl" 4.IX Item "Simple entries in the function map will be mapped 1:1 from C to Perl".Vb 11\&     dav_add_response\&     dav_buffer_append\&     dav_buffer_init\&     dav_buffer_place\&     dav_buffer_place_mem\&     dav_check_bufsize\&     dav_close_propdb\&     dav_collect_liveprop_uris\&     dav_dyn_module_add\&     dav_empty_elem\&    ....Ve.ie n .IP "The following map file entry tells XSBuilder that the value of ""res_p"" should be returned" 4.el .IP "The following map file entry tells XSBuilder that the value of \f(CWres_p\fR should be returned" 4.IX Item "The following map file entry tells XSBuilder that the value of res_p should be returned".Vb 1\&     dav_get_resource           | | r, <res_p.Ve.SpThe C function.Sp.Vb 1\&    int dav_get_resource(request_rec *r, dav_resource **res_p) ;.Ve.SpHow to call it from Perl.Sp.Vb 2\&    # get a sub request of the actual document\&    $subr = $r \-> lookup_uri($uri);\&\&    # get a mod_dav resource object\&    my ($err, $resource) =  $subr\->get_resource;.Ve.IP "You can let XSBuilder insert your custom code, for the interface" 4.IX Item "You can let XSBuilder insert your custom code, for the interface"If you call \f(CW\*(C`get_props\*(C'\fR from Perl \f(CW\*(C`glue_dav_get_props\*(C'\fR will be called, which can adjustthe arguments and return types as necessary. The actual code for \f(CW\*(C`glue_dav_get_props\*(C'\fR will be taken from separate include file..Sp.Vb 2\&     dav_get_props      | glue_\&     dav_get_allprops   | glue_.Ve.Spxsinclude\eApache\eDAV\ePropResult\eApache_\|_DAV_\|_PropResults.h.Sp.Vb 6\&    dav_get_props_result * dav_glue_get_props(dav_propdb * db, dav_xml_doc *doc)\&        {\&        dav_get_props_result * result = (dav_get_props_result *)ap_palloc (db \-> p, sizeof (dav_get_props_result)) ;\&        *result = dav_get_props(db, doc) ;\&        return result ;\&        }.Ve.IP "Arguments can be replaced" 4.IX Item "Arguments can be replaced".Vb 1\&    MODULE=Apache::Array   PACKAGE=Apache::Array PREFIX=ap_\&\&     ap_make_array      | ap_make_array(r\->pool, nelts, elt_size) | request_rec *:r, nelts, elt_size.Ve.Spap_make_array requires a pool a it's first parameter, we pass the request_rec from Perl andXSBuilder will take the pool from the request_rec..SH "structure map".IX Header "structure map".Vb 2\&     MALLOC=strdup:$dest = ($type)strdup($src)\&     FREE=strdup:free($src)\&\&     <dav_xml_elem>\&       name\&       ns\&       lang\&       first_cdata\&       following_cdata\&       parent\&       next\&       first_child\&       attr\&       last_child\&       ns_scope\&       propid\&       provider\&       ns_map\&       new\&     </dav_xml_elem>\&\&     MALLOC=strdup:$dest = ($type)ap_pstrdup(obj \-> pool, $src)\&\&     <array_header>\&       pool\&       elt_size\&       nelts\&       nalloc\&       elts\&       private\&     </array_header>.Ve.Sh "Create a accessor functions for every element and, if requested, a new method".IX Subsection "Create a accessor functions for every element and, if requested, a new method".Vb 4\&        $setprop = Apache::DAV::XMLElem \-> new ({name => \*(Aqprop\*(Aq}) ;\&        $elem    = Apache::DAV::XMLElem \-> new ({name => $name, ns => $namespaces}) ; \&        $setprop \-> first_child($elem) ;\&        $first = $setprop \-> first_child ;.Ve.Sh "some datatypes, like strings, requires dynamic allocated memory".IX Subsection "some datatypes, like strings, requires dynamic allocated memory"From _types.map,which conatins a set of standard types.PP.Vb 8\&    int             | IV\&    int *           | UNDEFINED\&    unsigned int    | UV\&    signed int      | IV\&    long            | IV\&    long int        | IV\&    unsigned long   | UV\&    unsigned        | UV\&\&    char *                   | PV           | | | strdup\&    const char *             | PV           | | | strdup\&    const char **            | UNDEFINED    \&    char const *             | PV           | | | strdup\&    unsigned char *          | PV           | | | strdup\&    const unsigned char *    | PV           | | | strdup\&    ....Ve.SH "callback maps".IX Header "callback maps"Callback maps have the same options a function maps.PP.Vb 1\&    # dav_hooks_db \-> open\&     \&     dav_error *(*)(pool * p,const dav_resource * resource,int ro,dav_db * * pdb)  | p, resource, ro=0, <pdb \&    \&    \&    # dav_hooks_lock \-> has_locks\&    \&     dav_error *(*)(dav_lockdb * lockdb,const dav_resource * resource,int * locks_present).Ve.SH "Generate the XS files".IX Header "Generate the XS files".Vb 2\&    use FindBin ;\&    use lib ($FindBin::Bin) ;\&\&    require ParseSource ; \&    require WrapXS ; \&\&    Apache::DAV::WrapXS\->run;.Ve.Sh "...and run...".IX Subsection "...and run...".Vb 10\&    C:\eperl\emsrc\edavint>perl xsbuilder\exs_generate.pl\&    Will use mod_dav in C:\eperl\emsrc\ecvs\emod_dav\&    Will use Apache in c:\eprogramme\eapache group\eapache\&    Parse xsbuilder\emaps/_types.map...\&    Parse xsbuilder\emaps/dav_type.map...\&    mkdir xs\&    writing...xs//typemap\&    Parse xsbuilder\emaps/dav_functions.map...\&    WARNING: Cannot map type int(*)(void * ,const char * ,const char * ) for function ap_table_do\&    WARNING: Cannot map type dav_buffer * for function dav_buffer_append\&    WARNING: Cannot map type dav_buffer * for function dav_buffer_init\&    WARNING: Cannot map type dav_buffer * for function dav_buffer_place\&    WARNING: Cannot map type dav_buffer * for function dav_buffer_place_mem\&    WARNING: Cannot map type dav_buffer * for function dav_check_bufsize\&    WARNING: Cannot map return type int * for function dav_collect_liveprop_uris\&    WARNING: Cannot map type dav_resource * * for function dav_ensure_resource_writable\&    WARNING: Cannot map type dav_buffer * for function dav_lock_get_activelock\&    WARNING: Cannot map type dav_buffer * for function dav_set_bufsize\&    WARNING: Cannot map type int * for function dav_xml2text\&    struct array_header...\&    Parse xsbuilder\emaps/dav_structure.map...\&         elt_size...\&         nelts...\&         nalloc...\&         elts...\&    struct dav_buffer...\&    struct dav_datum...\&         dptr...\&         dsize...\&    struct dav_dyn_context....Ve.SH "Makefile.PL".IX Header "Makefile.PL".Sh "We need create a top level Makefile.PL".IX Subsection "We need create a top level Makefile.PL".Vb 1\&    use ExtUtils::MakeMaker ();\&    \&    my $apdir  = \*(Aq/path/to/apache\*(Aq;\&    my $davdir = \*(Aq/path/to/moddav\*(Aq;\&\&    %MMARGS = (\&               \*(AqINC\*(Aq    => "\-I\e"$davdir\e" \-I\e"$apdir/include\e" \-I\e"$apdir/os/unix\e" \-I\e"$dir/xs\e"  \-I\e"$dir/xsinclude\e"",\&               ) ;\&\&\&    open FH, ">xs/mmargs.pl" or die "Cannot open xs/mmargs.pl ($!)" ;\&    print FH Data::Dumper \-> Dump ([\e%MMARGS], [\*(AqMMARGS\*(Aq]) ;\&    close FH ;\&\&\&    ExtUtils::MakeMaker::WriteMakefile(\&        \*(AqNAME\*(Aq    => \*(AqApache::DAV\*(Aq,\&        \*(AqVERSION\*(Aq => \*(Aq0.13\*(Aq,\&        %MMARGS,\&    );.Ve.Sh "Makefile.PL's for all class are generated automaticly".IX Subsection "Makefile.PL's for all class are generated automaticly".Vb 10\&    C:\eperl\emsrc\edavint>perl Makefile.PL\&    Will use Apache in c:\eprogramme\eapache group\eapache\&    Will use mod_dav in C:\eperl\emsrc\ecvs\emod_dav\&    Checking if your kit is complete...\&    Looks good\&    Writing Makefile for Apache::Array\&    Writing Makefile for Apache::DAV::Datum\&    Writing Makefile for Apache::DAV::DynContext\&    Writing Makefile for Apache::DAV::DynHooks\&    Writing Makefile for Apache::DAV::DynModule\&    Writing Makefile for Apache::DAV::DynProvider\&    Writing Makefile for Apache::DAV::Error\&    Writing Makefile for Apache::DAV::HooksDb\&    Writing Makefile for Apache::DAV::HooksLiveprop\&    Writing Makefile for Apache::DAV::HooksLocks\&    Writing Makefile for Apache::DAV::HooksRepository\&    Writing Makefile for Apache::DAV::IfHeader\&    Writing Makefile for Apache::DAV::Lock\&    Writing Makefile for Apache::DAV::LockDB\&    Writing Makefile for Apache::DAV::LockTokenList\&    Writing Makefile for Apache::DAV::LockupResult\&    Writing Makefile for Apache::DAV::PropCtx\&    Writing Makefile for Apache::DAV::PropsResult\&    Writing Makefile for Apache::DAV::Resource\&    Writing Makefile for Apache::DAV::Response\&    Writing Makefile for Apache::DAV::StateList\&    Writing Makefile for Apache::DAV::Text\&    Writing Makefile for Apache::DAV::TextHeader\&    Writing Makefile for Apache::DAV::WalkerCtx\&    Writing Makefile for Apache::DAV::XMLAttr\&    Writing Makefile for Apache::DAV::XMLDoc\&    Writing Makefile for Apache::DAV::XMLElem\&    Writing Makefile for Apache::DAV\&    Writing Makefile for Apache::TableEntry\&    Writing Makefile for Apache\&    Writing Makefile for WrapXS\&    Writing Makefile for Apache::DAV.Ve.Sh "and now compile...".IX Subsection "and now compile...".SH "How does it go on...".IX Header "How does it go on...".Sh "Generating documentation".IX Subsection "Generating documentation"XSBuilder already extracts source comments for functions and structures. It also parses doxygen comments, which are used in Apache 2.0.Lyle Brooks has started on automaticly createing \s-1POD\s0 files from this information..Sh "Improving callbacks".IX Subsection "Improving callbacks"Callbacks are the main area that needs improvement..Sh "Bring it back to mod_perl 2.0".IX Subsection "Bring it back to mod_perl 2.0".Sh "First version will be released just after the conference to \s-1CPAN\s0".IX Subsection "First version will be released just after the conference to CPAN".Sh "Any feedback and help appreciated".IX Subsection "Any feedback and help appreciated".Sh "Questions?".IX Subsection "Questions?"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -