From 71291159993b6243ff22b7c49f36eba3a674c44b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 7 Aug 2014 13:51:02 -0700 Subject: [PATCH] Improve generation of list of supported dive computers Get it straight from the libdivecomputer sources used... Signed-off-by: Dirk Hohndel --- SupportedDivecomputers.html | 33 ++++++++++-------- SupportedDivecomputers.txt | 19 ++++++----- scripts/parse-descriptor.pl | 67 ++++++++++++++++++++++++++----------- 3 files changed, 76 insertions(+), 43 deletions(-) mode change 100644 => 100755 scripts/parse-descriptor.pl diff --git a/SupportedDivecomputers.html b/SupportedDivecomputers.html index 0cabd137e..c7ac7ba5a 100644 --- a/SupportedDivecomputers.html +++ b/SupportedDivecomputers.html @@ -1,6 +1,6 @@
Aeris
    -
  • Atmos 2, A300 AI, Atmos AI, Atmos AI 2, Compumask, Elite, Elite T3, Elite T3, Epic, Epic, F10, Manta, XR-2
  • +
  • A300, A300 AI, Atmos 2, Atmos AI, Atmos AI 2, Compumask, Elite, Elite T3, Elite T3, Epic, Epic, F10, Manta, XR-1 NX, XR-2
Apeks
@@ -10,17 +10,22 @@
Atomic Aquatics
    -
  • Cobalt
  • +
  • Cobalt, Cobalt 2
  • +
+
+
Beuchat
+
    +
  • Voyager 2G
Cressi
    -
  • Edy, Leonardo
  • +
  • Edy, Giotto, Leonardo
-
DiveRite
+
Dive Rite
    -
  • NiTek Trio
  • +
  • NiTek Q, NiTek Trio
Genesis
@@ -30,12 +35,12 @@
Heinrichs Weikamp
    -
  • DR5, Frog, OSTC, OSTC 2N, OSTC 3, OSTC Mk2
  • +
  • Frog, OSTC, OSTC 2C, OSTC 2N, OSTC 3, OSTC Mk2
Hollis
    -
  • DG03
  • +
  • DG03, TX1
Mares
@@ -45,7 +50,7 @@
Oceanic
    -
  • Atom 1.0, Atom 2.0, Atom 3.0, Atom 3.1, Datamask, Geo, Geo 2.0, OC1, OC1, OC1, OCi, OCS, Pro Plus 2, Pro Plus 2.1, Pro Plus 3, Veo 1.0, Veo 180, Veo 2.0, Veo 200, Veo 250, Veo 3.0, Versa Pro, VT 4.1, VT Pro, VT3, VT4
  • +
  • Atom 1.0, Atom 2.0, Atom 3.0, Atom 3.1, Datamask, Geo, Geo 2.0, OC1, OC1, OC1, OCS, OCi, Pro Plus 2, Pro Plus 2.1, Pro Plus 3, VT 4.1, VT Pro, VT3, VT4, Veo 1.0, Veo 180, Veo 2.0, Veo 200, Veo 250, Veo 3.0, Versa Pro
