Configure Script Engine

* Add menu item "Scripts" and callback function.
    * Add scripting engine.
    * Update script engine for localization strings/messages.
    * Add hierarchy syntax
    * New file run_script.h
    * Hierarchy integration completed
    * Add command set
    * Add 'int find_index(char *)' to combo.cxx
    * Add menu item 'Generate Script' and code for generating a default
      config script file.
    * Add void loadRigXmlFile(void) to rigxml.cxx to support scripting calls.
      - Trim leading/trailing white spaces from portaudio device names.
    * Remove duplicate calling functions/method members.
    * Move command parameter specific verification to run_script.cxx
      basic testing remains in script_parsing.cxx
    * First Document Draft - Script commands
      - Add Misc NBEMS config commands
      - Add Notice - Program restart required.
      - Update Documentation with new commands
    * Removed Unused Variables (multiple locations)
    * Change behavior of floating point output for script generate.
    * Remove function qsy() use restriction on rig control availability.
    * Add strnlen, strncmp and strncpy checks to configure.ac
    * Add trim_white_spaces, strnlen, strncmp and strncpy routines to util.cxx
    * Add pa_set_dev() to soundconf.cxx for updating pa device names.
    * Add code to save macro(s) with content only.
    * Add config_script files to POTFILES.in for localization processing.
    * Flag command types.
    * Limit generate script output based on configure content.
    * Change script error dialog box to warning.
    * Change default rig.xml to rig-unassigned.xml. For testing purposes.
      (script generation)
    * Update Documents with Notes about script generation and executing.
    * Correct \ref and \section name duplicates in doxygen doc source
    * Add script commands for ID->RSID/Video/CW panel.
    * Move Script/Execute/Generate Menu Items to File Menu.
      - Move repetitive code into general functions.
    * Rename "Scripts" menu item to "Config Scripts"
    * Fix error introduced in last mods. Port Audio Gen Config
pull/1/head
Robert Stiles 2015-02-08 08:40:44 -06:00 zatwierdzone przez David Freese
rodzic fffc57c180
commit 814bed31f8
43 zmienionych plików z 8176 dodań i 182 usunięć

Wyświetl plik

@ -121,7 +121,7 @@ AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_STRTOD
AC_CHECK_FUNCS([getaddrinfo gethostbyname hstrerror gmtime_r localtime_r memmove memset mkdir select setenv snprintf socket socketpair strcasecmp strcasestr strchr strdup strerror strlcpy strncasecmp strrchr strstr strtol uname unsetenv vsnprintf])
AC_CHECK_FUNCS([getaddrinfo gethostbyname hstrerror gmtime_r localtime_r memmove memset mkdir select setenv snprintf socket socketpair strcasecmp strcasestr strchr strdup strerror strlcpy strnlen strncasecmp strrchr strstr strtol uname unsetenv vsnprintf])
# Check for O_CLOEXEC
AC_FCNTL_FLAGS

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 8.5 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 34 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 12 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 12 KiB

Wyświetl plik

@ -49,7 +49,7 @@ INPUT = index.txt \
configRTTY.txt configThor.txt ConfigUI-browser.txt \
ConfigUI-contest.txt ConfigUI-general.txt ConfigUI-logging.txt \
ConfigUI-macros.txt configUITouch.txt ConfigUI-WF-controls.txt \
ConfigWaterfall.txt kiss_io_command.txt \
ConfigWaterfall.txt configure_scripting.txt kiss_io_command.txt \
SoundCardSetup.txt Contest-How-To.txt cabrilloreporter.txt \
Logbook.txt LogExports.txt working_logs.txt Macros.txt \
InlineMacroTags.txt atMacroTags.txt advanced_qsy.txt execmacro.txt CW.txt \

Wyświetl plik

@ -98,7 +98,7 @@ Received images are saved in the default folder $HOME/.fldigi/images
(Linux) or \<defaultpath\>/fldigi.files/images (Windows).
<br>
\section tx_image Transmitting an Image
\section mfsk_tx_image Transmitting an Image
\image html Xmt-Pix.png "Xmit Picture Dialog box"
@ -183,7 +183,7 @@ waterfall clearly shows that the image transmission is within the bandwidth
occupied by MFSK-16.
<br>
\section picture_slant Picture with a slant
\section mfsk_picture_slant Picture with a slant
If either the send, receive or both ends of the transmission are using an
uncalibrated sound card whose sampling rate is not an exact multiple of

Wyświetl plik

@ -104,6 +104,20 @@ Exit - exit the program closing down the various interfaces in a nice
controlled manner.
<br>
<HR>
\subsection s_scripts Scripts
Executing and Generating Scripts
\image html menu_script.png "Scripts"
\image latex menu_script.png "Scripts" width=2.0in
<br>
Additional information:
<br>
\ref configure_script_page
<br>
<HR>
\subsection s_op_mode Op Mode

Wyświetl plik

@ -71,9 +71,11 @@ mouse cursor on a digit and then use the mouse wheel to roll the frequency
up and down.
<br>
Manual entry of frequency can be accomplished by clicking on any digit and
then entering the numeric value in KHz. Don't forget the decimal
point if you are entering a fractional KHz value.
Manual entry of frequency can be accomplished by hovering the mouse pointer
over the frequency display and entering the desired frequency (in Khz) via
the keyboard. Pressing \<return\> or \<enter\> on completion sets the
frequency to an active state, effecting rig control and future log entires.
Don't forget the decimal point if you are entering a fractional KHz value.
<br>
The Smeter / Power-meter display is only active if fldigi is configured for xmlrpc
@ -88,8 +90,8 @@ time fldigi is executed.
The mode combobox, the bandwidth combobox and the frequency display
also annunciate the current transceiver status. If you change
operating mode on the transceiver, that will be annunciated in the
respective combobox and fldigi will adjust any internal parameters
accordingly. Fldigi queries the transceiver 10 times per second
respective combobox and FLDigi will adjust any internal parameters
accordingly. FLDigi queries the transceiver 10 times per second
to maintain a lock step with the transceiver.
<br>

Wyświetl plik

@ -43,7 +43,7 @@ until the operator finds an active one.
<br>
<br>
\section freq_inc Frequencies with increments
\section s_freq_inc Frequencies with increments
A frequency can come with an increment: This means an implicit range of
frequencies from this one to the next frequency. If the last frequency

Wyświetl plik

@ -151,17 +151,17 @@ time is explained below. A good setting for nice sounding CW at
<li>Edge decreases pulse width, when checked will give a slightly narrower dot
length as the edge timing is increased. This is useful when
operating QSK and listening between the character elements.</li>
</ul>
<li>The transmitted signal can be further wave shaped using a "Windowed-sinc"
bandpass filter. It is enabled by checking the "BPF transmit audio" check box.
The bandwidth of the filter can be adjusted from 10 to 1000 Hertz with the BPF bw
control. The filter will always be centered on the AFCW injection frequency
(waterfall TX cursor position). You should both visually observe and listen to
control. The filter will always be centered on the AFCW injection frequency
(waterfall TX cursor position). You should both visually observe and listen to
the resulting CW signal. The easiest way to do this is to enable the "Send continuously",
select a test character and then press the TX button on the main dialog. The
weight, dash/dot, edge shape selection, edge timing, BPF and bandwidth can be
changed with immediate effect.
weight, dash/dot, edge shape selection, edge timing, BPF and bandwidth can be
changed with immediate effect.</li>
</ul>
This is what the A2 signal should look like with various settings of
weight, Dash/Dot and Edge. The audio frequency is 400 Hz and

Wyświetl plik

@ -34,6 +34,7 @@
<li>\ref operating_page </li>
<li>\ref logging_page </li>
<li>\ref macro_page </li>
<li>\ref configure_script_page </li>
<li>\ref developers_page </li>
<li>\ref license_page </li>
<li>\ref recognitions_page </li>

Wyświetl plik

@ -34,6 +34,10 @@ if test "x$target_darwin" = "xyes" && test "x$ac_cv_mac_universal" = "xyes"; the
mac_arches="-arch i386 -arch ppc -arch x86_64 -arch ppc64"
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
;;
darwin10*)
mac_arches="-arch i386 -arch x86_64"
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.6.sdk"
;;
*)
mac_arches=""
mac_sysroot=""

Wyświetl plik

@ -29,6 +29,9 @@ src/waterfall/colorbox.cxx
src/widgets/FTextRXTX.cxx
src/widgets/FTextView.cxx
src/widgets/flinput2.cxx
src/config_script/run_scripts.cxx
src/config_script/script_parsing.cxx
src/config_script/create_default_script.cxx
# Generated by fluid
src/dialogs/confdialog.cxx

Wyświetl plik

@ -301,6 +301,11 @@ fldigi_SOURCES += \
filters/filters.cxx \
filters/viterbi.cxx \
globals/globals.cxx \
config_script/create_default_script.cxx \
config_script/run_scripts.cxx \
config_script/run_script.h \
config_script/script_parsing.cxx \
config_script/script_parsing.h \
include/htmlstrings.h \
include/arq_io.h \
include/confdialog.h \

Wyświetl plik

