* Removed morse as base class of modem
  * Added element to modem which is of class cMorse
pull/1/head
David Freese 2013-08-02 14:52:23 -05:00
rodzic 607a696bac
commit 6e66d2cd9a
5 zmienionych plików z 15 dodań i 14 usunięć

Wyświetl plik

@ -824,7 +824,7 @@ int cw::handle_event(int cw_event, const char **c)
cw_receive_state == RS_AFTER_TONE) {
// Look up the representation
//cout << "CW_QUERY medium time after keyup: " << rx_rep_buf;
*c = morse::rx_lookup(rx_rep_buf);
*c = morse.rx_lookup(rx_rep_buf);
//cout <<": " << *c <<flush;
if (*c == NULL) {
// invalid decode... let user see error
@ -1115,7 +1115,7 @@ void cw::send_ch(int ch)
// convert character code to a morse representation
if ((chout < 256) && (chout >= 0)) {
code = tx_lookup(chout); //cw_tx_lookup(ch);
code = morse.tx_lookup(chout); //cw_tx_lookup(ch);
firstelement = true;
} else {
code = 0x04; // two extra dot spaces
@ -1140,7 +1140,7 @@ void cw::send_ch(int ch)
FL_AWAKE();
if (ch != -1) {
string prtstr = tx_print(ch);
string prtstr = morse.tx_print(ch);
if (prtstr.length() == 1)
put_echo_char(progdefaults.rx_lowercase ? tolower(prtstr[0]) : prtstr[0]);
else
@ -1163,7 +1163,7 @@ int cw::tx_process()
prosigns != progdefaults.CW_prosigns) {
use_paren = progdefaults.CW_use_paren;
prosigns = progdefaults.CW_prosigns;
morse::init();
morse.init();
}
c = get_tx_char();

Wyświetl plik

@ -145,7 +145,7 @@ static CW_TABLE cw_table[] = {
* is viewable as an integer in the range 2 (".") to 255 ("-------"), and can
* be used as an index into a fast lookup array.
*/
unsigned int morse::tokenize_representation(const char *representation)
unsigned int cMorse::tokenize_representation(const char *representation)
{
unsigned int token; /* Return token value */
const char *sptr; /* Pointer through string */
@ -184,7 +184,7 @@ unsigned int morse::tokenize_representation(const char *representation)
/* ---------------------------------------------------------------------- */
void morse::init()
void cMorse::init()
{
CW_TABLE *cw; /* Pointer to table entry */
unsigned int i;
@ -230,7 +230,7 @@ void morse::init()
}
}
const char *morse::rx_lookup(char *r)
const char *cMorse::rx_lookup(char *r)
{
int token;
CW_TABLE *cw;
@ -244,7 +244,7 @@ const char *morse::rx_lookup(char *r)
return cw->prt;
}
const char *morse::tx_print(int c)
const char *cMorse::tx_print(int c)
{
if (cw_tx_lookup[toupper(c)].prt)
return cw_tx_lookup[toupper(c)].prt;
@ -252,7 +252,7 @@ const char *morse::tx_print(int c)
return "";
}
unsigned long morse::tx_lookup(int c)
unsigned long cMorse::tx_lookup(int c)
{
return cw_tx_lookup[toupper(c)].code;
}

Wyświetl plik

@ -18,8 +18,9 @@
#define TWOPI (2.0 * M_PI)
class modem : public morse {
class modem {
protected:
cMorse morse;
trx_mode mode;
SoundBase *scard;

Wyświetl plik

@ -47,16 +47,16 @@ struct CW_XMT_TABLE {
const char *prt;
};
class morse {
class cMorse {
private:
CW_TABLE *cw_rx_lookup[256];
CW_XMT_TABLE cw_tx_lookup[256];
unsigned int tokenize_representation(const char *representation);
public:
morse() {
cMorse() {
init();
}
~morse() {
~cMorse() {
}
void init();
const char *rx_lookup(char *r);

Wyświetl plik

@ -628,7 +628,7 @@ void modem::cwid_send_ch(int ch)
// convert character code to a morse representation
if ((ch < 256) && (ch >= 0)) {
code = tx_lookup(ch); //cw_tx_lookup(ch);
code = morse.tx_lookup(ch); //cw_tx_lookup(ch);
} else {
code = 0x04; // two extra dot spaces
}