mirror of
https://github.com/samba-team/samba.git
synced 2025-01-28 17:47:29 +03:00
b8f5fa8ac8
The thing that finally convinced me that minimal includes was worth pursuing for rpc was a compiler (tcc) that failed to build Samba due to reaching internal limits of the size of include files. Also the fact that includes.h.gch was 16MB, which really seems excessive. This patch brings it back to 12M, which is still too large, but better. Note that this patch speeds up compile times for both the pch and non-pch case. This change also includes the addition iof a "depends()" option in our IDL files, allowing you to specify that one IDL file depends on another. This capability was needed for the auto-includes generation.
112 lines
2.0 KiB
Perl
Executable File
112 lines
2.0 KiB
Perl
Executable File
#!/usr/bin/perl -w
|
|
|
|
###################################################
|
|
# package to produce a table of all idl parsers
|
|
# Copyright tridge@samba.org 2003
|
|
# released under the GNU GPL
|
|
|
|
use strict;
|
|
|
|
use Getopt::Long;
|
|
use File::Basename;
|
|
|
|
my($opt_output);
|
|
my($opt_help) = 0;
|
|
|
|
|
|
#########################################
|
|
# display help text
|
|
sub ShowHelp()
|
|
{
|
|
print "
|
|
perl IDL table generator
|
|
Copyright (C) tridge\@samba.org
|
|
|
|
Usage: tables.pl [options] <idlfile>
|
|
|
|
Options:
|
|
--output OUTNAME put output in OUTNAME.*
|
|
\n";
|
|
exit(0);
|
|
}
|
|
|
|
# main program
|
|
GetOptions (
|
|
'help|h|?' => \$opt_help,
|
|
'output=s' => \$opt_output,
|
|
);
|
|
|
|
if ($opt_help) {
|
|
ShowHelp();
|
|
exit(0);
|
|
}
|
|
|
|
|
|
###################################
|
|
# add include lines to tables.c
|
|
sub process_include($)
|
|
{
|
|
my $name = shift;
|
|
print TABLEC "#include \"$name\"\n";
|
|
}
|
|
|
|
###################################
|
|
# extract table entries from 1 file
|
|
sub process_file($)
|
|
{
|
|
my $filename = shift;
|
|
open(FILE, $filename) || die "unable to open $filename\n";
|
|
|
|
while (my $line = <FILE>) {
|
|
if ($line =~ /extern const struct dcerpc_interface_table dcerpc_table_(\w+);/) {
|
|
print TABLEC "\t&dcerpc_table_$1,\n";
|
|
print TABLEH "NTSTATUS dcerpc_$1\_init(void);\n";
|
|
}
|
|
}
|
|
|
|
close(FILE);
|
|
}
|
|
|
|
print "Creating $opt_output.[ch]\n";
|
|
open(TABLEH, ">$opt_output.h") || die "failed to open $opt_output.h\n";
|
|
open(TABLEC, ">$opt_output.c") || die "failed to open $opt_output.c\n";
|
|
|
|
#include "includes.h"
|
|
|
|
#define NDR_BASE_MARSHALL_SIZE 1024
|
|
|
|
print TABLEC "
|
|
#include \"includes.h\"
|
|
";
|
|
|
|
foreach my $filename (@ARGV) {
|
|
process_include($filename);
|
|
}
|
|
|
|
|
|
print TABLEC "
|
|
/*
|
|
generated by pidl IDL table generator
|
|
*/
|
|
const struct dcerpc_interface_table * const dcerpc_pipes[] = {
|
|
";
|
|
|
|
print TABLEH "
|
|
/*
|
|
table headers generated by pidl IDL table generator
|
|
*/
|
|
|
|
extern const struct dcerpc_interface_table * const dcerpc_pipes[];
|
|
|
|
";
|
|
|
|
foreach my $filename (@ARGV) {
|
|
process_file($filename);
|
|
}
|
|
|
|
|
|
print TABLEC "\tNULL\n};\n";
|
|
|
|
close(TABLEH);
|
|
close(TABLEC);
|