~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to tools/pdbgen/enumcode-py.pl

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl -w
2
 
 
3
 
# The GIMP -- an image manipulation program
4
 
# Copyright (C) 1999-2003 Manish Singh <yosh@gimp.org>
5
 
 
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.
10
 
 
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.
15
 
 
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.
19
 
 
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.
22
 
 
23
 
BEGIN {
24
 
    $srcdir  = $ENV{srcdir}  || '.';
25
 
    $destdir = $ENV{destdir} || '.';
26
 
}
27
 
 
28
 
use lib $srcdir;
29
 
 
30
 
require 'enums.pl';
31
 
require 'util.pl';
32
 
 
33
 
*enums = \%Gimp::CodeGen::enums::enums;
34
 
 
35
 
*write_file = \&Gimp::CodeGen::util::write_file;
36
 
*FILE_EXT   = \$Gimp::CodeGen::util::FILE_EXT;
37
 
 
38
 
my $enumfile = "$destdir/plug-ins/pygimp/gimpenums.py$FILE_EXT";
39
 
open ENUMFILE, "> $enumfile" or die "Can't open $enumfile: $!\n";
40
 
 
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>
44
 
#
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.
49
 
#
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.
54
 
#
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.
58
 
 
59
 
# gimpenums.py -- constants for use with the gimp module
60
 
#
61
 
# this file contains constants that are useful for use in
62
 
# gimp plugins.  Just add 'from gimpenums import *' to the top
63
 
# of the script
64
 
 
65
 
# NOTE: This file is autogenerated by enumcode-py.pl.
66
 
 
67
 
GPL
68
 
 
69
 
print ENUMFILE <<'CODE';
70
 
# TRUE and FALSE constants ...
71
 
import __builtin__
72
 
if not hasattr(__builtin__, 'True'):
73
 
    __builtin__.True = (1 == 1)
74
 
    __builtin__.False = (1 != 1)
75
 
del __builtin__
76
 
 
77
 
FALSE = False
78
 
TRUE = True
79
 
CODE
80
 
 
81
 
foreach (sort keys %enums) {
82
 
    my $enum = $enums{$_}; my $body = ""; my $i=0;
83
 
    $body .= "\n# ";
84
 
    $body .= "Gimp" if !/^Gimp/;
85
 
    $body .= "$_\n";    
86
 
    foreach $symbol (@{$enum->{symbols}}) {
87
 
        my $sym = $symbol; 
88
 
        # Maybe Python has nice enough namespace handling that we don't
89
 
        # need to prefix all constants with GIMP_
90
 
        $sym =~ s/^GIMP\_//;
91
 
        $body .= "$sym";
92
 
        if (!$enum->{contig}) {
93
 
          $i = $enum->{mapping}->{$symbol};
94
 
        }
95
 
 
96
 
        $body .= " = $i\n";     
97
 
 
98
 
        $i++ if($enum->{contig});
99
 
      }
100
 
    print ENUMFILE $body;
101
 
}
102
 
 
103
 
print ENUMFILE "\n";
104
 
 
105
 
close ENUMFILE;
106
 
&write_file($enumfile);