Changeset 1731


Ignore:
Timestamp:
2000-11-30T18:42:24+13:00 (23 years ago)
Author:
jrm21
Message:

New and improved! Now gets #include information from std C files as well.
(It should have done it before anyway)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/SRCPlug.pm

    r1707 r1731  
    11###########################################################################
    22#
    3 # SRCPlug.pm -- source code  plugin
     3# SRCPlug.pm -- source code plugin
     4#
    45# A component of the Greenstone digital library software
    56# from the New Zealand Digital Library Project at the
     
    2526# John McPherson Nov 2000
    2627# originally based on TEXTPlug
     28
    2729# filename is currently used for Title ( optionally minus some prefix )
     30
     31# Current languages:
     32#   text: READMEs/Makefiles
     33#   C/C++   (currently extracts #include statements and C++ class decls)
     34#   Perl    (currently only done as text)
     35#   Shell   (currently only done as text)
     36
    2837
    2938package SRCPlug;
     
    7584}
    7685
     86
     87
    7788# do plugin specific processing of doc_obj
    7889sub process {
     
    111122    if ($filetype eq "C++")
    112123    {
    113     return process_c_plus_plus($textref,$pluginfo, $base_dir,
     124    process_c_plus_plus($textref,$pluginfo, $base_dir,
    114125                   $file, $metadata, $doc_obj);
    115     }
     126    } elsif ($filetype eq "C")
     127    {
     128    get_includes_metadata($textref, $doc_obj);
     129    }
     130
     131
    116132     # default operation...
    117133     # insert preformat tags and add text to document object
     
    122138
    123139
    124 sub process_c_plus_plus {
    125     my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj) = @_;
    126 
     140
     141
     142sub get_includes_metadata {
     143    my ($textref, $doc_obj) = @_;
     144   
    127145    my $topsection = $doc_obj->get_top_section();
    128 
    129 
    130146
    131147    # Get '#include' directives for metadata
     
    159175    }
    160176    }
    161 
     177}
     178
     179
     180
     181sub process_c_plus_plus {
     182    my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj) = @_;
     183
     184    my $topsection = $doc_obj->get_top_section();
     185
     186
     187    # Check for include metadata
     188    get_includes_metadata($textref, $doc_obj);
    162189
    163190
     
    200227    } # end of "class"
    201228
    202 
    203 
    204 
    205     # insert preformat tags and add text to document object
    206     $doc_obj->add_utf8_text($topsection, "<pre>\n$$textref\n</pre>");
    207 
    208229    return 1;
    209230}
Note: See TracChangeset for help on using the changeset viewer.