From 89da54318dfd7a7dcd2a1ea3f34b9209ab95fa43 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 11 Dec 2023 13:16:30 +0100 Subject: [PATCH] add "set_wait" alias for "wait_mode" to deprecate more gracefully --- src/emc/usr_intf/emcrsh.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/emc/usr_intf/emcrsh.cc b/src/emc/usr_intf/emcrsh.cc index bed7f99363e..b032925f4e3 100644 --- a/src/emc/usr_intf/emcrsh.cc +++ b/src/emc/usr_intf/emcrsh.cc @@ -416,7 +416,7 @@ typedef enum { scProgramAngularUnits, scUserLinearUnits, scUserAngularUnits, scDisplayLinearUnits, scDisplayAngularUnits, scLinearUnitConversion, scAngularUnitConversion, scProbeClear, scProbeTripped, scProbeValue, scProbe, scTeleopEnable, scKinematicsType, scOverrideLimits, - scSpindleOverride, scOptionalStop, scUnknown + scSpindleOverride, scOptionalStop, scSetWait, scUnknown } cmdTokenType; typedef enum { @@ -465,7 +465,7 @@ const char *cmdTokens[] = { "USER_LINEAR_UNITS", "USER_ANGULAR_UNITS", "DISPLAY_LINEAR_UNITS", "DISPLAY_ANGULAR_UNITS", "LINEAR_UNIT_CONVERSION", "ANGULAR_UNIT_CONVERSION", "PROBE_CLEAR", "PROBE_TRIPPED", "PROBE_VALUE", "PROBE", "TELEOP_ENABLE", "KINEMATICS_TYPE", "OVERRIDE_LIMITS", - "SPINDLE_OVERRIDE", "OPTIONAL_STOP", ""}; + "SPINDLE_OVERRIDE", "OPTIONAL_STOP", "SET_WAIT", ""}; const char *commands[] = {"HELLO", "SET", "GET", "QUIT", "SHUTDOWN", "HELP", ""}; @@ -776,6 +776,13 @@ static cmdResponseType setWaitMode(connectionRecType *context) return rtNoError; } +/* compatibility wrapper to deprecate set_wait command token - @todo remove at some point */ +static cmdResponseType setSetWait(connectionRecType *context) +{ + dprintf(context->cliSock, "WARNING: \"set_wait\" command is depreciated and will be removed in the future. Please use \"wait_mode\" instead.\n"); + return setWaitMode(context); +} + static cmdResponseType setMachine(connectionRecType *context) { char *s = strtok(NULL, delims); @@ -1457,6 +1464,7 @@ int commandSet(connectionRecType *context) case scPlat: break; case scIni: break; case scDebug: ret = setDebug(context); break; + case scSetWait: ret = setSetWait(context); break; // remove this: deprecation alias for scWaitMode. case scWaitMode: ret = setWaitMode(context); break; case scWait: ret = setWait(context); break; case scSetTimeout: ret = setTimeout(context); break; @@ -1611,6 +1619,13 @@ static cmdResponseType getWaitMode(connectionRecType *context) return rtNoError; } +/* compatibility wrapper to deprecate set_wait command token - @todo remove at some point */ +static cmdResponseType getSetWait(connectionRecType *context) +{ + dprintf(context->cliSock, "WARNING: \"set_wait\" command is depreciated and will be removed in the future. Please use \"wait_mode\" instead.\n"); + return getWaitMode(context); +} + static cmdResponseType getPlat(connectionRecType *context) { OUT("PLAT Linux"); @@ -2579,6 +2594,7 @@ int commandGet(connectionRecType *context) case scPlat: ret = getPlat(context); break; case scIni: break; case scDebug: ret = getDebug(context); break; + case scSetWait: ret = getSetWait(context); break; // remove this: deprecation alias for scWaitMode. case scWaitMode: ret = getWaitMode(context); break; case scWait: break; case scSetTimeout: ret = getTimeout(context); break;