Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 100 additions & 1 deletion src/emc/nml_intf/emc.cc

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/emc/nml_intf/emc_nml.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1701,13 +1701,13 @@ class EMC_SPINDLE_CMD_MSG:public RCS_CMD_MSG {
public:
EMC_SPINDLE_CMD_MSG(NMLTYPE t, size_t s)
: RCS_CMD_MSG(t, s),
spindle(0)
_spindle(0)
{};

// For internal NML/CMS use only.
void update(CMS * cms);

int spindle;
int _spindle;
};

class EMC_SPINDLE_SPEED:public EMC_SPINDLE_CMD_MSG {
Expand Down
8 changes: 4 additions & 4 deletions src/emc/nml_intf/interpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int NML_INTERP_LIST::append(std::unique_ptr<NMLmsg>&& nml_msg_ptr)
return -1;
}

if (0 == nml_msg_ptr->type) {
if (0 == nml_msg_ptr->_type) {
rcs_print_error("NML_INTERP_LIST::append : attempt to append 0 type\n");
return -1;
}
Expand All @@ -58,7 +58,7 @@ int NML_INTERP_LIST::append(std::unique_ptr<NMLmsg>&& nml_msg_ptr)
"line_number=%d\n",
this,
linked_list.front().command->size,
emc_symbol_lookup(linked_list.front().command->type),
emc_symbol_lookup(linked_list.front().command->_type),
linked_list.size(),
linked_list.front().line_number);
}
Expand All @@ -84,7 +84,7 @@ std::unique_ptr<NMLmsg> NML_INTERP_LIST::get()
rcs_print("NML_INTERP_LIST(%p)::get(): {size=%ld, type=%s}, list_size=%lu\n",
this,
node.command->size,
emc_symbol_lookup(node.command->type),
emc_symbol_lookup(node.command->_type),
linked_list.size());
}

