#!/usr/bin/perl -w # GIMP - The GNU Image Manipulation Program # Copyright (C) 1999-2003 Manish Singh # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUTFILE ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . BEGIN { $srcdir = $ENV{srcdir} || '.'; $destdir = $ENV{destdir} || '.'; $builddir = $ENV{builddir} || '.'; } use lib $srcdir; require 'enums.pl'; require 'util.pl'; *enums = \%Gimp::CodeGen::enums::enums; *write_file = \&Gimp::CodeGen::util::write_file; *FILE_EXT = \$Gimp::CodeGen::util::FILE_EXT; my $enumfile = "$builddir/libgimp/gimpenums.h$FILE_EXT"; open ENUMFILE, "> $enumfile" or die "Can't open $enumfile: $!\n"; print ENUMFILE <<'LGPL'; /* LIBGIMP - The GIMP Library * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . */ /* NOTE: This file is autogenerated by enumcode.pl */ LGPL my $guard = "__GIMP_ENUMS_H__"; print ENUMFILE <{header} =~ /libgimp/) && ! $enums{$_}->{external}) { my $gtype = $func = $_; for ($gtype) { s/Gimp//; s/([A-Z][^A-Z]+)/\U$1\E_/g; s/_$// } for ($func) { s/Gimp//; s/([A-Z][^A-Z]+)/\L$1\E_/g; s/_$// } print ENUMFILE "\n#define GIMP_TYPE_$gtype (gimp_$func\_get_type ())\n\n"; print ENUMFILE "GType gimp_$func\_get_type (void) G_GNUC_CONST;\n\n"; print ENUMFILE "typedef enum\n{\n"; my $enum = $enums{$_}; my $body = ""; foreach $symbol (@{$enum->{symbols}}) { my $sym = $symbol; $body .= " $sym"; $body .= " = $enum->{mapping}->{$symbol}" if !$enum->{contig}; $body .= ",\n"; } $body =~ s/,\n$//s; $body .= "\n} "; $body .= "$_;\n\n"; print ENUMFILE $body } } print ENUMFILE < $enumfile" or die "Can't open $enumfile: $!\n"; print ENUMFILE <