summary refs log tree commit diff stats
path: root/plugins/perl/generate_header
blob: d6c8a65fb9f522c8af90926aec640050f622d5ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
#!/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': $!";

	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;
}
"> 0: Failure. * "GetInfo" * Parameters: * gchar\*: ID of the information you want. * Returns: * gchar\*: information you requested. * "GetPrefs" * Parameters: * gchar\*: Setting name required. * Returns: * int: * 0: Failed. * 1: Returned a string. * 2: Returned an integer. * 3: Returned a boolean. * gchar\*: the information requested if it's a string. * int: the information requested if it's a integer or boolean. * "HookCommand" * Parameters: * gchar\*: Name of the command (without the forward slash). * int: Priority of this command. * gchar\*: String of text to display when the user executes /help for this command. May be NULL if you're lazy. * int: Value to returns when the command is catched. See HEXCHAT\_EAT\_*. * Returns: * guint: The ID of the hook. * "HookServer" * Parameters: * gchar\*: Name of the server event. * int: Priority of this command. * int: Value to returns when the command is catched. See HEXCHAT\_EAT\_*. * Returns: * guint: The ID of the hook. * "HookPrint" * Parameters: * gchar\*: Name of the print event. * int: Priority of this command. * int: Value to returns when the command is catched. See HEXCHAT\_EAT\_*. * Returns: * guint: The ID of the hook. * "Unhook" * Parameters: * guint: ID of the hook to unhook. (the return value of "HookCommand", "HookServer" or "HookPrint") * "ListGet" * Parameters: * gchar\*: The list name. * Returns: * guint: List ID. * "ListNext" * Parameters: * guint: List ID returned by "ListGet". * Returns: * gboolean: says if there is no more item in the list. * "ListStr" * Parameters: * guint: List ID returned by "ListGet". * gchar\*: Name of the information needed. * Returns: * gchar\*: The information requested. Warning: "context" attribute of "channels" list should be get with "ListInt" * "ListInt" * Parameters: * guint: List ID returned by "ListGet". * gchar\*: Name of the information needed. * Returns: * guint: The information requested. * "ListTime" * Parameters: * guint: List ID returned by "ListGet". * gchar\*: Name of the information needed. * Returns: * guint64: The information requested. * "ListFields" * Parameters: * gchar\*: The list name. * Returns: * gchar\*\*: information names in this list. * "ListFree" * Parameters: * guint: List ID returned by "ListGet". * "EmitPrint" * Parameters: * gchar\*: Text event to print. * gchar\*\*: NULL terminated array of string. * Returns: * gboolean: * 1: Success. * 0: Failure. * "Nickcmp" * Parameters: * gchar\*: String to compare. * gchar\*: String to compare. * Returns: * int: An integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2. * "Strip" * Parameters: * gchar\*: String to strip. * int: Length of the string (or -1 for NULL terminated). * int: Bit-field of flags: * 0: Strip mIRC colors. * 1: Strip text attributes. * Returns: * gchar\*: stripped string. * "SendModes" * Parameters: * gchar\*\*: NULL terminated array of targets (strings). The names of people whom the action will be performed on. * int: Maximum modes to send per line. * gchar: Mode sign, '-' or '+'. * gchar: Mode char, e.g. 'o' for Ops. ## Available signals: * "ServerSignal" * Parameters: * gchar\*\*: word returned by HexChat. * gchar\*\*: word_eol returned by HexChat. * guint: the ID of the hook (the return value of "HookServer"). * guint: the ID of the context where the event come from. * "CommandSignal" * Parameters: * gchar\*\*: word returned by HexChat. * gchar\*\*: word_eol returned by HexChat. * guint: the ID of the hook (the return value of "HookCommand"). * guint: the ID of the context where the event come from. * "PrintSignal" * Parameters: * gchar\*\*: word returned by HexChat. * guint: the ID of the hook (the return value of "HookPrint"). * guint: the ID of the context where the event come from. * "UnloadSignal" * Emitted when the user asks to unload your program. Please exit(0); when received!