File indexing completed on 2024-04-28 03:50:12

0001 #!/usr/bin/perl
0002 
0003 # SPDX-License-Identifier: LGPL-2.1-or-later
0004 #
0005 # SPDX-FileCopyrightText: 2010 Wes Hardaker <hardaker@users.sourceforge.net>
0006 
0007 
0008 print "//
0009 // SPDX-License-Identifier: LGPL-2.1-or-later
0010 //
0011 // SPDX-FileCopyrightText: 2010 Wes Hardaker <hardaker\@users.sourceforge.net>
0012 //
0013 
0014 ";
0015 
0016 print "    // Generated automatically by $0\n";
0017 
0018 print "#include \"AprsGatherer.h\"
0019 
0020 using namespace Marble;
0021 
0022 void AprsGatherer::initMicETables()
0023 {
0024 ";
0025 
0026 foreach my $c ('0'..'9') {
0027     print "    m_dstCallDigits['$c']          = $c;\n";
0028     print "    m_dstCallSouthEast['$c']       = true;\n";
0029     print "    m_dstCallLongitudeOffset['$c'] = 0;\n";
0030     print "    m_dstCallMessageBit['$c']      = 0;\n\n";
0031 }
0032 
0033 foreach my $c ('A'..'J') {
0034     print "    m_dstCallDigits['$c']          = " . (ord($c)-ord('A')) . ";\n";
0035     print "    m_dstCallMessageBit['$c']      = 2;\n\n";    # 1(Custom)
0036 }
0037 
0038     print "    m_dstCallDigits['K']          = 0;\n";     # technically ' '
0039     print "    m_dstCallMessageBit['K']      = 2;\n\n";   # 1(Custom)
0040 
0041     print "    m_dstCallDigits['L']          = 0;\n";     # technically ' '
0042     print "    m_dstCallMessageBit['L']      = 0;\n";
0043     print "    m_dstCallLongitudeOffset['L'] = 0;\n";
0044     print "    m_dstCallSouthEast['L']       = true;\n\n";  
0045 
0046 foreach my $c ('P'..'Y') {
0047     print "    m_dstCallDigits['$c']          = " . (ord($c)-ord('P')) . ";\n";
0048     print "    m_dstCallSouthEast['$c']       = false;\n";
0049     print "    m_dstCallLongitudeOffset['$c'] = 100;\n";
0050     print "    m_dstCallMessageBit['$c']      = 1;\n\n";    # 1 (Standard)
0051 }
0052 
0053 
0054     print "    m_dstCallDigits['Z']          = 0;\n";     # technically ' '
0055     print "    m_dstCallMessageBit['Z']      = 1;\n";     # 1 (Standard)
0056     print "    m_dstCallLongitudeOffset['Z'] = 100;\n";
0057     print "    m_dstCallSouthEast['Z']       = false;\n"; 
0058 
0059 print "\n\n";
0060 
0061 foreach my $c (118..127) {
0062     print "    m_infoFieldByte1[$c] = $c-1128;\n";
0063 }
0064 
0065 foreach my $c (38..127) {
0066     print "    m_infoFieldByte1[$c] = $c-28;\n";
0067 }
0068 
0069 foreach my $c (108..117) {
0070     print "    m_infoFieldByte1[$c] = $c-8;\n";
0071 }
0072 
0073 foreach my $c (110..179) {
0074     print "    m_infoFieldByte1[$c] = $c-8;\n";
0075 }
0076 
0077 print "\n\n";
0078 
0079 print "    m_standardMessageText[0] = \"M0: Off Duty\";\n";
0080 print "    m_standardMessageText[1] = \"M1: En Route\";\n";
0081 print "    m_standardMessageText[2] = \"M2: In Service\";\n";
0082 print "    m_standardMessageText[3] = \"M3: Returning\";\n";
0083 print "    m_standardMessageText[4] = \"M4: Committed\";\n";
0084 print "    m_standardMessageText[5] = \"M5: Special\";\n";
0085 print "    m_standardMessageText[6] = \"M6: Priority\";\n";
0086 print "    m_standardMessageText[7] = \"M7: EMERGENCY\";\n\n";
0087 
0088 for (my $i = 0; $i <= 7; $i++) {
0089     print "    m_customMessageText[$i] = \"Custom-$i\";\n";
0090 }
0091 print "    m_customMessageText[7] = \"M7: EMERGENCY\";\n";
0092 
0093 print "\n";
0094 
0095 foreach my $chr (ord('!') .. ord('~')) {
0096     my $str = chr($chr);
0097     if ($chr eq ord('\'') or $chr eq ord('\\')) {
0098         $str = "\\$str";
0099     }
0100     printf ("    m_pixmaps[QPair<QChar, QChar>('/','%s')] = " .
0101         "\"aprs/primary/%02d.png\";\n", $str, $chr-ord('!'));
0102     printf ("    m_pixmaps[QPair<QChar, QChar>('\\\\','%s')] = " .
0103         "\"aprs/secondary/%02d.png\";\n", $str, $chr-ord('!'));
0104 }
0105 
0106 print "}\n";