use True and False if available. Ditch GIMP_ prefixes since we have real

2003-02-08  Manish Singh  <yosh@gimp.org>

        * tools/pdbgen/enumcode-py.pl: use True and False if available.
        Ditch GIMP_ prefixes since we have real namespaces in python.

        * tools/pdbgen/Makefile.am: generate python enums too

        * tools/pdbgen/enumcode.pl: cosmetic cleanup
This commit is contained in:
Manish Singh 2003-02-08 19:47:48 +00:00 committed by Manish Singh
parent f8861444f9
commit bad831ce41
5 changed files with 30 additions and 5 deletions

View File

@ -1,3 +1,12 @@
2003-02-08 Manish Singh <yosh@gimp.org>
* tools/pdbgen/enumcode-py.pl: use True and False if available.
Ditch GIMP_ prefixes since we have real namespaces in python.
* tools/pdbgen/Makefile.am: generate python enums too
* tools/pdbgen/enumcode.pl: cosmetic cleanup
2003-02-08 Sven Neumann <sven@gimp.org> 2003-02-08 Sven Neumann <sven@gimp.org>
* libgimp/gimpmiscui.c (gimp_fixme_preview_fill): fixed * libgimp/gimpmiscui.c (gimp_fixme_preview_fill): fixed

View File

@ -4,3 +4,4 @@ stamp-enums
stamp-groups stamp-groups
stamp-pdbgen stamp-pdbgen
stamp-enum-code stamp-enum-code
stamp-enum-code-py

View File

@ -110,4 +110,12 @@ stamp-enum-code: $(srcdir)/enumcode.pl enums.pl util.pl
$(PERL) enumcode.pl \ $(PERL) enumcode.pl \
&& echo timestamp > $$rootme/stamp-enum-code && echo timestamp > $$rootme/stamp-enum-code
all-local: stamp-pdbgen stamp-enum-code stamp-enum-code-py: $(srcdir)/enumcode-py.pl enums.pl util.pl
rootme=`pwd`; \
destdir=`cd $(top_srcdir) && pwd`; export destdir; \
cd $(srcdir) && \
PDBGEN_BACKUP=$(PDBGEN_BACKUP) \
$(PERL) enumcode-py.pl \
&& echo timestamp > $$rootme/stamp-enum-code-py
all-local: stamp-pdbgen stamp-enum-code stamp-enum-code-py

View File

@ -67,8 +67,15 @@ print ENUMFILE <<'GPL';
GPL GPL
print ENUMFILE <<'CODE'; print ENUMFILE <<'CODE';
TRUE = 1 # TRUE and FALSE constants ...
FALSE = 0 import __builtin__
if not hasattr(__builtin__, 'True'):
__builtin__.True = (1 == 1)
__builtin__.False = (1 != 1)
del __builtin__
FALSE = False
TRUE = True
CODE CODE
foreach (sort keys %enums) { foreach (sort keys %enums) {
@ -80,6 +87,7 @@ foreach (sort keys %enums) {
my $sym = $symbol; my $sym = $symbol;
# Maybe Python has nice enough namespace handling that we don't # Maybe Python has nice enough namespace handling that we don't
# need to prefix all constants with GIMP_ # need to prefix all constants with GIMP_
$sym =~ s/^GIMP\_//;
$body .= "$sym"; $body .= "$sym";
if (!$enum->{contig}) { if (!$enum->{contig}) {
$i = $enum->{mapping}->{$symbol}; $i = $enum->{mapping}->{$symbol};

View File

@ -124,6 +124,7 @@ HEADER
foreach (sort keys %enums) { foreach (sort keys %enums) {
if (! ($enums{$_}->{header} =~ /libgimp/)) { if (! ($enums{$_}->{header} =~ /libgimp/)) {
print ENUMFILE "typedef enum\n{\n"; print ENUMFILE "typedef enum\n{\n";
my $enum = $enums{$_}; my $body = ""; my $enum = $enums{$_}; my $body = "";
foreach $symbol (@{$enum->{symbols}}) { foreach $symbol (@{$enum->{symbols}}) {
my $sym = $symbol; my $sym = $symbol;
@ -153,5 +154,3 @@ HEADER
close ENUMFILE; close ENUMFILE;
&write_file($enumfile); &write_file($enumfile);