Expand All @@ -104,7 +104,7 @@ void NML_INTERP_LIST::print()
rcs_print("NML_INTERP_LIST::print(): list size=%lu\n", linked_list.size());
for (auto& i : linked_list) {
auto& msg = *(i.command);
rcs_print("--> type=%s, line_number=%d\n", emc_symbol_lookup(msg.type), i.line_number);
rcs_print("--> type=%s, line_number=%d\n", emc_symbol_lookup(msg._type), i.line_number);
}
rcs_print("\n");
}
Expand Down
28 changes: 14 additions & 14 deletions src/emc/task/emctaskmain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static int checkInterpList(NML_INTERP_LIST * il, EMC_STAT * /*stat*/)
while (il->len() > 0) {
auto cmd = il->get();

switch (cmd->type) {
switch (cmd->_type) {

case EMC_OPERATOR_ERROR_TYPE: {
auto error_msg = static_cast<EMC_OPERATOR_ERROR*>(cmd.get());
Expand Down Expand Up @@ -731,7 +731,7 @@ static bool allow_while_idle_type() {
// expect immediate command
RCS_CMD_MSG *emcCommand;
emcCommand = emcCommandBuffer->get_address();
switch(emcCommand->type) {
switch(emcCommand->_type) {
case EMC_JOG_CONT_TYPE:
case EMC_JOG_INCR_TYPE:
case EMC_JOG_STOP_TYPE:
Expand All @@ -756,7 +756,7 @@ static int emcTaskPlan(void)
// check for new command
if (emcCommand->serial_number != emcStatus->echo_serial_number) {
// flag it here locally as a new command
type = emcCommand->type;
type = emcCommand->_type;
} else {
// no new command-- reset local flag
type = 0;
Expand Down Expand Up @@ -1498,7 +1498,7 @@ static EMC_TASK_EXEC emcTaskCheckPreconditions(NMLmsg * cmd)
return EMC_TASK_EXEC::DONE;
}

switch (cmd->type) {
switch (cmd->_type) {
// operator messages, if queued, will go out when everything before
// them is done
case EMC_OPERATOR_ERROR_TYPE:
Expand Down Expand Up @@ -1604,7 +1604,7 @@ static EMC_TASK_EXEC emcTaskCheckPreconditions(NMLmsg * cmd)
// unrecognized command
if (emc_debug & EMC_DEBUG_TASK_ISSUE) {
rcs_print_error("preconditions: unrecognized command %d:%s\n",
(int)cmd->type, emc_symbol_lookup(cmd->type));
(int)cmd->_type, emc_symbol_lookup(cmd->_type));
}
return EMC_TASK_EXEC::ERROR;
break;
Expand Down Expand Up @@ -1638,10 +1638,10 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
return 0;
}
if (emc_debug & EMC_DEBUG_TASK_ISSUE) {
rcs_print("Issuing %s -- \t (%s)\n", emcSymbolLookup(cmd->type),
rcs_print("Issuing %s -- \t (%s)\n", emcSymbolLookup(cmd->_type),
emcCommandBuffer->msg2str(cmd));
}
switch (cmd->type) {
switch (cmd->_type) {
// general commands

case EMC_OPERATOR_ERROR_TYPE:
Expand Down Expand Up @@ -2399,16 +2399,16 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
// unrecognized command
if (emc_debug & EMC_DEBUG_TASK_ISSUE) {
rcs_print_error("ignoring issue of unknown command %d:%s\n",
(int)cmd->type, emc_symbol_lookup(cmd->type));
(int)cmd->_type, emc_symbol_lookup(cmd->_type));
}
retval = 0; // don't consider this an error
break;
}

if (retval == -1) {
if (emc_debug & EMC_DEBUG_TASK_ISSUE) {
rcs_print_error("error executing command %d:%s\n", (int)cmd->type,
emc_symbol_lookup(cmd->type));
rcs_print_error("error executing command %d:%s\n", (int)cmd->_type,
emc_symbol_lookup(cmd->_type));
}
}
/* debug */
Expand All @@ -2433,7 +2433,7 @@ static EMC_TASK_EXEC emcTaskCheckPostconditions(NMLmsg * cmd)
return EMC_TASK_EXEC::DONE;
}

switch (cmd->type) {
switch (cmd->_type) {
case EMC_OPERATOR_ERROR_TYPE:
case EMC_OPERATOR_TEXT_TYPE:
case EMC_OPERATOR_DISPLAY_TYPE:
Expand Down Expand Up @@ -2510,7 +2510,7 @@ static EMC_TASK_EXEC emcTaskCheckPostconditions(NMLmsg * cmd)
// unrecognized command
if (emc_debug & EMC_DEBUG_TASK_ISSUE) {
rcs_print_error("postconditions: unrecognized command %d:%s\n",
(int)cmd->type, emc_symbol_lookup(cmd->type));
(int)cmd->_type, emc_symbol_lookup(cmd->_type));
}
return EMC_TASK_EXEC::DONE;
break;
Expand Down Expand Up @@ -3511,11 +3511,11 @@ int main(int argc, char *argv[])
// is not an NML_MODULE and they won't be set automatically

// do task
emcStatus->task.command_type = emcCommand->type;
emcStatus->task.command_type = emcCommand->_type;
emcStatus->task.echo_serial_number = emcCommand->serial_number;

// do top level
emcStatus->command_type = emcCommand->type;
emcStatus->command_type = emcCommand->_type;
emcStatus->echo_serial_number = emcCommand->serial_number;

if (taskPlanError || taskExecuteError ||
Expand Down
2 changes: 2 additions & 0 deletions src/libnml/nml/cmd_msg.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class RCS_CMD_CHANNEL:public NML {
RCS_CMD_CHANNEL(NML_FORMAT_PTR, const char *, const char *, const char *,
int set_to_server = 0);
~RCS_CMD_CHANNEL();
// Sub-class calls base-class
// cppcheck-suppress duplInheritedMember
RCS_CMD_MSG *get_address() {
return ((RCS_CMD_MSG *) NML::get_address());
};
Expand Down
56 changes: 28 additions & 28 deletions src/libnml/nml/nml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1051,13 +1051,13 @@ NMLTYPE NML::read()
case CMS_READ_OLD:
return (0);
case CMS_READ_OK:
if (((NMLmsg *) cms->subdiv_data)->type <= 0 && !cms->isserver) {
if (((NMLmsg *) cms->subdiv_data)->_type <= 0 && !cms->isserver) {
rcs_print_error
("NML: New data received but type of %d is invalid.\n",
(int)((NMLmsg *) cms->subdiv_data)->type);
(int)((NMLmsg *) cms->subdiv_data)->_type);
return -1;
}
return (((NMLmsg *) cms->subdiv_data)->type);
return (((NMLmsg *) cms->subdiv_data)->_type);

default:
set_error();
Expand Down Expand Up @@ -1104,13 +1104,13 @@ NMLTYPE NML::read()
return (0);
case CMS_READ_OK:
error_type = NML_NO_ERROR;
if (((NMLmsg *) cms->subdiv_data)->type <= 0 && !cms->isserver) {
if (((NMLmsg *) cms->subdiv_data)->_type <= 0 && !cms->isserver) {
rcs_print_error
("NML: New data received but type of %d is invalid.\n",
(int)((NMLmsg *) cms->subdiv_data)->type);
(int)((NMLmsg *) cms->subdiv_data)->_type);
return -1;
}
return (((NMLmsg *) cms->subdiv_data)->type);
return (((NMLmsg *) cms->subdiv_data)->_type);

default:
set_error();
Expand Down Expand Up @@ -1144,13 +1144,13 @@ NMLTYPE NML::blocking_read(double blocking_timeout)
case CMS_READ_OLD:
return (0);
case CMS_READ_OK:
if (((NMLmsg *) cms->subdiv_data)->type <= 0 && !cms->isserver) {
if (((NMLmsg *) cms->subdiv_data)->_type <= 0 && !cms->isserver) {
rcs_print_error
("NML: New data received but type of %d is invalid.\n",
(int)((NMLmsg *) cms->subdiv_data)->type);
(int)((NMLmsg *) cms->subdiv_data)->_type);
return -1;
}
return (((NMLmsg *) cms->subdiv_data)->type);
return (((NMLmsg *) cms->subdiv_data)->_type);
case CMS_TIMED_OUT:
error_type = NML_NO_ERROR;
return 0;
Expand Down Expand Up @@ -1226,13 +1226,13 @@ NMLTYPE NML::blocking_read(double blocking_timeout)
case CMS_READ_OLD:
return (0);
case CMS_READ_OK:
if (((NMLmsg *) cms->subdiv_data)->type <= 0 && !cms->isserver) {
if (((NMLmsg *) cms->subdiv_data)->_type <= 0 && !cms->isserver) {
rcs_print_error
("NML: New data received but type of %d is invalid.\n",
(int)((NMLmsg *) cms->subdiv_data)->type);
(int)((NMLmsg *) cms->subdiv_data)->_type);
return -1;
}
return (((NMLmsg *) cms->subdiv_data)->type);
return (((NMLmsg *) cms->subdiv_data)->_type);
case CMS_TIMED_OUT:
error_type = NML_NO_ERROR;
return 0;
Expand Down Expand Up @@ -1328,13 +1328,13 @@ NMLTYPE NML::peek()
case CMS_READ_OLD:
return (0);
case CMS_READ_OK:
if (((NMLmsg *) cms->subdiv_data)->type <= 0 && !cms->isserver) {
if (((NMLmsg *) cms->subdiv_data)->_type <= 0 && !cms->isserver) {
rcs_print_error
("NML: New data received but type of %d is invalid.\n",
(int)((NMLmsg *) cms->subdiv_data)->type);
(int)((NMLmsg *) cms->subdiv_data)->_type);
return -1;
}
return (((NMLmsg *) cms->subdiv_data)->type);
return (((NMLmsg *) cms->subdiv_data)->_type);

default:
set_error();
Expand Down Expand Up @@ -1374,13 +1374,13 @@ NMLTYPE NML::peek()
case CMS_READ_OLD:
return (0);
case CMS_READ_OK:
if (((NMLmsg *) cms->subdiv_data)->type <= 0 && !cms->isserver) {
if (((NMLmsg *) cms->subdiv_data)->_type <= 0 && !cms->isserver) {
rcs_print_error
("NML: New data received but type of %d is invalid.\n",
(int)((NMLmsg *) cms->subdiv_data)->type);
(int)((NMLmsg *) cms->subdiv_data)->_type);
return -1;
}
return (((NMLmsg *) cms->subdiv_data)->type);
return (((NMLmsg *) cms->subdiv_data)->_type);

default:
set_error();
Expand Down Expand Up @@ -1450,7 +1450,7 @@ int NML::format_output()
if (forced_type > 0) {
new_type = forced_type;
}
((NMLmsg *) cms->subdiv_data)->type = new_type; /* Store type
((NMLmsg *) cms->subdiv_data)->_type = new_type; /* Store type
in
message. */
((NMLmsg *) cms->subdiv_data)->size = new_size; /* Store size
Expand Down Expand Up @@ -1498,12 +1498,12 @@ int NML::format_output()
cms->rewind(); /* Move to the start of the encoded buffer. */

/* Get the type and size from the message. */
new_type = ((NMLmsg *) cms->subdiv_data)->type;
new_type = ((NMLmsg *) cms->subdiv_data)->_type;
new_size = ((NMLmsg *) cms->subdiv_data)->size;

if (forced_type > 0) {
new_type = forced_type;
((NMLmsg *) cms->subdiv_data)->type = forced_type;
((NMLmsg *) cms->subdiv_data)->_type = forced_type;
}

/* Store the type and size in the encoded buffer. */
Expand Down Expand Up @@ -1555,7 +1555,7 @@ int NML::format_output()
return (-1);
}
if (forced_type > 0) {
((NMLmsg *) cms->subdiv_data)->type = forced_type;
((NMLmsg *) cms->subdiv_data)->_type = forced_type;
}

return (((int) cms->status < 0) ? -1 : 0);
Expand Down Expand Up @@ -1612,7 +1612,7 @@ int NML::write(NMLmsg * nml_msg, int *serial_number)
return (-1);
}

if ((nml_msg->size == 0 || nml_msg->type == 0) && !cms->isserver) {
if ((nml_msg->size == 0 || nml_msg->_type == 0) && !cms->isserver) {
error_type = NML_INVALID_MESSAGE_ERROR;
rcs_print_error("NML::write: Message size or type is zero.\n");
rcs_print_error
Expand Down Expand Up @@ -1776,7 +1776,7 @@ int NML::write_if_read(NMLmsg * nml_msg, int *serial_number)
return (-1);
}

if ((nml_msg->size == 0 || nml_msg->type == 0) && !cms->isserver) {
if ((nml_msg->size == 0 || nml_msg->_type == 0) && !cms->isserver) {
error_type = NML_INVALID_MESSAGE_ERROR;
rcs_print_error
("NML::write_if_read: Message size or type is zero.\n");
Expand Down Expand Up @@ -1872,7 +1872,7 @@ int NML::format_input(NMLmsg * nml_msg)
cms->format_high_ptr = cms->format_low_ptr + nml_msg->size;
/* Handle the generic part of the message. */
cms->rewind(); /* Move to the start of the encoded buffer. */
cms->update(nml_msg->type); /* Store message type in encoded
cms->update(nml_msg->_type); /* Store message type in encoded
buffer. */
cms->update(nml_msg->size); /* Store message size in encoded
buffer. */
Expand All @@ -1885,7 +1885,7 @@ int NML::format_input(NMLmsg * nml_msg)
}

/* Run through list of format functions. */
if (-1 == run_format_chain(nml_msg->type, nml_msg)) {
if (-1 == run_format_chain(nml_msg->_type, nml_msg)) {
rcs_print_error("NMLwrite: format error\n");
if (verbose_nml_error_messages) {
rcs_print_error(" (Buffer = %s, Process = %s)\n",
Expand Down Expand Up @@ -1914,7 +1914,7 @@ int NML::format_input(NMLmsg * nml_msg)
cms->format_high_ptr = cms->format_low_ptr + cms->size;

/* Store the new type and size in the raw message. */
((NMLmsg *) cms->subdiv_data)->type = new_type;
((NMLmsg *) cms->subdiv_data)->_type = new_type;
((NMLmsg *) cms->subdiv_data)->size = new_size;

/* Check the list of format functions. */
Expand Down Expand Up @@ -2081,7 +2081,7 @@ NMLTYPE NML::str2msg(const char *string)
return (0);
case CMS_READ_OK:
error_type = NML_NO_ERROR;
return (((NMLmsg *) cms->subdiv_data)->type);
return (((NMLmsg *) cms->subdiv_data)->_type);
case CMS_TIMED_OUT:
error_type = NML_TIMED_OUT;
return -1;
Expand Down
Loading
Loading