mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 03:39:48 +01:00 
			
		
		
		
	tool multi_makeskel.pl: fixed svn props and added option -r for recursive from Darius
git-svn-id: trunk@11143 -
This commit is contained in:
		
							parent
							
								
									c6b596f1c8
								
							
						
					
					
						commit
						61b1572001
					
				
							
								
								
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							@ -1069,7 +1069,7 @@ docs/xml/lcl/toolwin.xml svneol=LF#text/xml eol=lf
 | 
			
		||||
docs/xml/lcl/translations.xml svneol=LF#text/xml eol=lf
 | 
			
		||||
docs/xml/lcl/utrace.xml svneol=LF#text/xml eol=lf
 | 
			
		||||
docs/xml/lcl/xmlpropstorage.xml svneol=LF#text/xml eol=lf
 | 
			
		||||
docs/xml/multi_makeskel.pl -text svneol=native#application/x-perl
 | 
			
		||||
docs/xml/multi_makeskel.pl svneol=native#text/plain
 | 
			
		||||
examples/address_book/addrbook.dpr svneol=native#text/pascal
 | 
			
		||||
examples/address_book/addrbook.lpi svneol=native#text/plain
 | 
			
		||||
examples/address_book/addrbook.lpr svneol=native#text/pascal
 | 
			
		||||
 | 
			
		||||
@ -12,10 +12,15 @@
 | 
			
		||||
# *****************************************************************************
 | 
			
		||||
#
 | 
			
		||||
# Author: Mattias Gaertner
 | 
			
		||||
#
 | 
			
		||||
# 14-May-2007 Added recursive search by Darius Blaszyk 
 | 
			
		||||
 | 
			
		||||
use vars qw/ %opt /;
 | 
			
		||||
use Getopt::Std;
 | 
			
		||||
my $opt_string = 'hp:s:o:i:m:x';
 | 
			
		||||
use File::Find;
 | 
			
		||||
use File::Basename;
 | 
			
		||||
 | 
			
		||||
my $opt_string = 'hp:s:o:i:m:xr';
 | 
			
		||||
getopts( "$opt_string", \%opt ) or usage();
 | 
			
		||||
usage() if $opt{h};
 | 
			
		||||
 | 
			
		||||
@ -29,6 +34,7 @@ usage: $0 [-hpsoimx]
 | 
			
		||||
 -h                    : this (help) message
 | 
			
		||||
 -p <packagename>      : the FPDoc package name to which the units belong
 | 
			
		||||
 -s <source directory> : the source directory with the .pp and .pas files
 | 
			
		||||
 -r                    : search the sourcedir recursively
 | 
			
		||||
 -o <output directory> : the output directory for the xml files
 | 
			
		||||
 
 | 
			
		||||
 optional:
 | 
			
		||||
@ -43,6 +49,18 @@ EOF
 | 
			
		||||
  exit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub wanted { 
 | 
			
		||||
  #$File::Find::dir  = /some/path/
 | 
			
		||||
  #$_                = foo.ext
 | 
			
		||||
  #$File::Find::name = /some/path/foo.ext
 | 
			
		||||
    
 | 
			
		||||
  my(undef, undef, $ftype) = fileparse($_, qr"\..*");
 | 
			
		||||
 | 
			
		||||
  if (($ftype eq ".pp") || ($ftype eq ".pas")) {
 | 
			
		||||
    unshift(@Files, $File::Find::name);  
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
($opt{p}) || usage(); # packagename needed
 | 
			
		||||
($opt{s}) || usage(); # source directory needed
 | 
			
		||||
($opt{o}) || usage(); # output directory needed
 | 
			
		||||
@ -71,15 +89,26 @@ if($opt{p}){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# get pascal unit files
 | 
			
		||||
opendir(DIR, $SrcDir);
 | 
			
		||||
@Files = grep(/\.(pas|pp)$/,readdir(DIR));
 | 
			
		||||
closedir(DIR);
 | 
			
		||||
 | 
			
		||||
if($opt{r}){
 | 
			
		||||
  #recursively find unit files
 | 
			
		||||
  find(\&wanted, $SrcDir);
 | 
			
		||||
} else {
 | 
			
		||||
  opendir(DIR, $SrcDir);
 | 
			
		||||
  @Files = grep(/\.(pas|pp)$/,readdir(DIR));
 | 
			
		||||
  closedir(DIR);
 | 
			
		||||
}
 | 
			
		||||
for $SrcFile(@Files){
 | 
			
		||||
  $OutFile=$SrcFile;
 | 
			
		||||
  $OutFile = fileparse($SrcFile);
 | 
			
		||||
  ($OutFile=~s/\.(pas|pp)$/.xml/);
 | 
			
		||||
  print $SrcFile." -> ".$OutFile."\n";
 | 
			
		||||
  $Input=$SrcDir."/".$SrcFile;
 | 
			
		||||
  
 | 
			
		||||
  #create the input filename
 | 
			
		||||
  if($opt{r}){
 | 
			
		||||
    $Input=$SrcFile;
 | 
			
		||||
  } else {
 | 
			
		||||
    $Input=$SrcDir."/".$SrcFile;
 | 
			
		||||
  }  
 | 
			
		||||
  
 | 
			
		||||
  if ($opt{i}){
 | 
			
		||||
    $Input.="' ".$opt{i}."'";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user