summaryrefslogtreecommitdiff
path: root/demos/gtk-demo/geninclude.pl
blob: df534bc46d5a9a6534b34a15187580c7de0502df (plain)
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
#!/usr/bin/perl -w

print <<EOT;
typedef	GtkWidget *(*GDoDemoFunc) (void);

typedef struct _Demo Demo;

struct _Demo 
{
  gchar *title;
  gchar *filename;
  GDoDemoFunc func;
};

EOT

$array = "";
$first = 1;
for $file (@ARGV) {
    
    ($basename = $file) =~ s/\.c$//;

    if ($first) {
	$first = 0;
    } else {
	$array .= ",\n";
    }

    open INFO_FILE, $file or die "Cannot open '$file'\n";
    $title = <INFO_FILE>;
    $title =~ s@^\s*/\*\s*@@;
    $title =~ s@\s*$@@;

    close INFO_FILE;

    print "GtkWidget *do_$basename (void);\n";
    $array .= qq(  { "$title", "$file", do_$basename });
}

print "\nDemo testgtk_demos[] = {";
print $array;
print "\n};\n";