mirror of https://git.code.sf.net/p/isync/isync
Compare commits
No commits in common. '76e5f223ee975ede474333247d43888d18d77ece' and 'e70c300f7446ba6ec1259f459a0f0e1d2d592ed9' have entirely different histories.
76e5f223ee
...
e70c300f74
24 changed files with 370 additions and 314 deletions
@ -0,0 +1,70 @@
|
||||
#!/usr/bin/perl |
||||
# |
||||
# SPDX-FileCopyrightText: 2022 Oswald Buddenhagen <ossi@users.sf.net> |
||||
# SPDX-License-Identifier: GPL-2.0-or-later |
||||
# |
||||
# mbsync - mailbox synchronizer |
||||
# |
||||
|
||||
use strict; |
||||
use warnings; |
||||
|
||||
my $in_enum = 0; |
||||
my $conts; |
||||
while (<>) { |
||||
s,\s*(?://.*)?$,,; |
||||
if ($in_enum) { |
||||
if (/^\)$/) { |
||||
$conts =~ s/\s//g; |
||||
$conts =~ s/,$//; |
||||
my @vals = split(/,/, $conts); |
||||
my ($pfx, $pfx1); |
||||
for my $e (@vals) { |
||||
if (!defined($pfx)) { |
||||
$pfx1 = $pfx = ($e =~ /^([A-Z]+_)/) ? $1 : ""; |
||||
} elsif (length($pfx)) { |
||||
$pfx = "" if ((($e =~ /^([A-Z]+_)/) ? $1 : "") ne $pfx); |
||||
} |
||||
} |
||||
my $bit = 1; |
||||
my $bitn = 0; |
||||
my (@names, @nameos); |
||||
my $nameo = 0; |
||||
for my $e (@vals) { |
||||
my $bits = ($e =~ s/\((\d+)\)$//) ? $1 : 1; |
||||
my $n = substr($e, length($pfx)); |
||||
if ($bits != 1) { |
||||
die("Unsupported field size $bits\n") if ($bits != 2); |
||||
print "#define $e(b) ($bit << (b))\n"; |
||||
push @names, "F-".$n, "N-".$n; |
||||
my $nl = length($n) + 3; |
||||
push @nameos, $nameo, $nameo + $nl; |
||||
$nameo += $nl * 2; |
||||
} else { |
||||
print "#define $e $bit\n"; |
||||
push @names, $n; |
||||
push @nameos, $nameo; |
||||
$nameo += length($n) + 1; |
||||
} |
||||
$bit <<= $bits; |
||||
$bitn += $bits; |
||||
} |
||||
if (length($pfx)) { |
||||
print "#define ${pfx}_NUM_BITS $bitn\n"; |
||||
} |
||||
if (length($pfx1)) { |
||||
print "#define ${pfx1}_STRINGS \"".join("\\0", @names)."\"\n"; |
||||
print "#define ${pfx1}_OFFSETS ".join(", ", @nameos)."\n"; |
||||
} |
||||
print "\n"; |
||||
$in_enum = 0; |
||||
} else { |
||||
$conts .= $_; |
||||
} |
||||
} else { |
||||
if (/^BIT_ENUM\($/) { |
||||
$conts = ""; |
||||
$in_enum = 1; |
||||
} |
||||
} |
||||
} |
@ -1,36 +0,0 @@
|
||||
#!/bin/sh |
||||
# SPDX-FileCopyrightText: (C) 2024 Oswald Buddenhagen <ossi@users.sf.net> |
||||
# SPDX-License-Identifier: GPL-2.0-or-later |
||||
|
||||
cd $(dirname $0) |
||||
|
||||
test -e .git || exit |
||||
|
||||
mb=$(git merge-base HEAD "@{upstream}" 2> /dev/null) |
||||
if test -z "$mb"; then |
||||
# we presume that a failure to find a merge base means no upstream. |
||||
# and no upstream may mean detached head in the middle of a rebase |
||||
br=$(git branch | sed -n -e 's/^\* (no branch, rebasing \([^\)]*\))$/\1/p') |
||||
if test -n "$br"; then |
||||
mb=$(git merge-base HEAD "$br@{upstream}" 2> /dev/null) |
||||
fi |
||||
fi |
||||
if test -z "$mb"; then |
||||
# still no upstream, so just describe HEAD as-is. |
||||
gver=$(git describe --tags HEAD) |
||||
else |
||||
# find out whether we have local work, and if so, collapse it into |
||||
# a single suffix. otherwise, we'd cause pointless rebuilds during |
||||
# development. |
||||
gver=$(git describe --tags $mb) |
||||
lcl=$(git rev-list -n 1 $mb..HEAD) |
||||
if test -n "$lcl"; then |
||||
gver="$gver-plus" |
||||
fi |
||||
fi |
||||
gver=${gver#v} |
||||
pgver=$(cat VERSION 2> /dev/null) |
||||
if [ "x$gver" != "x$pgver" ]; then |
||||
echo "$gver" > VERSION |
||||
fi |
||||
|
Loading…
Reference in new issue