3
# The GIMP -- an image manipulation program
4
# Copyright (C) 1999-2003 Manish Singh <yosh@gimp.org>
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUTFILE ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
# This file would be included in enumcode.pl, but plug-ins/pygimp isn't
21
# currently in the distribution, so keep it seperate for now.
24
$srcdir = $ENV{srcdir} || '.';
25
$destdir = $ENV{destdir} || '.';
33
*enums = \%Gimp::CodeGen::enums::enums;
35
*write_file = \&Gimp::CodeGen::util::write_file;
36
*FILE_EXT = \$Gimp::CodeGen::util::FILE_EXT;
38
my $enumfile = "$destdir/plug-ins/pygimp/gimpenums.py$FILE_EXT";
39
open ENUMFILE, "> $enumfile" or die "Can't open $enumfile: $!\n";
41
print ENUMFILE <<'GPL';
42
# Gimp-Python - allows the writing of Gimp plugins in Python.
43
# Copyright (C) 1997-2003 James Henstridge <james@daa.com.au>
45
# This program is free software; you can redistribute it and/or modify
46
# it under the terms of the GNU General Public License as published by
47
# the Free Software Foundation; either version 2 of the License, or
48
# (at your option) any later version.
50
# This program is distributed in the hope that it will be useful,
51
# but WITHOUT ANY WARRANTY; without even the implied warranty of
52
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53
# GNU General Public License for more details.
55
# You should have received a copy of the GNU General Public License
56
# along with this program; if not, write to the Free Software
57
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
59
# gimpenums.py -- constants for use with the gimp module
61
# this file contains constants that are useful for use in
62
# gimp plugins. Just add 'from gimpenums import *' to the top
65
# NOTE: This file is autogenerated by enumcode-py.pl.
69
print ENUMFILE <<'CODE';
70
# TRUE and FALSE constants ...
72
if not hasattr(__builtin__, 'True'):
73
__builtin__.True = (1 == 1)
74
__builtin__.False = (1 != 1)
81
foreach (sort keys %enums) {
82
my $enum = $enums{$_}; my $body = ""; my $i=0;
84
$body .= "Gimp" if !/^Gimp/;
86
foreach $symbol (@{$enum->{symbols}}) {
88
# Maybe Python has nice enough namespace handling that we don't
89
# need to prefix all constants with GIMP_
92
if (!$enum->{contig}) {
93
$i = $enum->{mapping}->{$symbol};
98
$i++ if($enum->{contig});
100
print ENUMFILE $body;
106
&write_file($enumfile);