Reefnet
@@ -53,6 +58,11 @@
  • Sensus, Sensus Pro, Sensus Ultra
  • +
    Scubapro
    +
      +
    • Meridian, XTender 5
    • +
    +
    Seemann
    • XP5
    • @@ -85,7 +95,7 @@
    Uemis
      -
    • Zürich
    • +
    • Zürich SDA
    Uwatec
    @@ -93,11 +103,6 @@
  • Aladin 2G, Aladin 2G, Aladin Air Twin, Aladin Air Z, Aladin Air Z Nitrox, Aladin Air Z O2, Aladin Prime, Aladin Pro, Aladin Pro Ultra, Aladin Sport Plus, Aladin Tec, Aladin Tec 2G, Galileo Luna, Galileo Sol, Galileo Terra, Galileo Trimix, Memomouse, Smart Com, Smart Pro, Smart Tec, Smart Z
  • -
    xDeep
    -
      -
    • Black
    • -
    -
    Zeagle
    • N2iTiON3
    • diff --git a/SupportedDivecomputers.txt b/SupportedDivecomputers.txt index 46ce26055..29d16c0a4 100644 --- a/SupportedDivecomputers.txt +++ b/SupportedDivecomputers.txt @@ -1,21 +1,22 @@ -Aeris: Atmos 2, A300 AI, Atmos AI, Atmos AI 2, Compumask, Elite, Elite T3, Elite T3, Epic, Epic, F10, Manta, XR-2 +Aeris: A300, A300 AI, Atmos 2, Atmos AI, Atmos AI 2, Compumask, Elite, Elite T3, Elite T3, Epic, Epic, F10, Manta, XR-1 NX, XR-2 Apeks: Quantum X -Atomic Aquatics: Cobalt -Cressi: Edy, Leonardo -DiveRite: NiTek Trio +Atomic Aquatics: Cobalt, Cobalt 2 +Beuchat: Voyager 2G +Cressi: Edy, Giotto, Leonardo +Dive Rite: NiTek Q, NiTek Trio Genesis: React Pro, React Pro White -Heinrichs Weikamp: DR5, Frog, OSTC, OSTC 2N, OSTC 3, OSTC Mk2 -Hollis: DG03 +Heinrichs Weikamp: Frog, OSTC, OSTC 2C, OSTC 2N, OSTC 3, OSTC Mk2 +Hollis: DG03, TX1 Mares: Darwin, Darwin Air, Icon HD, Icon HD Net Ready, M1, M2, Matrix, Nemo, Nemo Air, Nemo Apneist, Nemo Excel, Nemo Steel, Nemo Titanium, Nemo Wide, Nemo Wide 2, Puck, Puck 2, Puck Air, Puck Pro -Oceanic: Atom 1.0, Atom 2.0, Atom 3.0, Atom 3.1, Datamask, Geo, Geo 2.0, OC1, OC1, OC1, OCi, OCS, Pro Plus 2, Pro Plus 2.1, Pro Plus 3, Veo 1.0, Veo 180, Veo 2.0, Veo 200, Veo 250, Veo 3.0, Versa Pro, VT 4.1, VT Pro, VT3, VT4 +Oceanic: Atom 1.0, Atom 2.0, Atom 3.0, Atom 3.1, Datamask, Geo, Geo 2.0, OC1, OC1, OC1, OCS, OCi, Pro Plus 2, Pro Plus 2.1, Pro Plus 3, VT 4.1, VT Pro, VT3, VT4, Veo 1.0, Veo 180, Veo 2.0, Veo 200, Veo 250, Veo 3.0, Versa Pro Reefnet: Sensus, Sensus Pro, Sensus Ultra +Scubapro: Meridian, XTender 5 Seemann: XP5 Shearwater: Petrel, Predator Sherwood: Amphos, Insight, Insight 2, Wisdom, Wisdom 2, Wisdom 3 Subgear: XP Air, XP-10 Suunto: Cobra, Cobra 2, Cobra 3, D3, D4, D4i, D6, D6i, D9, D9tx, DX, Eon, Gekko, HelO2, Mosquito, Solution, Solution Alpha, Solution Nitrox, Spyder, Stinger, Vyper, Vyper 2, Vyper Air, Vytec, Zoop Tusa: Element II (IQ-750), Zen (IQ-900), Zen Air (IQ-950) -Uemis: Zürich +Uemis: Zürich SDA Uwatec: Aladin 2G, Aladin 2G, Aladin Air Twin, Aladin Air Z, Aladin Air Z Nitrox, Aladin Air Z O2, Aladin Prime, Aladin Pro, Aladin Pro Ultra, Aladin Sport Plus, Aladin Tec, Aladin Tec 2G, Galileo Luna, Galileo Sol, Galileo Terra, Galileo Trimix, Memomouse, Smart Com, Smart Pro, Smart Tec, Smart Z -xDeep: Black Zeagle: N2iTiON3 \ No newline at end of file diff --git a/scripts/parse-descriptor.pl b/scripts/parse-descriptor.pl old mode 100644 new mode 100755 index e29658bee..19d4085e8 --- a/scripts/parse-descriptor.pl +++ b/scripts/parse-descriptor.pl @@ -1,37 +1,64 @@ +#!/bin/perl +# +# Extract supported divecomputers from libdivecomputer source +# +# Usage: +# +# parse-descriptor.pl +# +# depending on suffix of the outfile it creates the right content for +# either a text file or and html file use Carp; #set command line arguments my ($infi, $outfi) = @ARGV; my ($type) = $outfi =~ /\.([^.]+)$/; +if ($infi !~ /.*descriptor.c/) { + croak "run as $ARGV[0] \n"; +} + open(my $fh, "<", $infi) || croak "can't open $infi: $!"; open(STDOUT, ">", $outfi) || croak "can't open $outfi: $!"; my $lastVend = ""; +my @descriptors = (); while (<$fh>) { - my ($vend, $mod, $set) = split('\t', $_); - if ($type eq "html") { - if ($vend eq $lastVend) { - printf(", %s", $mod); - } else { - if ($lastVend eq "") { - printf("
      %s
      \n\t
        \n\t
      • %s", $vend, $mod); - } else { - printf("
      • \n\t
      \n
      \n
      %s
      \n\t
        \n\t
      • %s", $vend, $mod); - } + if (/^\s*{\s*"([^\,]*)"\s*,\s*"([^\,]*)"\s*,\s*([^\,]*).*}/) { + push(@descriptors, "$1,$2"); } - } else { - if ($vend eq $lastVend) { - printf(", %s", $mod); +} +my @sortedDescriptors = sort @descriptors; +foreach (@sortedDescriptors) { + ($vend, $mod) = split(',', $_); + if ($type eq "html") { + if ($vend eq $lastVend) { + printf(", %s", $mod); + } else { + if ($lastVend lt "Uemis" && $vend gt "Uemis") { + printf("
      • \n\t
      \n
      \n
      Uemis
      \n\t
        \n\t
      • Zürich SDA"); + } + if ($lastVend eq "") { + printf("
        %s
        \n\t
          \n\t
        • %s", $vend, $mod); + } else { + printf("
        • \n\t
        \n
        \n
        %s
        \n\t
          \n\t
        • %s", $vend, $mod); + } + } } else { - if ($lastVend eq "") { - printf("%s: %s", $vend, $mod); - } else { - printf("\n%s: %s", $vend, $mod); - } + if ($vend eq $lastVend) { + printf(", %s", $mod); + } else { + if ($lastVend lt "Uemis" && $vend gt "Uemis") { + printf("\nUemis: Zürich SDA"); + } + if ($lastVend eq "") { + printf("%s: %s", $vend, $mod); + } else { + printf("\n%s: %s", $vend, $mod); + } + } } - } - $lastVend = $vend; + $lastVend = $vend; } if ($type eq "html") { print("
        • \n\t
        \n
        \n
        ");