MCPcopy Create free account
hub / github.com/SatDump/SatDump / ParseCmdCodeShort

Method ParseCmdCodeShort

src-core/libs/muparser/muParserBase.cpp:1038–1077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1036 }
1037
1038 value_type ParserBase::ParseCmdCodeShort() const
1039 {
1040 const SToken *const tok = m_vRPN.GetBase();
1041 value_type buf;
1042
1043 switch (tok->Cmd)
1044 {
1045 case cmVAL:
1046 return tok->Val.data2;
1047
1048 case cmVAR:
1049 return *tok->Val.ptr;
1050
1051 case cmVARMUL:
1052 return *tok->Val.ptr * tok->Val.data + tok->Val.data2;
1053
1054 case cmVARPOW2:
1055 buf = *(tok->Val.ptr);
1056 return buf * buf;
1057
1058 case cmVARPOW3:
1059 buf = *(tok->Val.ptr);
1060 return buf * buf * buf;
1061
1062 case cmVARPOW4:
1063 buf = *(tok->Val.ptr);
1064 return buf * buf * buf * buf;
1065
1066 // numerical function without any argument
1067 case cmFUNC:
1068 return tok->Fun.cb.call_fun<0>();
1069
1070 // String function without a numerical argument
1071 case cmFUNC_STR:
1072 return tok->Fun.cb.call_strfun<1>(m_vStringBuf[0].c_str());
1073
1074 default:
1075 throw ParserError(ecINTERNAL_ERROR);
1076 }
1077 }
1078
1079 //---------------------------------------------------------------------------
1080 /** \brief Evaluate the RPN.

Callers

nothing calls this directly

Calls 2

GetBaseMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected