summary refs log tree commit diff stats
path: root/.gitignore
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-12-15 22:57:27 -0500
committerTingPing <tingping@tingping.se>2014-12-17 18:21:10 -0500
commitaeb5d15871cca7fe5eba806431b4e63fee015a94 (patch)
tree767d8f2892834e930f81b0ebb9bb2de44fd61bca /.gitignore
parent76c2cfebc35a007cbbd3ae3ab66b64799fd62f8e (diff)
More consistently include config.h
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions
26'>26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57









































                                                                           






                                                                                          







                                                              
#!/usr/bin/perl

use strict;
use warnings;

sub header {
  my $file = shift;
  open my $input, "<", $file or die "Couldn't open '$file':$!";
  my @file = <$input>;
  close $file;
  return toc(@file);
}

sub toc {
  my @lines = @_;
  for( @lines ) {
    if( /^\s*$/s ) { $_ = qq{"\\n"\n}; next; }
    if( /^\s*#/ ) { $_ = qq{"\\n"\n}; next; }
    s/\\/\\\\/g; # double the number of \'s
    s/"/\\"/g;
    s/^\s*/"/;
    s/\n/\\n"\n/;
  }
  return @lines;
}

for my $files (
	[ "xchat.pm.h",         # output file
		"lib/Xchat.pm",      # input files
		"lib/Xchat/Embed.pm",
		"lib/Xchat/List/Network.pm",
		"lib/Xchat/List/Network/Entry.pm",
		"lib/Xchat/List/Network/AutoJoin.pm",
	],
	[ "irc.pm.h",   # output file
		"lib/IRC.pm" # input file
	]
) {
	my ($output,@inputs) = @$files;

	open my $header, ">", $output or die "Couldn't open '$output': $!";

	print $header qq["BEGIN {\\n"\n];
	for my $input ( @inputs ) {
		(my $trimmed = $input) =~ s{^lib/}{};
		print $header qq["\$INC{'$trimmed'} = 'Compiled into the plugin.';\\n"\n];
	}
	print $header qq["}\\n"\n];

	for my $input ( @inputs ) {
		print $header qq["{\\n"\n];
		print $header qq{"#line 1 \\"$input\\"\\n"\n};
		print $header header( $input );
		print $header qq["}\\n"\n];
	}
	close $header;
}