@ -87,11 +87,11 @@ int Fl_PopBrowser::handle(int event)
if (key == 0x1b || kbd == FL_Escape) { // kbd test for OS X
pophide();
return 0;
}
}
if (key >= ' ' || key <= 0x7f) {
keystrokes += key;
for (int i = 0; i < cbx->listsize; i++) {
if (strncasecmp(keystrokes.c_str(),
if (strncasecmp(keystrokes.c_str(),
cbx->datalist[i]->s,
keystrokes.length()) == 0) {
popbrwsr->select(i+1);
@ -198,7 +198,7 @@ void Fl_PopBrowser::pophide ()
Fl::grab(0);
Fl::focus(((Fl_ComboBox*)parent())->btn);
}
}
void Fl_PopBrowser::popbrwsr_cb_i (Fl_Widget *v, long d)
{
@ -401,7 +401,7 @@ int Fl_ComboBox::index() {
}
void * Fl_ComboBox::data() {
return retdata;
return retdata;
}
void Fl_ComboBox::insert(const char *str, void *d)
@ -448,7 +448,7 @@ void Fl_ComboBox::add( const char *s, void * d)
str.erase(0, p+1);
p = str.find("|");
}
if (str.length())
if (str.length())
insert(str.c_str(), 0);
} else
insert( s, d );
@ -457,7 +457,7 @@ void Fl_ComboBox::add( const char *s, void * d)
void Fl_ComboBox::clear()
{
Brwsr->clear();
if (listsize == 0) return;
for (int i = 0; i < listsize; i++) {
delete [] datalist[i]->s;
@ -523,3 +523,17 @@ void Fl_ComboBox::color(Fl_Color c)
val->color(c);
if (Brwsr) Brwsr->color(c);
}
int Fl_ComboBox::find_index(const char *str)
{
if((listsize < 1) || !str)
return -1;
for (int i = 0; i < listsize; i++) {
if(datalist[i]->s)
if(strncmp(datalist[i]->s, str, FILENAME_MAX) == 0)
return i;
}
return -1;
}

Wyświetl plik

@ -0,0 +1,697 @@
// ----------------------------------------------------------------------------
// Copyright (C) 2015
// Robert Stiles
//
// This file is part of fldigi
//
// fldigi is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// fldigi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#include <cstdlib>
#include <cstdarg>
#include <string>
#include <fstream>
#include <algorithm>
#include <map>
#include <unistd.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstring>
#include <ctime>
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <pthread.h>
#include <libgen.h>
#include <ctype.h>
#include <sys/time.h>
#include <string.h>
#include "config.h"
#include <sys/types.h>
#ifdef __WOE32__
# ifdef __CYGWIN__
# include <w32api/windows.h>
# else
# include <windows.h>
# endif
#endif
#include <cstdlib>
#include <cstdarg>
#include <string>
#include <fstream>
#include <algorithm>
#include <map>
#ifndef __WOE32__
#include <sys/wait.h>
#endif
#include "gettext.h"
#include "fl_digi.h"
#include <FL/Fl.H>
#include <FL/fl_ask.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Image.H>
//#include <FL/Fl_Tile.H>
#include <FL/x.H>
#include <FL/Fl_Help_Dialog.H>
#include <FL/Fl_Progress.H>
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Multiline_Input.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Pack.H>
#include <FL/filename.H>
#include <FL/fl_ask.H>
#include "waterfall.h"
#include "raster.h"
#include "progress.h"
#include "Panel.h"
#include "main.h"
#include "threads.h"
#include "trx.h"
#if USE_HAMLIB
#include "hamlib.h"
#endif
#include "timeops.h"
#include "rigio.h"
#include "nullmodem.h"
#include "psk.h"
#include "cw.h"
#include "mfsk.h"
#include "wefax.h"
#include "wefax-pic.h"
#include "navtex.h"
#include "mt63.h"
#include "view_rtty.h"
#include "olivia.h"
#include "contestia.h"
#include "thor.h"
#include "dominoex.h"
#include "feld.h"
#include "throb.h"
//#include "pkt.h"
#include "wwv.h"
#include "analysis.h"
#include "fftscan.h"
#include "ssb.h"
#include "smeter.h"
#include "pwrmeter.h"
#include "ascii.h"
#include "globals.h"
#include "misc.h"
#include "FTextRXTX.h"
#include "confdialog.h"
#include "configuration.h"
#include "status.h"
#include "macros.h"
#include "macroedit.h"
#include "logger.h"
#include "lookupcall.h"
#include "font_browser.h"
#include "icons.h"
#include "pixmaps.h"
#include "rigsupport.h"
#include "qrunner.h"
#include "Viewer.h"
#include "soundconf.h"
#include "htmlstrings.h"
# include "xmlrpc.h"
#if BENCHMARK_MODE
# include "benchmark.h"
#endif
#include "debug.h"
#include "re.h"
#include "network.h"
#include "spot.h"
#include "dxcc.h"
#include "locator.h"
#include "notify.h"
#include "logbook.h"
#include "rx_extract.h"
#include "speak.h"
#include "flmisc.h"
#include "arq_io.h"
#include "data_io.h"
#include "kmlserver.h"
#include "notifydialog.h"
#include "macroedit.h"
#include "rx_extract.h"
#include "wefax-pic.h"
#include "charsetdistiller.h"
#include "charsetlist.h"
#include "outputencoder.h"
#include "record_loader.h"
#include "record_browse.h"
#include "fileselect.h"
#include "waterfall.h"
#include "util.h"
#include "script_parsing.h"
#include "run_script.h"
void cb_create_default_script(void);
static int create_default_script(char *file_name);
static int add_command(FILE *fd, char *cmd, int param, int indent_level);
static int add_command(FILE *fd, char *cmd, char * param, int indent_level);
static int add_command(FILE *fd, char *cmd, int indent_level);
static int add_command(FILE *fd, char *cmd, bool param, int indent_level);
static int add_command(FILE *fd, char *cmd, double param, int indent_level);
static int add_string(FILE *fd, char *cmd, int indent_level);
static void write_macro_list(FILE *fd);
extern pthread_mutex_t mutex_script_io;
/** ********************************************************
* \brief Menu callback. Create default script based on the
* current settings.
* \param none
* \return void
***********************************************************/
void cb_create_default_script(void)
{
pthread_mutex_lock(&mutex_script_io);
static bool first_time = true;
static char script_filename[FL_PATH_MAX + 1];
std::string new_path = "";
if(first_time) {
memset(script_filename, 0, sizeof(script_filename));
strncpy(script_filename, ScriptsDir.c_str(), FL_PATH_MAX);
int len = strnlen(script_filename, FL_PATH_MAX);
if(len > 0) {
len--;
if(script_filename[len] == PATH_CHAR_SEPERATOR);
else strncat(script_filename, PATH_SEPERATOR, FL_PATH_MAX);
} else {
return;
}
strncat(script_filename, "default_script.txt", FL_PATH_MAX);
first_time = false;
}
const char *p = FSEL::saveas((char *)_("Script Files"), (char *)_("*.txt"), \
script_filename);
if(p) {
memset(script_filename, 0, sizeof(script_filename));
strncpy(script_filename, p, FL_PATH_MAX);
Fl::lock();
create_default_script(script_filename);
Fl::unlock();
}
pthread_mutex_unlock(&mutex_script_io);
}
/** ********************************************************
* \brief Create default script based on current settings.
* \param file_name Pointer to the file name and path.
* \return 0 OK, other Error
***********************************************************/
static int create_default_script(char *file_name)
{
FILE *fd = (FILE *)0;
static char buffer[FL_PATH_MAX];
std::string temp = "";
if(!file_name) {
LOG_INFO(_("Invalid File Name Pointer (NULL) in function %s:%d"), __FILE__, __LINE__);
return -1;
}
fd = fopen(file_name, "w");
if(!fd) {
LOG_INFO(_("Unable to create file %s (Error No=%d) func %s:%d"), file_name, errno, __FILE__, __LINE__);
return -1;
}
memset(buffer, 0, sizeof(buffer));
// Tag the text file as a FLDIGI script file
fprintf(fd, _("%s\n# Fldigi Generated Config Script\n"), SCRIPT_FILE_TAG);
time_t thetime = time(0);
fprintf(fd, _("# Created: %s\n"), ctime(&thetime));
// FLDIGI Main Window
if(add_command(fd, (char *)CMD_FLDIGI, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_FREQ, (double) qsoFreqDisp->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_MODE, (char *) qso_opMODE->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_WFHZ, (int) wf->Carrier(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_RXID, (bool) btnRSID->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_TXID, (bool) btnTxRSID->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_SPOT, (bool) btnAutoSpot->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_REV, (bool) wf->btnRev->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_AFC, (bool) btnAFC->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_LOCK, (bool) wf->xmtlock->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_SQL, (bool) btnSQL->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_KPSQL, (bool) btnPSQL->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_FLDIGI_MODEM, (char *) active_modem->get_mode_name(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// OPERATOR
if(add_command(fd, (char *)CMD_OPERATOR, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_CALLSIGN, (char *) inpMyCallsign->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_QTH, (char *) inpMyName->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_NAME, (char *) inpMyQth->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_LOCATOR, (char *) inpMyLocator->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_ANTENNA, (char *) inpMyAntenna->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// AUDIO DEVICE
if(add_command(fd, (char *)CMD_AUDIO_DEVICE, 0)) return fclose(fd);
#if USE_OSS
// OSS
if(add_command(fd, (char *)CMD_OSS_AUDIO, (bool) btnAudioIO[0]->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_OSS_AUDIO_DEV_PATH, (char *) menuOSSDev->value(), 1)) return fclose(fd);
#endif // USE_OSS
#if USE_PORTAUDIO
// PORT AUDIO
if(add_command(fd, (char *)CMD_PORT_AUDIO, (bool) btnAudioIO[1]->value(), 1)) return fclose(fd);
if(menuPortInDev->value() > -1) {
memset(buffer, 0, sizeof(buffer));
snprintf(buffer, sizeof(buffer)-1, "%s:%d,\"%s\"", CMD_PORTA_CAP, menuPortInDev->value(), menuPortInDev->text());
if(add_string(fd, (char *)buffer, 1)) return fclose(fd);
}
if(menuPortOutDev->value() > -1) {
memset(buffer, 0, sizeof(buffer));
snprintf(buffer, sizeof(buffer)-1, "%s:%d,\"%s\"", CMD_PORTA_PLAY, menuPortOutDev->value(), menuPortOutDev->text());
if(add_string(fd, (char *)buffer, 1)) return fclose(fd);
}
#endif // USE_PORTAUDIO
#if USE_PULSEAUDIO
// PULSE AUDIO
if(add_command(fd, (char *)CMD_PULSEA, (bool) btnAudioIO[2]->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_PULSEA_SERVER, (char *) inpPulseServer->value(), 1)) return fclose(fd);
#endif // USE_PULSEAUDIO
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// AUDIO SETTINGS
if(add_command(fd, (char *)CMD_AUDIO_SETTINGS, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_CAPTURE_SAMPLE_RATE, (char *) menuInSampleRate->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_PLAYBACK_SAMPLE_RATE, (char *) menuOutSampleRate->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_AUDIO_CONVERTER, (char *) menuSampleConverter->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RX_PPM, (int) cntRxRateCorr->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_TX_PPM, (int) cntTxRateCorr->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_TX_OFFSET, (int) cntTxOffset->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// AUDIO RIGHT CHANNEL
if(add_command(fd, (char *)CMD_AUDIO_RT_CHANNEL, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_MONO_AUDIO, (bool) chkForceMono->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_AUDIO_L_R, (bool) chkAudioStereoOut->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_AUDIO_REV_L_R, (bool) chkReverseAudio->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_PTT_RIGHT_CHAN, (bool) btnPTTrightchannel2->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_CW_QSK_RT_CHAN, (bool) btnQSK2->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_PSEUDO_FSK_RT_CHAN, (bool) chkPseudoFSK2->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// AUDIO WAVE
if(add_command(fd, (char *)CMD_AUDIO_WAVE, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_WAVE_SR, (char *) listbox_wav_samplerate->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// RIG HRDWR PTT
if(add_command(fd, (char *)CMD_HRDWR_PTT, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPPT_PTT_RT, (bool) btnPTTrightchannel->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_SP2, (bool) btnTTYptt->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_SP2_PATH, (char *) inpTTYdev->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_SP2_RTS, (bool) btnRTSptt->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_SP2_RTS_V, (bool) btnRTSplusV->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_SP2_DTR, (bool) btnDTRptt->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_SP2_DTR_V, (bool) btnDTRplusV->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_PARALLEL, (bool) btnUsePPortPTT->value(), 1)) return fclose(fd);
#if HAVE_UHROUTER
if(add_command(fd, (char *)CMD_HPTT_UHROUTER, (bool) btnUseUHrouterPTT->value(), 1)) return fclose(fd);
#endif
if(add_command(fd, (char *)CMD_HPTT_SP2_START_DELAY, (int) cntPTT_on_delay->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_SP2_END_DELAY, (int) cntPTT_off_delay->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HPTT_SP2_INITIALIZE, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// RIG CAT
if(add_command(fd, (char *)CMD_RIGCAT, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_STATE, (bool) chkUSERIGCAT->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_DEV_PATH, (char *) inpXmlRigDevice->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_DESC_FILE, (char *) progdefaults.XmlRigFilename.c_str(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_RETRIES, (int) cntRigCatRetries->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_RETRY_INTERVAL, (int) cntRigCatTimeout->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_WRITE_DELAY, (int) cntRigCatWait->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_INTIAL_DELAY, (int) cntRigCatInitDelay->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_BAUD_RATE, (char *) listbox_xml_rig_baudrate->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_STOP_BITS, (int) valRigCatStopbits->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_ECHO, (bool) btnRigCatEcho->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_TOGGLE_RTS_PTT, (bool) btnRigCatRTSptt->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_RESTORE, (bool) chk_restore_tio->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_PTT_COMMAND, (bool) btnRigCatCMDptt->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_TOGGLE_DTR_PTT, (bool) btnRigCatDTRptt->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_TOGGLE_RTS_PTT, (bool) btnRigCatRTSptt->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_RTS_12V, (bool) btnRigCatRTSplus->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_DTR_12V, (bool) btnRigCatDTRplus->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_HRDWR_FLOW, (bool) chkRigCatRTSCTSflow->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_VSP, (bool) chkRigCatVSP->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RIGCAT_INITIALIZE, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
#if USE_HAMLIB
// HAMLIB
if(add_command(fd, (char *)CMD_HAMLIB, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_STATE, (bool) chkUSEHAMLIB->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_RIG, (char *) cboHamlibRig->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_DEV_PATH, (char *) inpRIGdev->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_RETRIES, (int) cntHamlibRetries->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_RETRY_INTERVAL, (int) cntHamlibTimeout->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_WRITE_DELAY, (int) cntHamlibWriteDelay->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_POST_WRITE_DELAY, (int) cntHamlibWait->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_BAUD_RATE, (char *) listbox_baudrate->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_STOP_BITS, (int) valHamRigStopbits->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_SIDE_BAND, (char *) listbox_sideband->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_PTT_COMMAND, (bool) btnHamlibCMDptt->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_DTR_12V, (bool) btnHamlibDTRplus->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_RTS_12V, (bool) btnHamlibDTRplus->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_HRDWR_FLOW, (bool) chkHamlibRTSCTSflow->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_SFTWR_FLOW, (bool) chkHamlibXONXOFFflow->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_ADV_CONFIG, (char *) inpHamlibConfig->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_HAMLIB_INITIALIZE, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
#endif //#if USE_HAMLIB
// XMLRPC RC
if(add_command(fd, (char *)CMD_RC_XMLRPC, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_RC_XMLRPC_STATE, (bool) chkUSEXMLRPC->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RC_XMLRPC_BW_DELAY, (double) mbw_delay->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_RC_XMLRPC_INITIALIZE, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// IO Config Panel
if(add_command(fd, (char *)CMD_IO, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_LOCK, (bool) btnDisable_p2p_io_widgets->value(), 1)) return fclose(fd);
if(btnEnable_arq->value()) {
if(add_command(fd, (char *)CMD_IO_ACT_PORT, (char *) PARM_ARQ, 1)) return fclose(fd);
} else if(btnEnable_kiss->value()) {
if(add_command(fd, (char *)CMD_IO_ACT_PORT, (char *) PARM_KISS, 1)) return fclose(fd);
}
if(add_command(fd, (char *)CMD_IO_AX25_DECODE, (bool) btnEnable_ax25_decode->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_CSMA, (bool) btnEnable_csma->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_KISS, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_KISS_IPA, (char *) txtKiss_ip_address->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_KISS_IOPN, (char *) txtKiss_ip_io_port_no->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_KISS_OPN, (char *) txtKiss_ip_out_port_no->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_KISS_DP, (bool) btnEnable_dual_port->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_KISS_BUSY, (bool) btnEnableBusyChannel->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_KISS_CONT, (int) cntBusyChannelSeconds->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_KISS_ATTEN, (int) cntKPSQLAttenuation->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_ARQ, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_ARQ_IPA, (char *) txtArq_ip_address->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_ARQ_IOPN, (char *) txtArq_ip_port_no->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_XMLRPC, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_XMLRPC_IPA, (char *) txtXmlrpc_ip_address->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_IO_XMLRPC_IOPN, (char *) txtXmlrpc_ip_port_no->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// NBEMS
if(add_command(fd, (char *)CMD_NBEMS, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_NBEMS_STATE, (bool) chkAutoExtract->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_NBEMS_MSG, (bool) chk_open_wrap_folder->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_NBEMS_FLMSG, (bool) chk_open_flmsg->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_NBEMS_FLMSG_PATH, (char *) txt_flmsg_pathname->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_NBEMS_BRWSR, (bool) chk_open_flmsg_print->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_NBEMS_TIMEOUT, (double) sldr_extract_timeout->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// ID/RSID/VIDEO/CW
if(add_command(fd, (char *)CMD_ID, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_NOTIFY, (bool) chkRSidNotifyOnly->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_SRCH_BP, (bool) chkRSidWideSearch->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_MARK_PREV, (bool) chkRSidMark->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_DETECTOR, (bool) chkRSidAutoDisable->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_ALRT_DIALOG, (bool) chkRSidShowAlert->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_TX_FREQ_LOCK, (bool) chkRetainFreqLock->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_FREQ_CHANGE, (bool) chkDisableFreqChange->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_ALLOW_ERRORS, (char *) listbox_rsid_errors->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_SQL_OPEN, (int) sldrRSIDsquelch->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_PRETONE, (double) val_pretone->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_RSID_END_XMT_ID, (bool) btn_post_rsid->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_VIDEO, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_VIDEO_TX_ID_MODE, (bool) btnsendid->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_VIDEO_TX_VIDEO_TXT, (bool) btnsendvideotext->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_VIDEO_TX_TXT_INP, (char *) valVideotext->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_VIDEO_SMALL_FONT, (bool) chkID_SMALL->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_VIDEO_500_HZ, (bool) btn_vidlimit->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_VIDEO_WIDTH_LIMIT, (bool) btn_vidmodelimit->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_VIDEO_CHAR_ROW, (int) sldrVideowidth->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_CW, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_CW_TX_CALLSIGN, (bool) btnCWID->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_ID_CW_SPEED, (int) sldrCWIDwpm->value(), 2)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_END_CMD, 0)) return fclose(fd);
// MACROS
write_macro_list(fd);
return fclose(fd);
}
/** ********************************************************
* \brief Write the current macro list in script format
* \param fd File descriptor
* \param cmd Pointer to the file name and path.
* \return 0 OK, other Error
***********************************************************/
static void write_macro_list(FILE *fd)
{
if(!fd) return;
int index = 0;
int row = 0;
int col = 0;
bool save_flag = false;
int count = 0;
char * cPtr = (char *)0;
for(index = 0; index < MAXMACROS; index++) {
// Do not save empty macros
count = macros.text[index].size();
if(count < 1) continue;
cPtr = (char *) macros.text[index].c_str();
while(count-- > 0) {
if(*cPtr++ > ' ') {
save_flag = true;
break;
}
}
if(save_flag) {
col = (index / NUMMACKEYS) + 1;
row = (index % NUMMACKEYS) + 1;
fprintf(fd, "\n%s:%d,%d,\"%s\"\n", (char *) CMD_LOAD_MACRO, col, row, macros.name[index].c_str());
fprintf(fd, "%s\n", macros.text[index].c_str());
fprintf(fd, "%s:\n",(char *) CMD_END_CMD);
save_flag = false;
}
}
}
/** ********************************************************
* \brief Add command and paramter to script file
* \param fd File descriptor
* \param cmd Pointer to the file name and path.
* \return 0 OK, other Error
***********************************************************/
static int add_command(FILE *fd, char *cmd, double param, int indent_level)
{
if(!fd || !cmd)
return -1;
char buffer[32];
memset(buffer, 0, sizeof(buffer));
if((param > -1000.0) && (param < 1000.0))
snprintf(buffer, sizeof(buffer) - 1, "%1.3f", param);
else
snprintf(buffer, sizeof(buffer) - 1, "%1.9e", param);
return add_command(fd, cmd, buffer, indent_level);
}
/** ********************************************************
* \brief Add command and paramter to script file
* \param fd File descriptor
* \param cmd Pointer to the file name and path.
* \return 0 OK, other Error
***********************************************************/
static int add_command(FILE *fd, char *cmd, bool param, int indent_level)
{
if(!fd || !cmd)
return -1;
char buffer[32];
memset(buffer, 0, sizeof(buffer));
if(param)
strncpy(buffer, PARM_ENABLE, sizeof(buffer)-1);
else
strncpy(buffer, PARM_DISABLE, sizeof(buffer)-1);
return add_command(fd, cmd, buffer, indent_level);
}
/** ********************************************************
* \brief Add command and paramter to script file
* \param fd File descriptor
* \param cmd Pointer to the file name and path.
* \return 0 OK, other Error
***********************************************************/
static int add_command(FILE *fd, char *cmd, int param, int indent_level)
{
if(!fd || !cmd)
return -1;
char buffer[32];
memset(buffer, 0, sizeof(buffer));
snprintf(buffer, sizeof(buffer) - 1, "%d", param);
return add_command(fd, cmd, buffer, indent_level);
}
/** ********************************************************
* \brief Add command and paramter to script file
* \param fd File descriptor
* \param cmd Pointer to the file name and path.
* \return 0 OK, other Error
***********************************************************/
static int add_command(FILE *fd, char *cmd, char *param, int indent_level)
{
if(!fd || !cmd || !param)
return -1;
bool q_flag = false;
int size = strnlen(param, FILENAME_MAX);
if(size < 1) return 0;
for(int i = 0; i < size; i++) {
if(param[i] == 0) break;
if((param[i] == ',') || (param[i] <= ' ')) {
q_flag = true;
}
}
std::string indent = "";
for(int i = 0; i < indent_level; i++)
indent.append(" ");
if(q_flag)
fprintf(fd, "%s%s:\"%s\"\n", indent.c_str(), cmd, param);
else
fprintf(fd, "%s%s:%s\n", indent.c_str(), cmd, param);
return ferror(fd);
}
/** ********************************************************
* \brief Add command and paramter to script file
* \param fd File descriptor
* \param cmd Pointer to the file name and path.
* \return 0 OK, other Error
***********************************************************/
static int add_command(FILE *fd, char *cmd, int indent_level)
{
if(!fd || !cmd)
return -1;
std::string indent = "";
for(int i = 0; i < indent_level; i++)
indent.append(" ");
fprintf(fd, "%s%s:\n", indent.c_str(), cmd);
return ferror(fd);
}
/** ********************************************************
* \brief Add command and paramter to script file
* \param fd File descriptor
* \param cmd Pointer to the file name and path.
* \return 0 OK, other Error
***********************************************************/
static int add_string(FILE *fd, char *cmd, int indent_level)
{
if(!fd || !cmd)
return -1;
std::string indent = "";
for(int i = 0; i < indent_level; i++)
indent.append(" ");
fprintf(fd, "%s%s\n", indent.c_str(), cmd);
return ferror(fd);
}

Wyświetl plik

@ -0,0 +1,168 @@
// ----------------------------------------------------------------------------
// Copyright (C) 2015
// Robert Stiles
//
// This file is part of fldigi
//
// fldigi is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// fldigi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#ifndef _run_script_h
#define _run_script_h
extern int process_callsign_info(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_name_info(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_qth_info(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_locator_info(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_antenna_info(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_use_oss_audio_device(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_oss_audio_device_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_use_port_audio_device(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_capture_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_playback_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_use_pulse_audio_device(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_pulse_audio_device_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_audio_device_sample_rate_capture(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_audio_device_sample_rate_playback(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_audio_device_converter(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rx_ppm(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_tx_ppm(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_tx_offset(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_mono_audio_output(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_modem_signal_left_right(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_reverse_left_right(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_ptt_tone_right_channel(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_cw_qsk_right_channel(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_pseudo_fsk_right_channel(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_wave_file_sample_rate(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_right_audio_channel(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_sep_serial_port(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_sep_serial_port_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_sep_serial_port_rts(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_sep_serial_port_dtr(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_sep_serial_port_rts_v(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_sep_serial_port_dtr_v(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_start_delay(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_end_delay(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_uhrouter(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hrdw_ptt_initialize(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_use_rigcat(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_desc_file(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_device_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_retries(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_retry_interval(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_write_delay(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_init_delay(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_baud_rate(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_stop_bits(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_commands_echoed(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_toggle_rts_ptt(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_restore_on_close(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_cat_command_ptt(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_dtr_12v(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_rts_12v(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_hrdwr_flow(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_vsp_enable(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rigcat_initialize(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_use_hamlib(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_rig(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_device_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_retries(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_retry_interval(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_write_delay(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_post_write_delay(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_baud_rate(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_stop_bits(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_sideband(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_ptt_hl_command(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_dtr_12(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_rts_12(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_rts_cts_flow(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_xon_xoff_flow(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_advanced_config(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_hamlib_initialize(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_use_xml_rpc(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_xml_rpc_mode_bw_delay(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_xml_rpc_initialize(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_kiss_ip_address(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_kiss_io_port_no(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_kiss_o_port_no(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_kiss_dual_port(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_kiss_busy_channel(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_kiss_continue_after(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_kiss_kpsql_atten(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_arq_ip_address(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_arq_io_port_no(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_xmlrpc_ip_address(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_xmlrpc_io_port_no(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_lock(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_active_port(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_ax25_decode(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_io_csma(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_misc_nbems_state(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_misc_nbems_open_flmsg(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_misc_nbems_open_msg(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_misc_nbems_open_brwsr(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_misc_nbems_flmsg_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_misc_nbems_timeout(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_notify(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_search_bp(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_mark_prev(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_detector(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_alert_dialog(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_tx_freq_lock(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_freq_change(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_allow_errors(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_sql_open(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_pretone(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_end_xmt_id(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_video_tx_id_mode(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_video_tx_vid_txt(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_video_txt_input(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_video_small_font(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_video_500hz(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_video_width_limit(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rsid_char_per_row(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_cw_callsign(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_cw_speed(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
// FLDIGI main windows widgets
extern int process_rig_freq(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rig_mode(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_wf_hz_offset(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rx_rsid(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_tx_rsid(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_spot(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_rev(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_afc(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_lock(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_sql(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_kpsql(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_modem(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_load_macro(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
#endif

Plik diff jest za duży Load Diff

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,470 @@
//======================================================================
// script_parsing.h (FLDIGI)
//
// Author(s):
//
// Robert Stiles, KK5VD, Copyright (C) 2014
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// =====================================================================
#ifndef __script_parsing__
#define __script_parsing__
#include <string>
#include <stdio.h>
#ifdef __WIN32__
#define PATH_SEPERATOR "\\"
#define PATH_CHAR_SEPERATOR '\\'
#include <direct.h>
#define get_current_dir _getcwd
#else
#define PATH_SEPERATOR "/"
#define PATH_CHAR_SEPERATOR '/'
#include <unistd.h>
#define get_current_dir getcwd
#endif
#define MAX_CMD_PARAMETERS 5
#define MAX_COMMAND_LENGTH 128
#define MAX_PARAMETER_LENGTH FILENAME_MAX
#define MAX_READLINE_LENGTH (FILENAME_MAX+FILENAME_MAX)
#define MAX_SUB_SCRIPTS 5
#define SCRIPT_FILE_TAG ((char *)"FLDIGI_CONFIG")
#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
#define RESET_ALL 0x01
#define RESET_PARTIAL 0X02
#undef __LOCALIZED_SCRIPT_COMMANDS
#ifdef __LOCALIZED_SCRIPT_COMMANDS
#pragma message ( \
"\n" \
"************************************************************************\n" \
"* Defining __LOCALIZED_SCRIPT_COMMANDS breaks script compatibility. In *\n" \
"* doing so, FLDIGI development team does not assume responsibility for *\n" \
"* maintaining the code sections that are altered/effected as a result. *\n" \
"************************************************************************\n" )
#define F_LOC(a) _(a)
#else
#define F_LOC(a) a
#endif
#define CMD_OPERATOR F_LOC("OPERATOR")
#define CMD_CALLSIGN F_LOC("CALLSIGN")
#define CMD_NAME F_LOC("NAME")
#define CMD_QTH F_LOC("QTH")
#define CMD_LOCATOR F_LOC("LOC")
#define CMD_ANTENNA F_LOC("ANT")
#define CMD_AUDIO_DEVICE F_LOC("AUDIO DEVICE")
#define CMD_OSS_AUDIO F_LOC("OSS")
#define CMD_OSS_AUDIO_DEV_PATH F_LOC("OSS DEV")
#define CMD_PORT_AUDIO F_LOC("PA")
#define CMD_PORTA_CAP F_LOC("PA CAPTURE")
#define CMD_PORTA_PLAY F_LOC("PA PLAYBACK")
#define CMD_PULSEA F_LOC("PUA")
#define CMD_PULSEA_SERVER F_LOC("PUA SERVER")
#define CMD_AUDIO_SETTINGS F_LOC("AUDIO SETTINGS")
#define CMD_CAPTURE_SAMPLE_RATE F_LOC("CAPTURE")
#define CMD_PLAYBACK_SAMPLE_RATE F_LOC("PLAYBACK")
#define CMD_AUDIO_CONVERTER F_LOC("CONVERTER")
#define CMD_RX_PPM F_LOC("RX PPM")
#define CMD_TX_PPM F_LOC("TX PPM")
#define CMD_TX_OFFSET F_LOC("TX OFFSET")
#define CMD_AUDIO_RT_CHANNEL F_LOC("AUDIO RT CHANNEL")
#define CMD_MONO_AUDIO F_LOC("MONO AUDIO")
#define CMD_AUDIO_L_R F_LOC("MODEM LR")
#define CMD_AUDIO_REV_L_R F_LOC("REV LR")
#define CMD_PTT_RIGHT_CHAN F_LOC("PTT RT CHAN")
#define CMD_CW_QSK_RT_CHAN F_LOC("QSK RT CHAN")
#define CMD_PSEUDO_FSK_RT_CHAN F_LOC("FSK RT CHAN")
#define CMD_AUDIO_WAVE F_LOC("AUDIO WAVE")
#define CMD_WAVE_SR F_LOC("SRATE")
#define CMD_HRDWR_PTT F_LOC("RIG HRDWR PTT")
#define CMD_HPPT_PTT_RT F_LOC("PTT RT CHAN")
#define CMD_HPTT_SP2 F_LOC("SERIAL PORT")
#define CMD_HPTT_SP2_PATH F_LOC("DEVICE")
#define CMD_HPTT_SP2_RTS F_LOC("RTS")
#define CMD_HPTT_SP2_DTR F_LOC("DTR")
#define CMD_HPTT_SP2_RTS_V F_LOC("RTSV")
#define CMD_HPTT_SP2_DTR_V F_LOC("DTRV")
#define CMD_HPTT_SP2_START_DELAY F_LOC("START PTT DELAY")
#define CMD_HPTT_SP2_END_DELAY F_LOC("END PTT DELAY")
#define CMD_HPTT_UHROUTER F_LOC("UHROUTER")
#define CMD_HPTT_PARALLEL F_LOC("PARALLEL")
#define CMD_HPTT_SP2_INITIALIZE F_LOC("INIT")
#define CMD_RIGCAT F_LOC("RIGCAT")
#define CMD_RIGCAT_STATE F_LOC("STATE")
#define CMD_RIGCAT_DESC_FILE F_LOC("DESC FILE")
#define CMD_RIGCAT_DEV_PATH F_LOC("DEV PATH")
#define CMD_RIGCAT_RETRIES F_LOC("RETRIES")
#define CMD_RIGCAT_RETRY_INTERVAL F_LOC("RETRY INT")
#define CMD_RIGCAT_WRITE_DELAY F_LOC("WDELAY")
#define CMD_RIGCAT_INTIAL_DELAY F_LOC("IDELAY")
#define CMD_RIGCAT_BAUD_RATE F_LOC("BRATE")
#define CMD_RIGCAT_STOP_BITS F_LOC("SBITS")
#define CMD_RIGCAT_ECHO F_LOC("ECHO")
#define CMD_RIGCAT_TOGGLE_RTS_PTT F_LOC("TOGGLE RTS PTT")
#define CMD_RIGCAT_TOGGLE_DTR_PTT F_LOC("TOGGLE DTR PTT")
#define CMD_RIGCAT_RESTORE F_LOC("RESTORE")
#define CMD_RIGCAT_PTT_COMMAND F_LOC("PTT COMMAND")
#define CMD_RIGCAT_RTS_12V F_LOC("RTS 12V")
#define CMD_RIGCAT_DTR_12V F_LOC("DTR 12V")
#define CMD_RIGCAT_HRDWR_FLOW F_LOC("HRDWR FC")
#define CMD_RIGCAT_VSP F_LOC("VSP")
#define CMD_RIGCAT_INITIALIZE F_LOC("INIT")
#define CMD_HAMLIB F_LOC("HAMLIB")
#define CMD_HAMLIB_STATE F_LOC("STATE")
#define CMD_HAMLIB_RIG F_LOC("RIG")
#define CMD_HAMLIB_DEV_PATH F_LOC("DEV PATH")
#define CMD_HAMLIB_RETRIES F_LOC("RETRIES")
#define CMD_HAMLIB_RETRY_INTERVAL F_LOC("RETRY INT")
#define CMD_HAMLIB_WRITE_DELAY F_LOC("WDELAY")
#define CMD_HAMLIB_POST_WRITE_DELAY F_LOC("PWDELAY")
#define CMD_HAMLIB_BAUD_RATE F_LOC("BRATE")
#define CMD_HAMLIB_STOP_BITS F_LOC("SBITS")
#define CMD_HAMLIB_SIDE_BAND F_LOC("SBAND")
#define CMD_HAMLIB_PTT_COMMAND F_LOC("PTT COMMAND")
#define CMD_HAMLIB_DTR_12V F_LOC("DTR 12V")
#define CMD_HAMLIB_RTS_12V F_LOC("RTS 12V")
#define CMD_HAMLIB_HRDWR_FLOW F_LOC("HRDWR FC")
#define CMD_HAMLIB_SFTWR_FLOW F_LOC("SFTWR FC")
#define CMD_HAMLIB_ADV_CONFIG F_LOC("ADV CONF")
#define CMD_HAMLIB_INITIALIZE F_LOC("INIT")
#define CMD_RC_XMLRPC F_LOC("XMLRPC RC")
#define CMD_RC_XMLRPC_STATE F_LOC("STATE")
#define CMD_RC_XMLRPC_BW_DELAY F_LOC("BWDELAY")
#define CMD_RC_XMLRPC_INITIALIZE F_LOC("INIT")
#define CMD_FLDIGI F_LOC("FLDIGI")
#define CMD_FLDIGI_FREQ F_LOC("FREQ")
#define CMD_FLDIGI_MODE F_LOC("MODE")
#define CMD_FLDIGI_WFHZ F_LOC("WFHZ")
#define CMD_FLDIGI_RXID F_LOC("RXID")
#define CMD_FLDIGI_TXID F_LOC("TXID")
#define CMD_FLDIGI_SPOT F_LOC("SPOT")
#define CMD_FLDIGI_REV F_LOC("REV")
#define CMD_FLDIGI_LOCK F_LOC("LOCK")
#define CMD_FLDIGI_AFC F_LOC("AFC")
#define CMD_FLDIGI_SQL F_LOC("SQL")
#define CMD_FLDIGI_KPSQL F_LOC("KPSQL")
#define CMD_FLDIGI_MODEM F_LOC("MODEM")
#define CMD_IO F_LOC("IO")
#define CMD_IO_LOCK F_LOC("LOCK")
#define CMD_IO_ACT_PORT F_LOC("PORT")
#define CMD_IO_AX25_DECODE F_LOC("AX25D")
#define CMD_IO_CSMA F_LOC("CSMA")
#define CMD_IO_KISS F_LOC("KISS")
#define CMD_IO_KISS_IPA F_LOC("IPA")
#define CMD_IO_KISS_IOPN F_LOC("IOPN")
#define CMD_IO_KISS_OPN F_LOC("OPN")
#define CMD_IO_KISS_DP F_LOC("DP")
#define CMD_IO_KISS_BUSY F_LOC("BUSY")
#define CMD_IO_KISS_CONT F_LOC("CONT")
#define CMD_IO_KISS_ATTEN F_LOC("ATTEN")
#define CMD_IO_ARQ F_LOC("ARQ")
#define CMD_IO_ARQ_IPA F_LOC("IPA")
#define CMD_IO_ARQ_IOPN F_LOC("IOPN")
#define CMD_IO_XMLRPC F_LOC("XMLRPC")
#define CMD_IO_XMLRPC_IPA F_LOC("IPA")
#define CMD_IO_XMLRPC_IOPN F_LOC("IOPN")
#define CMD_NBEMS F_LOC("MISC NBEMS")
#define CMD_NBEMS_STATE F_LOC("STATE")
#define CMD_NBEMS_MSG F_LOC("OPEN MSG")
#define CMD_NBEMS_FLMSG F_LOC("OPEN FLMSG")
#define CMD_NBEMS_FLMSG_PATH F_LOC("PATH")
#define CMD_NBEMS_BRWSR F_LOC("OPEN BRWSR")
#define CMD_NBEMS_TIMEOUT F_LOC("TIMEOUT")
#define CMD_ID F_LOC("ID")
#define CMD_ID_RSID F_LOC("RSID")
#define CMD_ID_RSID_NOTIFY F_LOC("NOTIFY")
#define CMD_ID_RSID_SRCH_BP F_LOC("SRCH BP")
#define CMD_ID_RSID_MARK_PREV F_LOC("MARK PREV")
#define CMD_ID_RSID_DETECTOR F_LOC("DETECTOR")
#define CMD_ID_RSID_ALRT_DIALOG F_LOC("ALRT DIALOG")
#define CMD_ID_RSID_TX_FREQ_LOCK F_LOC("TX FREQ LOCK")
#define CMD_ID_RSID_FREQ_CHANGE F_LOC("FREQ CHANGE")
#define CMD_ID_RSID_ALLOW_ERRORS F_LOC("ALLOW ERRORS")
#define CMD_ID_RSID_SQL_OPEN F_LOC("SQL OPEN")
#define CMD_ID_RSID_PRETONE F_LOC("PRETONE")
#define CMD_ID_RSID_END_XMT_ID F_LOC("END XMT ID")
#define CMD_ID_VIDEO F_LOC("VIDEO")
#define CMD_ID_VIDEO_TX_ID_MODE F_LOC("ID MODE")
#define CMD_ID_VIDEO_TX_VIDEO_TXT F_LOC("VIDEO TXT")
#define CMD_ID_VIDEO_TX_TXT_INP F_LOC("TEXT INPUT")
#define CMD_ID_VIDEO_SMALL_FONT F_LOC("SMALL FONT")
#define CMD_ID_VIDEO_500_HZ F_LOC("500HZ")
#define CMD_ID_VIDEO_WIDTH_LIMIT F_LOC("WIDTH LIMIT")
#define CMD_ID_VIDEO_CHAR_ROW F_LOC("CHAR ROW")
#define CMD_ID_CW F_LOC("CW")
#define CMD_ID_CW_TX_CALLSIGN F_LOC("TX CALL")
#define CMD_ID_CW_SPEED F_LOC("SPEED")
#define CMD_LOAD_MACRO F_LOC("MACRO")
#define CMD_END_CMD F_LOC("END")
// Parameters localized - no restrictions.
#define PARM_ENABLE _("ENABLE")
#define PARM_YES _("YES")
#define PARM_DISABLE _("DISABLE")
#define PARM_NO _("NO")
#define PARM_KISS _("KISS")
#define PARM_ARQ _("ARQ")
#define SCRIPT_COMMAND 0x0001
#define SCRIPT_DOT_NOTATION_ONLY 0x0002
#define SCRIPT_STRUCTURED_ONLY 0x0004
#define RECURSIVE_LIMIT 3
#define MAX_DELETE_LIST_COUNT 100
//! @enum script_codes
//! Error codes.
//! @typedef SCRIPT_CODES
//! @see script_codes
typedef enum script_codes {
script_recursive_limit_reached = -100, //!< Reached command recursive limit.
script_command_not_found = -100, //!< Script command not found.
script_unexpected_eof, //!< Unexspected end of file reached.
script_file_read_error, //!< File read error
script_errors_reported, //!< Script Errors found during parsing of file.
script_file_not_found, //!< Script file not found.
script_path_not_found, //!< Script directory path not found.
script_device_path_not_found, //!< Script device path not found.
script_non_script_file, //!< Opened file not a Script file.
script_max_sub_script_reached, //!< Maximum open subscripts reached.
script_subscript_exec_fail, //!< Subscript execution fail (internal).
script_incorrectly_assigned_value, //!< Incorrect parameter type.
script_invalid_parameter, //!< Parameter is not valid.
script_parameter_error, //!< Script parameter invalid.
script_function_parameter_error, //!< Function parameter error (internal, non script error).
script_mismatched_quotes, //!< Opening or closing quotes missing prior to reaching end if line.
script_command_seperator_missing, //!< Command missing ':'
script_args_eol, //!< Reached end of args list sooner then expected
script_param_check_eol, //!< Reached end of parameter check list sooner then expected
script_paramter_exceeds_length, //!< Data length exceeds expectations
script_memory_allocation_error, //!< Memory Allocation Error (Non-Script internal Error).
script_general_error = -1, //!< General purpose error (undefined erros).
script_no_errors, //!< No Errors
script_char_match_not_found, //!< Search char not found (Warning)
script_end_of_line_reached, //!< End of line reached (Warning)
script_end_of_list_reached, //!< End of list reached (Info)
script_list, //!< List command (Info)
script_command_handled, //!< Command was procedded and handled (Info)
} SCRIPT_CODES;
//! @enum paramter_types
//! Parameter type flags. Used to validate the informarion.
//! @typedef PARAM_TYPES
//! @see paramter_types
typedef enum paramter_types {
p_null = 0,
p_void,
p_bool,
p_char,
p_int,
p_unsigned_int,
p_long,
p_unsigned_long,
p_float,
p_double,
p_string,
p_path,
p_filename,
p_dev_path,
p_dev_name,
p_list,
p_list_end
} PARAM_TYPES;
class ScriptParsing;
//! @struct script_cmds
//! Vector table of script command string and executing function member.
//! @typedef SCRIPT_COMMANDS
//! @see script_cmds
typedef struct script_cmds {
char command[MAX_COMMAND_LENGTH]; //!< Command matching string.
int flags; //!< General purpose flags
size_t command_length; //!< Number of chacters in the command string.
int argc; //!< Number of required prarmeters for the command
char *args[MAX_CMD_PARAMETERS+1]; //!< String vector table of parameters
enum paramter_types param_check[MAX_CMD_PARAMETERS+1]; //!< Flags to determine type of parameter.
const char **valid_values; //!< A list of valid paramters.
int valid_value_count; //!< The number of valid paramters.
SCRIPT_CODES (ScriptParsing::*func)(struct script_cmds *); //!< The function (member) to execute on positive match
int (*cb)(ScriptParsing *sp, struct script_cmds *sd); //!< Call back function for script command
struct script_cmds * sub_commands; //!< List of sub commands
size_t sub_command_count; //!< Number of table entires in the sub table.
} SCRIPT_COMMANDS;
//! @class script_parsing_class
class ScriptParsing {
public:
private:
pthread_mutex_t ac; //<! Thread safe data access
int recursive_count;
bool _script_error_detected;
bool _restart_flag;
FILE *fd;
int line_number;
// Storage for each parameter
// Special processing data storage.
std::string _macro_command;
// Internal Class Variables.
std::string _path;
int _file_type;
SCRIPT_COMMANDS *_script_commands; //!< Table of commands and vector functions @see script_cmds
size_t _script_command_count; //!< Number of assigned positions in the table.
ScriptParsing *_parent; //!< Calling ScriptParsing pointer. Primarly used for the reset command on the local 'this' pointer.
// Keep track of what needs to be deleted on exit (deallocation).
SCRIPT_COMMANDS * memory_delete_list[MAX_DELETE_LIST_COUNT];
int delete_list_count; // Number of entries in the table.
char line_buffer[MAX_READLINE_LENGTH + 1]; //!< Line buffer for script read operations.
char error_cmd_buffer[MAX_COMMAND_LENGTH];
char error_string[MAX_COMMAND_LENGTH];
char error_buffer[MAX_COMMAND_LENGTH + MAX_COMMAND_LENGTH + 1];
SCRIPT_COMMANDS *top_cache;
public:
// Aceess methods for special processing data
std::string macro_command(void) { return _macro_command; }
void macro_command(std::string str) { _macro_command.assign(str); }
bool restart_flag(void) { return _restart_flag; }
void restart_flag(bool value) { _restart_flag = value; }
bool script_errors(void) { return _script_error_detected; }
// Parsing/varification routine for each of the commands.
SCRIPT_CODES check_parameters(struct script_cmds *);
SCRIPT_CODES check_filename(char *filename);
SCRIPT_CODES check_path(const char *);
SCRIPT_CODES check_numbers(char *, paramter_types p);
SCRIPT_CODES check_dev_path(const char *path);
SCRIPT_CODES check_bool(const char *value, bool &flag);
void to_uppercase(char *str, int limit);
void to_uppercase(std::string &str);
void trim(char *buffer, size_t size);
std::string &trim(std::string &s);
// Script handling code.
inline SCRIPT_CODES test_on_off_state(bool &state, char *string, char *true_state);
SCRIPT_COMMANDS * script_commands(void) { return _script_commands; }
void script_commands(SCRIPT_COMMANDS *ptr) { if(ptr) _script_commands = ptr; }
size_t script_command_count(void) { return _script_command_count; }
void script_command_count(size_t value) { _script_command_count = value; }
// Internal script fuctions
SCRIPT_CODES parse_commands(char *file_name_path); //!< The calling function to parse a script file.
SCRIPT_CODES read_file(FILE *fd, SCRIPT_COMMANDS *cur_list, size_t limit);
ScriptParsing *parent(void) { return _parent; }
void parent(ScriptParsing *value) { _parent = value; }
int assign_callback(const char *scriptCommand, int (*cb)(ScriptParsing *sp, SCRIPT_COMMANDS *sc));
int assign_valid_parameters(const char *command, const char **array, const int array_count);
void defaults(bool all);
ScriptParsing();
~ScriptParsing();
private:
// Special processing member.
SCRIPT_CODES sc_macros(struct script_cmds *cmd);
// Internal class routines
void add_to_delete_list(SCRIPT_COMMANDS *);
SCRIPT_CODES sc_dummy(struct script_cmds *);
SCRIPT_CODES remove_crlf_comments(char *data, char *limit, size_t &count);
SCRIPT_CODES parse_single_command(FILE *fd, SCRIPT_COMMANDS *cur_list, size_t limit, char *data, size_t buffer_size);
SCRIPT_CODES parse_hierarchy_command(char *data, size_t buffer_size);
int copy_tables(struct script_cmds * subcmds, size_t count);
std::string path(void) { return _path; }
int file_type(void) { return _file_type; }
void file_type(int value) { _file_type = value; }
SCRIPT_COMMANDS * search_command(SCRIPT_COMMANDS * table, size_t limit, const char *command);
SCRIPT_CODES copy_string_uppercase(char *buffer, char *cPtr, char *ePtr, size_t limit);
SCRIPT_CODES parse_parameters(char *s, char *d, SCRIPT_COMMANDS *matching_command);
int call_callback(SCRIPT_COMMANDS *cb_data);
int check_parameters_from_list(SCRIPT_COMMANDS *sc);
int CopyScriptParsingEnv(ScriptParsing *src);
void clear_script_parameters(bool all);
SCRIPT_CODES assign_member_func(char *cmd, SCRIPT_CODES (ScriptParsing::*func)(struct script_cmds *));
void initialize_function_members(void);
int str_cnt(char * str, int count_limit);
char * script_error_string(SCRIPT_CODES error_no, int ln, char *cmd);
char * skip_alpha_numbers(char * data, char *limit, SCRIPT_CODES &error);
char * skip_characters(char * data, char *limit, SCRIPT_CODES &error);
char * skip_numbers(char * data, char *limit, SCRIPT_CODES &error);
char * skip_spaces(char * data, char *limit, SCRIPT_CODES &error);
char * skip_to_character(char c, char * data, char *limit, SCRIPT_CODES &error);
char * skip_white_spaces(char * data, char *limit, SCRIPT_CODES &error);
};
int callback_dummy(ScriptParsing *sp, struct script_cmds *sc);
#endif /* defined(__script_parsing__) */

Wyświetl plik

@ -1501,7 +1501,7 @@ void macro_cb(Fl_Widget *w, void *v)
{
int b = (int)(reinterpret_cast<long> (v));
if (progdefaults.mbar_scheme > 2) {
if (progdefaults.mbar_scheme > MACRO_SINGLE_BAR_MAX) {
if (b >= NUMMACKEYS) b += (altMacros - 1) * NUMMACKEYS;
} else {
b += altMacros * NUMMACKEYS;
@ -1579,7 +1579,7 @@ void altmacro_cb(Fl_Widget *w, void *v)
else
altMacros = altMacros + (Fl::event_button() == FL_RIGHT_MOUSE ? -1 : 1);
if (progdefaults.mbar_scheme > 2) { // alternate set
if (progdefaults.mbar_scheme > MACRO_SINGLE_BAR_MAX) { // alternate set
altMacros = WCLAMP(altMacros, 1, 3);
alt_text[0] = '1' + altMacros;
for (int i = 0; i < NUMMACKEYS; i++) {
@ -2249,7 +2249,7 @@ void cb_mnuContest(Fl_Menu_ *m, void *) {
void set_macroLabels()
{
if (progdefaults.mbar_scheme > 2) {
if (progdefaults.mbar_scheme > MACRO_SINGLE_BAR_MAX) {
altMacros = 1;
for (int i = 0; i < NUMMACKEYS; i++) {
btnMacro[i]->label(macros.name[i].c_str());
@ -2415,7 +2415,7 @@ void cb_loc(Fl_Widget* w, void*)
for (int i = 0; i < len; i++) {
if (ok)
switch (i) {
case 0 :
case 0 :
case 1 :
case 4 :
case 5 :
@ -2441,7 +2441,7 @@ void cb_loc(Fl_Widget* w, void*)
char az[4];
snprintf(az, sizeof(az), "%3.0f", azimuth);
inpAZ->value(az);
} else
} else
inpAZ->value("");
restoreFocus(w);
}
@ -2969,8 +2969,8 @@ bool clean_exit(bool ask) {
}
}
} else {
if (ask &&
progdefaults.confirmExit &&
if (ask &&
progdefaults.confirmExit &&
(!(progdefaults.changed && progdefaults.SaveConfig) ||
!(macros.changed && progdefaults.SaveMacros) ||
!(!oktoclear && progdefaults.NagMe))) {
@ -3370,7 +3370,7 @@ void UI_select()
int HTh;
if (cnt_macro_height) {
if (progdefaults.mbar_scheme > 2) { // 2 bars
if (progdefaults.mbar_scheme > MACRO_SINGLE_BAR_MAX) { // 2 bars
cnt_macro_height->minimum(44);
if (progdefaults.macro_height < 44) progdefaults.macro_height = 44;
} else {
@ -3548,6 +3548,21 @@ void cb_toggle_smeter(Fl_Widget *w, void *v)
toggle_smeter();
}
extern void cb_scripts(bool);
void cb_menu_scripts(Fl_Widget*, void*)
{
cb_scripts(false);
}
extern void cb_create_default_script(void);
void cb_menu_make_default_scripts(Fl_Widget*, void*)
{
cb_create_default_script();
}
static void cb_opmode_show(Fl_Widget* w, void*);
static Fl_Menu_Item menu_[] = {
@ -3565,6 +3580,11 @@ static Fl_Menu_Item menu_[] = {
{ icons::make_icon_label(_("Save ..."), save_as_icon), 0, (Fl_Callback*)cb_mnuSaveMacro, 0, 0, _FL_MULTI_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{ icons::make_icon_label(_("Config Scripts")), 0, 0, 0, FL_MENU_DIVIDER | FL_SUBMENU, _FL_MULTI_LABEL, 0, 14, 0},
{ _("Execute"), 0, (Fl_Callback*)cb_menu_scripts, 0, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ _("Generate"), 0, (Fl_Callback*)cb_menu_make_default_scripts, 0, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ 0,0,0,0,0,0,0,0,0},
{ icons::make_icon_label(_("Text Capture")), 0, 0, 0, FL_MENU_DIVIDER | FL_SUBMENU, _FL_MULTI_LABEL, 0, 14, 0},
{ LOG_TO_FILE_MLABEL, 0, cb_logfile, 0, FL_MENU_TOGGLE, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
@ -3579,6 +3599,7 @@ static Fl_Menu_Item menu_[] = {
{ icons::make_icon_label(_("Exit"), log_out_icon), 'x', (Fl_Callback*)cb_E, 0, 0, _FL_MULTI_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{ OPMODES_MLABEL, 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_CW].name, 0, cb_init_mode, (void *)MODE_CW, 0, FL_NORMAL_LABEL, 0, 14, 0},
@ -5140,15 +5161,15 @@ void create_fl_digi_main_primary() {
inpRstOut1->align(FL_ALIGN_LEFT);
inpCall1 = new Fl_Input2(
inpFreq1->x(), y2,
inpFreq1->x(), y2,
inpTimeOn1->x() + inpTimeOn1->w() - inpFreq1->x(),
Hentry, _("Call"));
inpCall1->tooltip(_("call sign"));
inpCall1->align(FL_ALIGN_LEFT);
inpName1 = new Fl_Input2(
next_to(inpCall1) + 20, y2,
130,
next_to(inpCall1) + 20, y2,
130,
Hentry, _("Op"));
inpName1->tooltip(_("Operator name"));
inpName1->align(FL_ALIGN_LEFT);
@ -7396,8 +7417,8 @@ void qsy(long long rfc, int fmid)
else if (progdefaults.chkUSEXMLRPCis)
REQ(xmlrpc_set_qsy, rfc);
else
LOG_VERBOSE("Ignoring rfcarrier change request (no rig control)");
qso_selectFreq((long int) rfc, fmid);
//LOG_VERBOSE("Ignoring rfcarrier change request (no rig control)");
}
map<string, qrg_mode_t> qrg_marks;

Wyświetl plik

@ -62,6 +62,7 @@ public:
void updatevalue();
void value(long lv);
long value(){return val;};
long int maximum(void);
void font(Fl_Font fnt);
void SetONCOLOR (uchar r, uchar g, uchar b);
void SetOFFCOLOR (uchar r, uchar g, uchar b);

Wyświetl plik

@ -110,6 +110,7 @@ public:
void sort ();
int index ();
void index (int i);
int find_index(const char *str);
void *data ();
void textfont (int);
void textsize (uchar);

Wyświetl plik

@ -130,6 +130,7 @@ extern Fl_Light_Button *btnPSQL;
extern Fl_Light_Button *btnRSID;
extern Fl_Light_Button *btnTxRSID;
extern Fl_Light_Button *btnTune;
extern Fl_Light_Button *btnAutoSpot;
extern bool bWF_only;
extern bool withnoise;
@ -252,6 +253,9 @@ extern void put_rx_data(int *data, int len);
#define GET_TX_CHAR_NODATA -1 // no data available
#define GET_TX_CHAR_ETX -3 // end of transmission requested
// Last single macro bar option index
#define MACRO_SINGLE_BAR_MAX 2
extern int get_tx_char();
extern int get_secondary_char();
extern void put_echo_char(unsigned int data, int style = FTextBase::XMIT);

Wyświetl plik

@ -46,5 +46,6 @@ extern Fl_Double_Window* make_macroeditor();
enum { MACRO_EDIT_BUTTON, MACRO_EDIT_INPUT };
extern void editMacro(int b, int t = MACRO_EDIT_BUTTON, Fl_Input* in = 0);
extern void update_macro_button(int iMacro, const char *text, const char *name);
#endif

Wyświetl plik

@ -34,6 +34,8 @@
#include "xmlrpcpp/XmlRpc.h"
#include "xmlrpcpp/XmlRpcValue.h"
#define DEFAULT_RIGXML_FILENAME "rig-not-assigned.xml"
extern std::string windowTitle;
extern Cserial rigio;
@ -51,7 +53,9 @@ extern void setTitle();
extern void qso_addFreq();
extern void qso_delFreq();
extern void qso_selectFreq();
extern void qso_selectFreq(long int rfcarrier, int carrier);
extern void qso_setFreq();
extern void qso_setFreq(long int f);
extern void qso_clearList();
extern void saveFreqList();

Wyświetl plik

@ -72,13 +72,13 @@ struct XMLIOS {
std::string info;
std::string ok;
std::string bad;
void clear() {
void clear() {
SYMBOL.clear();
str1.clear();
str2.clear();
info.clear();
ok.clear();
bad.clear();
bad.clear();
size = fill1 = fill2 = 0;
data.clear();
};
@ -126,7 +126,7 @@ struct XMLRIG {
rigTitle = "";
}
};
extern std::list<XMLIOS> commands;
extern std::list<XMLIOS> reply;
extern std::list<MODE> lmodes;
@ -140,6 +140,6 @@ extern XMLRIG xmlrig;
extern bool readRigXML();
extern void selectRigXmlFilename();
extern void loadRigXmlFile(void);
#endif

Wyświetl plik

@ -220,7 +220,7 @@ private:
void src_data_reset(unsigned dir);
static long src_read_cb(void* arg, float** data);
size_t resample_write(float* buf, size_t count);
device_iterator name_to_device(const std::string& name, unsigned dir);
device_iterator name_to_device(std::string& name, unsigned dir);
void init_stream(unsigned dir);
void start_stream(unsigned dir);
void pause_stream(unsigned dir);

Wyświetl plik

@ -1,6 +1,6 @@
// ----------------------------------------------------------------------------
// Copyright (C) 2014
// David Freese, W1HKJ
// Copyright (C) 2014 David Freese, W1HKJ
// Copyright (C) 2015 Robert Stiles, KK5VD
//
// This file is part of fldigi
//
@ -34,10 +34,21 @@ enum {
#endif
FLDIGI_NUM_SRC
};
enum {
PA_DEV_NOT_FOUND = 0,
PA_DEV_FOUND,
PA_EXACT_DEV_FOUND
};
extern int sample_rate_converters[FLDIGI_NUM_SRC];
void sound_init(void);
void sound_close(void);
void sound_update(unsigned idx);
#include <string>
class Fl_Choice;
int pa_set_dev(Fl_Choice *choice, std::string dev_name, int dev_index);
#endif // SOUNDCONF_H

Wyświetl plik

@ -133,6 +133,10 @@ extern "C" {
const__ uint32_t ceil2(uint32_t n);
const__ uint32_t floor2(uint32_t n);
#if !HAVE_STRNLEN
size_t strnlen(const char* str, size_t len);
#endif
#if !HAVE_STRCASESTR
char* strcasestr(const char* haystack, const char* needle);
#endif

Wyświetl plik

@ -576,7 +576,7 @@ int main(int argc, char ** argv)
bool have_config = progdefaults.readDefaultsXML();
xmlfname = HomeDir;
xmlfname.append("rig.xml");
xmlfname.append(DEFAULT_RIGXML_FILENAME);
checkTLF();

Wyświetl plik

@ -294,28 +294,33 @@ void cbMacroEditOK(Fl_Widget *w, void *)
}
if (iType == MACRO_EDIT_BUTTON) {
macros.text[iMacro] = macrotext->value();
macros.name[iMacro] = labeltext->value();
if (progdefaults.mbar_scheme > 2) {
if (iMacro < NUMMACKEYS) {
btnMacro[iMacro % NUMMACKEYS]->label( macros.name[iMacro].c_str() );
btnMacro[iMacro % NUMMACKEYS]->redraw_label();
} else {
btnMacro[(iMacro % NUMMACKEYS) + NUMMACKEYS]->label( macros.name[iMacro].c_str() );
btnMacro[(iMacro % NUMMACKEYS) + NUMMACKEYS]->redraw_label();
}
} else {
btnMacro[iMacro % NUMMACKEYS]->label( macros.name[iMacro].c_str() );
btnMacro[iMacro % NUMMACKEYS]->redraw_label();
}
macros.changed = true;
update_macro_button(iMacro, macrotext->value(), labeltext->value());
}
else if (iType == MACRO_EDIT_INPUT)
iInput->value(macrotext->value());
}
void update_macro_button(int iMacro, const char *text, const char *name)
{
macros.text[iMacro].assign(text);
macros.name[iMacro].assign(name);
if (progdefaults.mbar_scheme > MACRO_SINGLE_BAR_MAX) {
if (iMacro < NUMMACKEYS) {
btnMacro[iMacro % NUMMACKEYS]->label( macros.name[iMacro].c_str() );
btnMacro[iMacro % NUMMACKEYS]->redraw_label();
} else {
btnMacro[(iMacro % NUMMACKEYS) + NUMMACKEYS]->label( macros.name[iMacro].c_str() );
btnMacro[(iMacro % NUMMACKEYS) + NUMMACKEYS]->redraw_label();
}
} else {
btnMacro[iMacro % NUMMACKEYS]->label( macros.name[iMacro].c_str() );
btnMacro[iMacro % NUMMACKEYS]->redraw_label();
}
macros.changed = true;
}
void cbInsertMacro(Fl_Widget *, void *)
{
int nbr = macroDefs->value();

Wyświetl plik

@ -78,6 +78,15 @@ unsigned long ver2int(const char* version)
return v;
}
#if !HAVE_STRNLEN
size_t strnlen(const char* str, size_t len)
{
size_t n = strlen(str);
if (n > len) n = len;
return n;
}
#endif
#if !HAVE_STRCASESTR
# include <ctype.h>
// from git 1.6.1.2 compat/strcasestr.c

Wyświetl plik

@ -3035,8 +3035,6 @@ public:
// =============================================================================
extern Fl_Button* btnAutoSpot; // FIXME: export in fl_digi.h
class Spot_get_auto : public xmlrpc_c::method
{
public:

Wyświetl plik

@ -130,7 +130,7 @@ cFreqControl::cFreqControl(int x, int y, int w, int h, const char *lbl):
minVal = 0;
double fmaxval = (pow(10, nD) - 1) * precision;
long int UMAX = (long int)(pow(2, 31) - 1);
long int UMAX = maximum();
if (fmaxval > UMAX) fmaxval = UMAX;
maxVal = fmaxval;
fmaxval /= 1000.0;
@ -153,7 +153,7 @@ cFreqControl::cFreqControl(int x, int y, int w, int h, const char *lbl):
fcWidth,
fcHeight,
" ");
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->labelfont(font_number);
Digit[n]->labelcolor(ONCOLOR);
Digit[n]->color(OFFCOLOR, SELCOLOR);
@ -179,7 +179,7 @@ cFreqControl::cFreqControl(int x, int y, int w, int h, const char *lbl):
fcWidth,
fcHeight,
" ");
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->labelfont(font_number);
Digit[n]->labelcolor(ONCOLOR);
Digit[n]->color(OFFCOLOR, SELCOLOR);
@ -273,7 +273,7 @@ void cFreqControl::SetONOFFCOLOR( Fl_Color ONcolor, Fl_Color OFFcolor)
redraw();
}
void cFreqControl::SetONCOLOR (uchar r, uchar g, uchar b)
void cFreqControl::SetONCOLOR (uchar r, uchar g, uchar b)
{
ONCOLOR = fl_rgb_color (r, g, b);
REVOFFCOLOR = ONCOLOR;
@ -299,7 +299,7 @@ void cFreqControl::SetONCOLOR (uchar r, uchar g, uchar b)
redraw();
}
void cFreqControl::SetOFFCOLOR (uchar r, uchar g, uchar b)
void cFreqControl::SetOFFCOLOR (uchar r, uchar g, uchar b)
{
OFFCOLOR = fl_rgb_color (r, g, b);
REVONCOLOR = OFFCOLOR;
@ -337,6 +337,12 @@ void cFreqControl::value(long lv)
updatevalue();
}
long int cFreqControl::maximum(void)
{
return (long int)(pow(2, 31) - 1);
}
void cFreqControl::restore_colors()
{
enable_arrow_keys = false;
@ -626,7 +632,7 @@ void cFreqControl::set_ndigits(int nbr)
fcWidth,
fcHeight,
" ");
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->labelfont(font_number);
Digit[n]->labelcolor(ONCOLOR);
Digit[n]->color(OFFCOLOR, SELCOLOR);
@ -654,7 +660,7 @@ void cFreqControl::set_ndigits(int nbr)
fcWidth,
fcHeight,
" ");
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->labelfont(font_number);
Digit[n]->labelcolor(ONCOLOR);
Digit[n]->color(OFFCOLOR, SELCOLOR);

Wyświetl plik

@ -370,6 +370,20 @@ void qso_movFreq(Fl_Widget* w, void *data)
return;
}
void qso_selectFreq(long int rfcarrier, int carrier)
{
if (rfcarrier > 0) {
qsoFreqDisp1->value(rfcarrier);
qsoFreqDisp2->value(rfcarrier);
qsoFreqDisp3->value(rfcarrier);
sendFreq(rfcarrier);
}
if (carrier > 0) {
active_modem->set_freq(carrier);
}
}
void qso_selectFreq()
{
int n = qso_opBrowser->value();
@ -397,6 +411,15 @@ void qso_selectFreq()
}
}
void qso_setFreq(long int f)
{
// transceiver frequency
if (f > 0) {
qsoFreqDisp->value(f);
sendFreq(f);
}
}
void qso_setFreq()
{
int n = qso_opBrowser->value();
@ -404,10 +427,7 @@ void qso_setFreq()
n -= 1;
// transceiver frequency
if (freqlist[n].rfcarrier > 0) {
qsoFreqDisp->value(freqlist[n].rfcarrier);
sendFreq(freqlist[n].rfcarrier);
}
qso_setFreq(freqlist[n].rfcarrier);
}
void qso_delFreq()

Wyświetl plik

@ -150,7 +150,7 @@ TAGS rigdeftags[] = {
{"<CMDPTT", parseCMDPTT},
{"<STOPBITS", parseSTOPBITS},
{"<VSP", parseVSP},
{0, 0}
{0, 0}
};
TAGS commandtags[] = {
@ -947,9 +947,13 @@ void selectRigXmlFilename()
if (p) {
progdefaults.XmlRigFilename = p;
txtXmlRigFilename->value(fl_filename_name(p));
rigCAT_close();
readRigXML();
rigCAT_defaults();
loadRigXmlFile();
}
}
void loadRigXmlFile(void)
{
rigCAT_close();
readRigXML();
rigCAT_defaults();
}

Wyświetl plik

@ -72,9 +72,16 @@
#include "qrunner.h"
#include "icons.h"
#include "macros.h"
#include "util.h"
#include "estrings.h"
inline void trim_white_spaces(std::string &s)
{
while (s[0] == ' ') s.erase(0,1);
while (s[s.length() -1] == ' ') s.erase(s.length() - 1);
}
#define SND_BUF_LEN 65536
#define SND_RW_LEN (8 * SND_BUF_LEN)
// #define SRC_BUF_LEN (8*SND_BUF_LEN)
@ -422,7 +429,7 @@ void SoundBase::write_file(SNDFILE* file, double* buf, size_t count)
bool SoundBase::format_supported(int format)
{
SF_INFO info = {
SF_INFO info = {
0,
sndfile_samplerate[progdefaults.wavSampleRate],
SNDFILE_CHANNELS,
@ -1524,12 +1531,25 @@ long SoundPort::src_read_cb(void* arg, float** data)
return vec[0].len / sd[0].params.channelCount;
}
SoundPort::device_iterator SoundPort::name_to_device(const string& name, unsigned dir)
SoundPort::device_iterator SoundPort::name_to_device(std::string &name, unsigned dir)
{
device_iterator i;
for (i = devs.begin(); i != devs.end(); ++i)
if (name == (*i)->name && (dir ? (*i)->maxOutputChannels : (*i)->maxInputChannels))
std::string device_name;
bool match_found = false;
trim_white_spaces(name);
for (i = devs.begin(); i != devs.end(); ++i) {
device_name.assign((*i)->name);
trim_white_spaces(device_name);
if(strncmp(device_name.c_str(), name.c_str(), 32) == 0)
match_found = true;
if (match_found && (dir ? (*i)->maxOutputChannels : (*i)->maxInputChannels))
break;
}
return i;
}

Wyświetl plik

@ -1,8 +1,9 @@
// ----------------------------------------------------------------------------
// soundconf.cxx
//
// Copyright (C) 2008-2010
// Stelios Bounanos, M0GLD
// Copyright (C) 2008-2010, Stelios Bounanos, M0GLD
// Copyright (C) 2014 David Freese, W1HKJ
// Copyright (C) 2015 Robert Stiles, KK5VD
//
// This file is part of fldigi.
//
@ -29,6 +30,7 @@
#include <cstdlib>
#include <cstring>
#include <string>
#if USE_OSS
# include <glob.h>
#endif
@ -39,13 +41,20 @@
#include "configuration.h"
#include "confdialog.h"
#include "debug.h"
#include "util.h"
LOG_FILE_SOURCE(debug::LOG_AUDIO);
using namespace std;
inline void trim_white_spaces(std::string &s)
{
while (s[0] == ' ') s.erase(0,1);
while (s[s.length() -1] == ' ') s.erase(s.length() - 1);
}
double std_sample_rates[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0,
32000.0, 44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1.0 };
32000.0, 44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1.0 };
static void init_oss(void)
{
@ -70,13 +79,13 @@ struct padev
{
public:
padev(const PaDeviceInfo* dev_, PaDeviceIndex idx_, PaHostApiTypeId api_)
: dev(dev_), idx(idx_), api(api_) { }
: dev(dev_), idx(idx_), api(api_) { }
bool operator<(const padev& rhs) const
{
return pa_api_prio.find(api) != pa_api_prio.end() &&
pa_api_prio.find(rhs.api) != pa_api_prio.end() &&
pa_api_prio[api] < pa_api_prio[rhs.api];
pa_api_prio.find(rhs.api) != pa_api_prio.end() &&
pa_api_prio[api] < pa_api_prio[rhs.api];
}
const PaDeviceInfo* dev;
@ -100,7 +109,7 @@ static PaDeviceIndex get_default_portaudio_device(int dir)
goto ret_def;
LOG_DEBUG("Default host API is %s, trying default ALSA %s device instead",
host_api->name, (dir == 0 ? "input" : "output"));
host_api->name, (dir == 0 ? "input" : "output"));
api_idx = Pa_GetHostApiCount();
if (api_idx < 0)
goto ret_def;
@ -124,7 +133,7 @@ static void init_portaudio(void)
if (e.error() == ENODEV) // don't complain if there are no devices
return;
LOG_ERROR("%s", e.what());
AudioPort->deactivate();
AudioPort->deactivate();
btnAudioIO[SND_IDX_PORT]->deactivate();
if (progdefaults.btnAudioIOis == SND_IDX_PORT)
progdefaults.btnAudioIOis = SND_IDX_NULL;
@ -148,14 +157,14 @@ static void init_portaudio(void)
list<padev> devlist;
for (SoundPort::device_iterator idev = SoundPort::devices().begin();
idev != SoundPort::devices().end(); ++idev)
idev != SoundPort::devices().end(); ++idev)
devlist.push_back( padev(*idev, idev - SoundPort::devices().begin(),
Pa_GetHostApiInfo((*idev)->hostApi)->type) );
Pa_GetHostApiInfo((*idev)->hostApi)->type) );
devlist.sort();
PaHostApiTypeId first_api = devlist.begin()->api;
for (list<padev>::const_iterator ilist = devlist.begin();
ilist != devlist.end(); ilist++) {
ilist != devlist.end(); ilist++) {
string menu_item;
string::size_type i = 0;
if (ilist->api != first_api) { // add a submenu
@ -169,12 +178,19 @@ static void init_portaudio(void)
i += 2;
}
// add to menu
if (ilist->dev->maxInputChannels > 0)
if (ilist->dev->maxInputChannels > 0) {
trim_white_spaces(menu_item);
menu_item.assign(menu_item);
menuPortInDev->add(menu_item.c_str(), 0, NULL,
reinterpret_cast<void *>(ilist->idx), 0);
if (ilist->dev->maxOutputChannels > 0)
reinterpret_cast<void *>(ilist->idx), 0);
}
if (ilist->dev->maxOutputChannels > 0) {
trim_white_spaces(menu_item);
menu_item.assign(menu_item);
menuPortOutDev->add(menu_item.c_str(), 0, NULL,
reinterpret_cast<void *>(ilist->idx), 0);
reinterpret_cast<void *>(ilist->idx), 0);
}
}
if (progdefaults.PortInDevice.length() == 0) {
@ -202,43 +218,41 @@ static void init_portaudio(void)
}
// select the correct menu items
const Fl_Menu_Item* menu;
int size;
int idx;
idx = -1;
menu = menuPortInDev->menu();
size = menuPortInDev->size();
for (int i = 0; i < size - 1; i++, menu++) {
if (menu->label() && progdefaults.PortInDevice == menu->label()) {
idx = i; // near match
if (reinterpret_cast<intptr_t>(menu->user_data()) == progdefaults.PortInIndex ||
progdefaults.PortInIndex == -1) // exact match, or index was never saved
break;
}
}
if (idx >= 0) {
menuPortInDev->value(idx);
menuPortInDev->set_changed();
}
idx = -1;
menu = menuPortOutDev->menu();
size = menuPortOutDev->size();
for (int i = 0; i < size - 1; i++, menu++) {
if (menu->label() && progdefaults.PortOutDevice == menu->label()) {
idx = i;
if (reinterpret_cast<intptr_t>(menu->user_data()) == progdefaults.PortOutIndex ||
progdefaults.PortOutIndex == -1)
break;
}
}
if (idx >= 0) {
menuPortOutDev->value(idx);
menuPortOutDev->set_changed();
}
pa_set_dev(menuPortInDev, progdefaults.PortInDevice, progdefaults.PortInIndex);
pa_set_dev(menuPortOutDev, progdefaults.PortOutDevice, progdefaults.PortOutIndex);
}
int pa_set_dev(Fl_Choice *choice, std::string dev_name, int dev_index)
{
const Fl_Menu_Item *menu = (Fl_Menu_Item *)0;
int size = 0;
int dev_found = PA_DEV_NOT_FOUND;
int idx = -1;
if(!choice) return dev_found;
menu = choice->menu();
size = choice->size();
for (int i = 0; i < size - 1; i++, menu++) {
if (menu->label() && dev_name == menu->label()) {
idx = i;
dev_found = PA_DEV_FOUND;
if (reinterpret_cast<intptr_t>(menu->user_data()) == dev_index ||
dev_index == -1) { // exact match, or index was never saved
dev_found = PA_EXACT_DEV_FOUND;
}
}
}
if (idx > 0) {
choice->value(idx);
choice->set_changed();
}
return dev_found;
}
#else
static void init_portaudio(void) { }
#endif // USE_PORTAUDIO
@ -271,9 +285,9 @@ int sample_rate_converters[FLDIGI_NUM_SRC] = {
static void sound_init_options(void)
{
build_srate_listbox(menuInSampleRate, std_sample_rates,
sizeof(std_sample_rates)/sizeof(*std_sample_rates) - 1);
sizeof(std_sample_rates)/sizeof(*std_sample_rates) - 1);
build_srate_listbox(menuOutSampleRate, std_sample_rates,
sizeof(std_sample_rates)/sizeof(*std_sample_rates) - 1);
sizeof(std_sample_rates)/sizeof(*std_sample_rates) - 1);
for (int i = 0; i < FLDIGI_NUM_SRC; i++)
menuSampleConverter->add(src_get_name(sample_rate_converters[i]));
@ -281,14 +295,14 @@ static void sound_init_options(void)
if (progdefaults.sample_converter == SRC_ZERO_ORDER_HOLD) {
progdefaults.sample_converter = SRC_LINEAR;
LOG_WARN("The Zero Order Hold sample rate converter should not be used! "
"Your setting has been changed to Linear.");
"Your setting has been changed to Linear.");
}
#if defined(__ppc__) || defined(__powerpc__) || defined(__PPC__)
// SRC_LINEAR may crash with 11025Hz modems. Change to SINC_FASTEST.
if (progdefaults.sample_converter == SRC_LINEAR) {
progdefaults.sample_converter = SRC_SINC_FASTEST;
LOG_WARN("Linear sample rate converter may not work on this architecture. "
"Your setting has been changed to Fastest Sinc");
"Your setting has been changed to Fastest Sinc");
}
#endif
for (int i = 0; i < FLDIGI_NUM_SRC; i++) {
@ -344,7 +358,7 @@ static void sound_init_options(void)
# if PA_API_VERSION < 12
static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
return x == PA_CONTEXT_CONNECTING || x == PA_CONTEXT_AUTHORIZING ||
x == PA_CONTEXT_SETTING_NAME || x == PA_CONTEXT_READY;
x == PA_CONTEXT_SETTING_NAME || x == PA_CONTEXT_READY;
}
# endif
@ -360,7 +374,7 @@ static bool probe_pulseaudio(void)
pa_context_state_t state;
do { // iterate main loop until the context connection fails or becomes ready
if (!(ok = (pa_mainloop_iterate(loop, 1, NULL) >= 0 &&
PA_CONTEXT_IS_GOOD(state = pa_context_get_state(context)))))
PA_CONTEXT_IS_GOOD(state = pa_context_get_state(context)))))
break;
} while (state != PA_CONTEXT_READY);
}
@ -383,7 +397,7 @@ void sound_init(void)
init_portaudio();
// set the Sound Card configuration tab to the correct initial values
// set the Sound Card configuration tab to the correct initial values
#if !USE_OSS
AudioOSS->deactivate();
btnAudioIO[SND_IDX_OSS]->deactivate();
@ -397,7 +411,7 @@ void sound_init(void)
btnAudioIO[SND_IDX_PULSE]->deactivate();
#endif
if (progdefaults.btnAudioIOis == SND_IDX_UNKNOWN ||
!btnAudioIO[progdefaults.btnAudioIOis]->active()) { // or saved sound api now disabled
!btnAudioIO[progdefaults.btnAudioIOis]->active()) { // or saved sound api now disabled
int io[4] = { SND_IDX_PORT, SND_IDX_PULSE, SND_IDX_OSS, SND_IDX_NULL };
if (probe_pulseaudio()) { // prefer pulseaudio
io[0] = SND_IDX_PULSE;
@ -443,20 +457,20 @@ void sound_update(unsigned idx)
progdefaults.btnAudioIOis = idx;
switch (idx) {
#if USE_OSS
case SND_IDX_OSS:
menuOSSDev->activate();
scDevice[0] = scDevice[1] = menuOSSDev->value();
break;
case SND_IDX_OSS:
menuOSSDev->activate();
scDevice[0] = scDevice[1] = menuOSSDev->value();
break;
#endif
#if USE_PORTAUDIO
case SND_IDX_PORT:
menuPortInDev->activate();
menuPortOutDev->activate();
if (menuPortInDev->text())
scDevice[0] = menuPortInDev->text();
if (menuPortOutDev->text())
scDevice[1] = menuPortOutDev->text();
case SND_IDX_PORT:
menuPortInDev->activate();
menuPortOutDev->activate();
if (menuPortInDev->text())
scDevice[0] = menuPortInDev->text();
if (menuPortOutDev->text())
scDevice[1] = menuPortOutDev->text();
{
Fl_ListBox* listbox[2] = { menuInSampleRate, menuOutSampleRate };
@ -465,43 +479,43 @@ void sound_update(unsigned idx)
const vector<double>& srates = SoundPort::get_supported_rates(scDevice[i], i);
switch (srates.size()) {
case 0: // startup; no devices initialised yet
build_srate_listbox(listbox[i], std_sample_rates,
sizeof(std_sample_rates)/sizeof(*std_sample_rates) - 1);
break;
case 1: // default sample rate only, build menu with all std rates
build_srate_listbox(listbox[i], std_sample_rates,
sizeof(std_sample_rates)/sizeof(*std_sample_rates) - 1, srates[0]);
break;
default: // first element is default sample rate, build menu with rest
build_srate_listbox(listbox[i], &srates[0] + 1, srates.size() - 1, srates[0]);
break;
case 0: // startup; no devices initialised yet
build_srate_listbox(listbox[i], std_sample_rates,
sizeof(std_sample_rates)/sizeof(*std_sample_rates) - 1);
break;
case 1: // default sample rate only, build menu with all std rates
build_srate_listbox(listbox[i], std_sample_rates,
sizeof(std_sample_rates)/sizeof(*std_sample_rates) - 1, srates[0]);
break;
default: // first element is default sample rate, build menu with rest
build_srate_listbox(listbox[i], &srates[0] + 1, srates.size() - 1, srates[0]);
break;
}
for (int j = 0; j < listbox[i]->lsize(); j++) {
listbox[i]->index(j);
if (strstr(listbox[i]->value(), label))
break;
}
free(label);
listbox[i]->activate();
}
}
break;
break;
#endif
#if USE_PULSEAUDIO
case SND_IDX_PULSE:
inpPulseServer->activate();
scDevice[0] = scDevice[1] = inpPulseServer->value();
break;
case SND_IDX_PULSE:
inpPulseServer->activate();
scDevice[0] = scDevice[1] = inpPulseServer->value();
break;
#endif
case SND_IDX_NULL:
scDevice[0] = scDevice[1] = "";
break;
case SND_IDX_NULL:
scDevice[0] = scDevice[1] = "";
break;
};
}

Wyświetl plik

@ -1772,7 +1772,7 @@ int waterfall::handle(int event)
// as above; handle wheel events for the macro bar
extern void altmacro_cb(Fl_Widget *w, void *v);
if (progdefaults.macro_wheel) {
if (progdefaults.mbar_scheme > 2) {
if (progdefaults.mbar_scheme > MACRO_SINGLE_BAR_MAX) {
if (Fl::event_inside(macroFrame2)) {
altmacro_cb(btnAltMacros2, reinterpret_cast<void *>(d));
return 1;

Wyświetl plik

@ -337,7 +337,7 @@ void FTextRX::add(unsigned int c, int attr)
}
// test for bottom of text visibility
if (// !mFastDisplay &&
if (// !mFastDisplay &&
(mVScrollBar->value() >= mNBufferLines - mNVisibleLines + mVScrollBar->linesize() - 1))
show_insert_position();
}
@ -959,15 +959,15 @@ int FTextTX::handle_key_shortcuts(int key)
default:
break;
}
// Add text + space if length is > 0
if (etag.length())
add_text(etag + std::string(" "));
return 1;
}
break;
default:
break;
}
@ -1031,7 +1031,7 @@ int FTextTX::handle_key(int key)
else if (!(Fl::event_state() & (FL_META | FL_ALT)))
break;
// fall through to (un)pause for M-r or A-r
case FL_Pause:
if (trx_state != STATE_TX) {
start_tx();
@ -1106,7 +1106,7 @@ int FTextTX::handle_key(int key)
if (Fl::event_state() & FL_ALT) {
static char lbl[2] = "1";
altMacros = key - '1';
if (progdefaults.mbar_scheme > 2) {
if (progdefaults.mbar_scheme > MACRO_SINGLE_BAR_MAX) {
if (!altMacros) altMacros = 1;
for (int i = 0; i < NUMMACKEYS; i++) {
btnMacro[NUMMACKEYS + i]->label(
@ -1164,7 +1164,7 @@ int FTextTX::handle_key_macro(int key)
if (key > 11)
return 0;
if (progdefaults.mbar_scheme > 2) {
if (progdefaults.mbar_scheme > MACRO_SINGLE_BAR_MAX) {
if (Fl::event_state(FL_SHIFT))
key += altMacros * NUMMACKEYS;
} else {