From b0e30ceba2288eab10c6ff7be0ac0cb05a9ed0b7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:51:51 +0200 Subject: Adding upstream version 43.0. Signed-off-by: Daniel Baumann --- plugins/power/gsd-power-constants-update.pl | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 plugins/power/gsd-power-constants-update.pl (limited to 'plugins/power/gsd-power-constants-update.pl') diff --git a/plugins/power/gsd-power-constants-update.pl b/plugins/power/gsd-power-constants-update.pl new file mode 100755 index 0000000..1615131 --- /dev/null +++ b/plugins/power/gsd-power-constants-update.pl @@ -0,0 +1,49 @@ +#!/usr/bin/env perl + +# Author : Simos Xenitellis . +# Author : Bastien Nocera +# Version : 1.2 +# +# Input : gsd-power-constants.h +# Output : gsdpowerconstants.py +# +use strict; + +# Used for reading the keysymdef symbols. +my @constantselements; + +(scalar @ARGV >= 2) or die "Usage: $0 \n"; +my ($input, $output) = @ARGV; + +die "Could not open file gsd-power-constants.h: $!\n" unless open(IN_CONSTANTS, "<:utf8", $input); + +# Output: gtk+/gdk/gdkkeysyms.h +die "Could not open file gsdpowerconstants.py: $!\n" unless open(OUT_CONSTANTS, ">:utf8", $output); + +print OUT_CONSTANTS<) +{ + next if ( ! /^#define / ); + + @constantselements = split(/\s+/); + die "Internal error, no \@constantselements: $_\n" unless @constantselements; + + my $constant = $constantselements[1]; + my $value = $constantselements[2]; + + printf OUT_CONSTANTS "%s = %s;\n", $constant, $value; +} + +close IN_CONSTANTS; + +printf "We just finished converting $input to $output\nThank you\n"; -- cgit v1.2.3