#!/usr/bin/perl
$var = $ARGV[0];
open IN, "<$var";
$var =~ s/\./_/g;
print "static const char $var\[\] =\n";
while() {
$line = $_;
chomp $line;
$line =~ s/\"/\\\"/g;
if (/<\/interface>/) {
print "\"$line\";\n";
} else {
print "\"$line\"\n";
}
}
close IN;
Use it like this
xmltoh.pl GtkBuilder.xml > GtkBuilder.hAnd then #include "GtkBuilder.h" and you should have a variable name GtkBuilder_xml that is a string that holds the xml that gtk_builder_add_from_string can use.
No comments:
Post a Comment