Commit 79f63f1b authored by Xavier Guimard's avatar Xavier Guimard

LEMONLDAP::NG : New Makefile target "make doxygen"


git-svn-id: svn://svn.forge.objectweb.org/svnroot/lemonldap/trunk@483 1dbb9719-a921-0410-b57f-c3a383c2c641
parent 94dd00aa
......@@ -413,6 +413,9 @@ static_example: example
documentation:
@cd doc/ && ../scripts/doc.pl
doxygen: clean
doxygen Doxyfile
distclean: clean
clean: common_clean handler_clean portal_clean manager_clean
......
# =======================================================================
# Doxygen Pre-Processor for Perl
# Copyright (C) 2002 Bart Schuller
# Copyright (C) 2006 Phinex Informatik AG
# All Rights Reserved
#
# Doxygen Filter is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
#
# Larry Wall's 'Artistic License' for perl can be found in
# http://www.perl.com/pub/a/language/misc/Artistic.html
#
# =======================================================================
#
# Author: Aeby Thomas, Phinex Informatik AG,
# Based on DoxygenFilter from Bart Schuller
# E-Mail: tom.aeby@phinex.ch
#
# Phinex Informatik AG
# Thomas Aeby
# Kirchweg 52
# 1735 Giffers
#
# =======================================================================
#
# @(#) $Id: Filter.pm,v 1.2 2006/01/31 16:53:52 aeby Exp $
#
# Revision History:
#
# $Log: Filter.pm,v $
# Revision 1.2 2006/01/31 16:53:52 aeby
# added copyright info
#
#
# =======================================================================
## @file
# implementation of DoxyGen::Filter.
## @class
# Filter from non-C++ syntax API docs to Doxygen-compatible syntax.
# This class is meant to be used as a filter for the
# <a href="http://www.doxygen.org/">Doxygen</a> documentation tool.
package DoxyGen::Filter;
use warnings;
use strict;
## @cmethod object new($outfh)
# create a filter object.
# @param outfh optional output filehandle; defaults to STDOUT
# @return filter object
sub new {
my $class = shift;
my $outfh = shift || \*STDOUT;
return bless {outfh => $outfh}, $class;
}
## @method virtual void filter($infh)=0
# do the filtering.
# @param infh input filehandle, normally STDIN
sub filter {
die "subclass responsibility";
}
## @method protected string protection($sig)
# Return the protection of a method/function signature.
# @param sig the method signature
# @return Either "Public" or "Private".
sub protection {
my($self, $sig) = @_;
return $sig =~ /^(private|protected)/ ? "\u$1" : 'Public';
}
## @method void start($command)
# start a doc comment.
# Outputs the start of a javadoc comment.
# @param command the javadoc command
sub start {
my $self = shift;
my $command = shift;
$self->print("/** $command\n");
return $self;
}
## @method void end()
# end a doc comment.
# Outputs the end of a javadoc comment.
sub end {
my $self = shift;
$self->print("*/\n");
return $self;
}
## @method void push($section)
# Start a diversion to a section.
# @param section The name of the section to divert all output to.
# @see pop(), print(), flush()
sub push {
my($self, $section) = @_;
$self->{current_section} = $section;
return $self;
}
## @method void pop()
# End a diversion to a section.
# @see push(), flush()
sub pop {
my($self) = @_;
delete $self->{current_section};
return $self;
}
## @method void print(@args)
# print a string to the output handle.
# If a diversion to a specific section is in effect: saves the text under
# that section.
# @param args the strings to be printed
# @see push(), flush()
sub print {
my $self = shift;
return unless @_;
if (my $section = $self->{current_section}) {
CORE::push @{$self->{sections}{$section}}, @_;
} else {
my $outfh = $self->{outfh};
print $outfh @_;
}
return $self;
}
## @method void more(@args)
# process the follow-up lines after the initial apidoc line.
# @param args the lines to be processed
sub more {
my $self = shift;
$self->print(@_);
return $self;
}
my @order = (
'Public Class Methods',
'Public Object Methods',
'Public Functions',
'Protected Class Methods',
'Protected Object Methods',
'Protected Functions',
'Private Class Methods',
'Private Object Methods',
'Private Functions',
);
## @method void flush()
# Flush the saved sections. Should be called at the end of a class.
# @see push(), print()
sub flush {
my $self = shift;
my $sections = $self->{sections};
foreach (@order) {
next unless $sections->{$_};
$self->start("\@name $_\n")->end;
$self->start("\@{")->end;
$self->print("\n");
$self->print(@{$sections->{$_}});
$self->print("\n");
$self->start("\@}")->end;
$self->print("\n");
}
delete $self->{sections};
return $self;
}
1;
__END__
=head1 NAME
Doxygen::Filter - use DoxyGen with Perl and other languages.
=head1 DESCRIPTION
Filter from non-C++ syntax API docs to Doxygen-compatible syntax.
This class is meant to be used as a filter for the
Doxygen (http://www.doxygen.org/) documentation tool
This diff is collapsed.
# =======================================================================
# Doxygen Pre-Processor for Perl
# Copyright (C) 2002 Bart Schuller
# Copyright (C) 2006 Phinex Informatik AG
# All Rights Reserved
#
# Doxygen Filter is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
#
# Larry Wall's 'Artistic License' for perl can be found in
# http://www.perl.com/pub/a/language/misc/Artistic.html
#
# =======================================================================
#
# Author: Aeby Thomas, Phinex Informatik AG,
# Based on DoxygenFilter from Bart Schuller
# E-Mail: tom.aeby@phinex.ch
#
# Phinex Informatik AG
# Thomas Aeby
# Kirchweg 52
# 1735 Giffers
#
# =======================================================================
#
# @(#) $Id: SQLFilter.pm,v 1.2 2006/01/31 16:53:52 aeby Exp $
#
# Revision History:
#
# $Log: SQLFilter.pm,v $
# Revision 1.2 2006/01/31 16:53:52 aeby
# added copyright info
#
#
# =======================================================================
## @file
# implementation of DoxyGen::SQLFilter.
#
## @class
# Filter from SQL syntax API docs to Doxygen-compatible syntax.
# This class is meant to be used as a filter for the
# <a href="http://www.doxygen.org/">Doxygen</a> documentation tool.
package DoxyGen::SQLFilter;
use warnings;
use strict;
use base qw(DoxyGen::Filter);
## @method void filter($infh)
# do the filtering.
# @param infh input filehandle, normally STDIN
sub filter {
my($self, $infile) = @_;
open(my $infh, $infile);
my $current_class;
while (<$infh>) {
if (/\/\*\*\s*\@(\S+)\s*(.*)/) {
my($command, $args) = ($1, $2);
my @more;
while (<$infh>) {
if (/\*\//) {
# We expect to be on the line after a comment.
$_ = <$infh>;
last;
} else {
/\s*(\*\s)?(.+)/s;
push @more, $2;
}
}
if ($command eq 'file') {
$args ||= $infile;
$self->start("\@$command $args");
$self->more(@more);
$self->end;
} elsif ($command eq 'class') {
unless ($args) {
($args) = /package\s(\S*)/;
}
if ($current_class) {
$self->flush;
$self->print("}\n");
}
$current_class = $args;
$self->start("\@$command $args")->more(@more);
$self->print("\@nosubgrouping")->end;
$self->print("class $args");
$self->print(" {\npublic:\n");
} elsif ($command eq 'fn') {
unless ($args) {
($args) = /function\s+(.*)\b/;
$args = "retval $args(\@args)";
}
$self->push($self->protection($args).' Functions');
$self->start("\@fn $args")->more(@more)->end;
$self->print($args, ";\n");
$self->pop;
} else {
$self->start("\@$command $args");
$self->more(@more);
$self->end;
}
# We ate a line when we got the rest of the comment lines
redo if defined $_;
} elsif (/\@(\w+)/) {
my $inc = $1;
$self->print("#include \"$inc.sql\"\n");
}
}
if ($current_class) {
$self->flush;
$self->print("}\n");
}
}
1;
#!/usr/bin/perl -I.
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
# =======================================================================
# Doxygen Pre-Processor for Perl
# Copyright (C) 2002 Bart Schuller
# Copyright (C) 2006 Phinex Informatik AG
# All Rights Reserved
#
# Doxygen Filter is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
#
# Larry Wall's 'Artistic License' for perl can be found in
# http://www.perl.com/pub/a/language/misc/Artistic.html
#
# =======================================================================
#
# Author: Aeby Thomas, Phinex Informatik AG,
# Based on DoxygenFilter from Bart Schuller
# E-Mail: tom.aeby@phinex.ch
#
# Phinex Informatik AG
# Thomas Aeby
# Kirchweg 52
# 1735 Giffers
#
# =======================================================================
#
# @(#) $Id: doxygenfilter,v 1.3 2006/02/01 12:54:07 aeby Exp $
#
# Revision History:
#
# $Log: doxygenfilter,v $
# Revision 1.3 2006/02/01 12:54:07 aeby
# call pas2dox for .pas files, js2doxy for .js files
# add "lib" to the include path
#
# Revision 1.2 2006/01/31 16:53:28 aeby
# parse command line options, understand -h and -v, output a usage message if
# command line syntax is not ok
# treat input as perl if filename is ending with .pl, .pm or .perl, as sql
# if filename ends with .sql, if no file extension is used treat it as perl
# if the first line starts with #!....bin.perl. In all other cases just pass
# the file through as is.
#
#
# =======================================================================
use warnings;
use strict;
use lib "lib";
use DoxyGen::PerlFilter;
use DoxyGen::SQLFilter;
use Getopt::Long;
$Getopt::Long::ignorecase = 0;
my $verbose;
my $help;
unless( GetOptions( "verbose" => \$verbose, "v" => \$verbose,
"help" => \$help, "h" => \$help ) && $ARGV[0] ) {
$help = 1;
}
if( $help ) {
my $prog = $0;
$prog =~ s#.*/##;
print STDERR <<END;
Usage: $prog [-v] filename
Pre-processes Perl code in file <filename> and outputs
something doxygen does understand.
END
exit 1;
}
open( FILE, "<$ARGV[0]" );
my $filehead = "";
for( my $line=0; ($line<3) && ($_ = <FILE>); $line++ ) {
$filehead .= $_;
}
close FILE;
my $ext = "";
if( $ARGV[0] =~ /\.([a-z]+)$/i ) {
$ext = lc($1);
}
my $filter;
if( $ext eq "sql" ) {
print STDERR "treating file as SQL\n" if( $verbose );
$filter = DoxyGen::SQLFilter->new(\*STDOUT);
} elsif( grep( $_ eq $ext, "pl", "pm", "perl" )
|| $filehead =~ /^#!.{0,10}bin.perl/ ) {
print STDERR "treating file as Perl\n" if( $verbose );
$filter = DoxyGen::PerlFilter->new(\*STDOUT);
}
elsif( $ext eq "js" ) {
print STDERR "treating file as JavaScript\n" if( $verbose );
exec( "js2doxy", @ARGV ) or exec( "js2doxypl", @ARGV )
or print STDERR "js2doxy not installed? - see http://jsunit.berlios.de/internal.html\n";
}
elsif( $ext eq "pas" ) {
print STDERR "treating file as Pascal\n" if( $verbose );
exec( "pas2dox", @ARGV )
or print STDERR "pas2dox not installed? - see http://sourceforge.net/projects/pas2dox/\n";
}
if( $filter ) {
$filter->filter($ARGV[0]);
}
else {
print STDERR "passing file through\n" if( $verbose );
print <>;
}
......@@ -32,7 +32,7 @@ BEGIN {
}
}
## @method int run(Apache2::RequestRec $apacheRequest)
## @cmethod int run(Apache2::RequestRec $apacheRequest)
# overload run subroutine to implement Auth-Basic mechanism.
# @param $apacheRequest current request
# @return Apache constant
......
......@@ -18,7 +18,7 @@ use base qw(Lemonldap::NG::Handler::SharedConf);
*EXPORT_TAGS = *Lemonldap::NG::Handler::SharedConf::EXPORT_TAGS;
*EXPORT_OK = *Lemonldap::NG::Handler::SharedConf::EXPORT_OK;
## @method int run(Apache2::RequestRec $apacheRequest)
## @cmethod int run(Apache2::RequestRec $apacheRequest)
# overload run subroutine to implement cross-domain mechanism.
# @param $apacheRequest
# @return Apache constant
......
......@@ -25,12 +25,12 @@ BEGIN {
*handler = ( MP() == 2 ) ? \&handler_mp2 : \&handler_mp1;
}
## @method int handler_mp1()
## @cmethod int handler_mp1()
# Launch run() when used under mod_perl version 1
# @return Apache constant
sub handler_mp1 ($$) { shift->run(@_); }
## @method int handler_mp2()
## @cmethod int handler_mp2()
# Launch run() when used under mod_perl version 2
# @return Apache constant
sub handler_mp2 : method {
......@@ -53,7 +53,7 @@ our $class;
# disappear.
$UA->requests_redirectable( [] );
## @method int run(Apache2::RequestRec $r)
## @cmethod int run(Apache2::RequestRec $r)
# Main proxy method.
# Called for Apache response (PerlResponseHandler).
# @return Apache constant
......@@ -115,7 +115,7 @@ sub cb_content {
$r->print($chunk);
}
## @method void headers(HTTP::Request $response)
## @cmethod void headers(HTTP::Request $response)
# Send headers received from remote server to the client.
# Replace "Location" header.
# @param $response current HTTP response
......
......@@ -57,7 +57,7 @@ sub init($$) {
$class->localInit($args);
}
## @method void defaultValuesInit(hashRef $args)
## @cmethod void defaultValuesInit(hashRef $args)
# Set default values for non-customized variables
# @param $args hash containing parameters
# @return boolean
......@@ -69,7 +69,7 @@ sub defaultValuesInit {
return $class->SUPER::defaultValuesInit( \%h );
}
## @method void localInit(hashRef $args)
## @cmethod void localInit(hashRef $args)
# Load parameters and build the Lemonldap::NG::Common::Conf object.
# @return boolean
sub localInit {
......@@ -88,7 +88,7 @@ sub localInit {
# MAIN
## @method int run(Apache2::RequestRec $r)
## @cmethod int run(Apache2::RequestRec $r)
# Check configuration and launch Lemonldap::NG::Handler::Simple::run().
# Each $reloadTime, the Apache child verify if its configuration is the same
# as the configuration stored in the local storage.
......@@ -107,7 +107,7 @@ sub run($$) {
# CONFIGURATION UPDATE
## @method int testConf(boolean $local)
## @cmethod int testConf(boolean $local)
# Test if configuration has changed and launch setConf() if needed.
# If the optional boolean $local is true, remote configuration is not tested:
# only local cached configuration is tested if available. $local is given to
......@@ -131,7 +131,7 @@ sub testConf {
OK;
}
## @method int setConf(hashRef $conf)
## @cmethod int setConf(hashRef $conf)
# Launch globalInit().
# Local parameters have best precedence on configuration parameters.
# @return Apache constant
......@@ -149,7 +149,7 @@ sub setConf {
*reload = *refresh;
## @method int refresh(Apache::RequestRec $r)
## @cmethod int refresh(Apache::RequestRec $r)
# Launch testConf() with $local=0, so remote configuration is tested.
# @param $r current request
# @return Apache constant
......
......@@ -142,31 +142,31 @@ BEGIN {
*logout = ( MP() == 2 ) ? \&logout_mp2 : \&logout_mp1;
}
## @method int handler_mp1()
## @cmethod int handler_mp1()
# Launch run() when used under mod_perl version 1
# @return Apache constant
sub handler_mp1 ($$) { shift->run(@_); }
## @method int handler_mp2()
## @cmethod int handler_mp2()
# Launch run() when used under mod_perl version 2
# @return Apache constant
sub handler_mp2 : method {
shift->run(@_);
}
## @method int logout_mp1()
## @cmethod int logout_mp1()
# Launch unlog() when used under mod_perl version 1
# @return Apache constant
sub logout_mp1 ($$) { shift->unlog(@_); }
## @method int logout_mp2()
## @cmethod int logout_mp2()
# Launch unlog() when used under mod_perl version 2
# @return Apache constant
sub logout_mp2 : method {
shift->unlog(@_);
}
## @method void lmLog(string $mess, string $level)
## @cmethod void lmLog(string $mess, string $level)
# Wrapper for Apache log system
# @param $mess message to log
# @param $level string (debug, info, warning or error)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment