|
@@ -16,6 +16,10 @@ using std::endl;
|
|
|
|
|
|
|
|
|
//=======================================
|
|
|
+/*!
|
|
|
+ Constructor of CPU stuct
|
|
|
+ \param cpu1, stack pointers to CPU and stack
|
|
|
+ */
|
|
|
void cpu_constructor (sCPU *cpu1, sStack *stack) {
|
|
|
|
|
|
cpu1->st = stack;
|
|
@@ -23,6 +27,11 @@ void cpu_constructor (sCPU *cpu1, sStack *stack) {
|
|
|
}
|
|
|
|
|
|
//========================================
|
|
|
+/*!
|
|
|
+ Check CPU
|
|
|
+ \param cpu1 pointers to CPU
|
|
|
+ \return bool parameter true if all OK
|
|
|
+ */
|
|
|
bool sCPU_Ok (sCPU *cpu1) {
|
|
|
|
|
|
if (!sStack_Ok (cpu1->st)) {
|
|
@@ -33,6 +42,11 @@ bool sCPU_Ok (sCPU *cpu1) {
|
|
|
}
|
|
|
|
|
|
//========================================
|
|
|
+/*!
|
|
|
+ calculate the sine of last element in stack
|
|
|
+ \param cpu pointers to CPU
|
|
|
+ \return rezalt sine of number
|
|
|
+ */
|
|
|
double sCPU_sinus (sCPU *cpu) {
|
|
|
|
|
|
#ifdef USE_SUPER_PUPER_GUARDS
|
|
@@ -55,6 +69,11 @@ double sCPU_sinus (sCPU *cpu) {
|
|
|
}
|
|
|
|
|
|
//=======================================
|
|
|
+/*!
|
|
|
+ calculate the cosine of last element in stack
|
|
|
+ \param cpu pointers to CPU
|
|
|
+ \return rezalt cosine of number
|
|
|
+ */
|
|
|
double sCPU_cosine (sCPU *cpu) {
|
|
|
|
|
|
#ifdef USE_SUPER_PUPER_GUARDS
|
|
@@ -78,6 +97,11 @@ double sCPU_cosine (sCPU *cpu) {
|
|
|
}
|
|
|
|
|
|
//=======================================
|
|
|
+/*!
|
|
|
+ calculate the addition of the two last elements in the stack
|
|
|
+ \param cpu pointers to CPU
|
|
|
+ \return summer of tow nummbers
|
|
|
+ */
|
|
|
double sCPU_addition (sCPU *cpu) {
|
|
|
|
|
|
#ifdef USE_SUPER_PUPER_GUARDS
|
|
@@ -103,6 +127,11 @@ double sCPU_addition (sCPU *cpu) {
|
|
|
}
|
|
|
|
|
|
//=======================================
|
|
|
+/*!
|
|
|
+ calculate the subtraction of the two last elements in the stack
|
|
|
+ \param cpu pointers to CPU
|
|
|
+ \return subtraction of tow nummbers
|
|
|
+ */
|
|
|
double sCPU_subtraction (sCPU *cpu) {
|
|
|
|
|
|
#ifdef USE_SUPER_PUPER_GUARDS
|
|
@@ -129,6 +158,11 @@ double sCPU_subtraction (sCPU *cpu) {
|
|
|
}
|
|
|
|
|
|
//=======================================
|
|
|
+/*!
|
|
|
+ calculate the multiplication of the two last elements in the stack
|
|
|
+ \param cpu pointers to CPU
|
|
|
+ \return multiplication of tow nummbers
|
|
|
+ */
|
|
|
double sCPU_multiplication (sCPU *cpu) {
|
|
|
|
|
|
#ifdef USE_SUPER_PUPER_GUARDS
|
|
@@ -155,22 +189,22 @@ double sCPU_multiplication (sCPU *cpu) {
|
|
|
}
|
|
|
|
|
|
//======================================
|
|
|
+/*!
|
|
|
+ Show the CPU and stack
|
|
|
+ \param cpu pointers to CPU
|
|
|
+ */
|
|
|
void sCPU_show (const sCPU *cpu) {
|
|
|
|
|
|
sStack_show (cpu->st);
|
|
|
|
|
|
}
|
|
|
|
|
|
-//=====================================
|
|
|
-bool sCPU_Ok (const sCPU *cpu) {
|
|
|
-
|
|
|
- if (!sStack_Ok (cpu->st)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
-}
|
|
|
-
|
|
|
//=======================================
|
|
|
+/*!
|
|
|
+ calculate sine in degrees
|
|
|
+ \param _number parametet of sine
|
|
|
+ \return rezalt of sine
|
|
|
+ */
|
|
|
double my_sinus (double _number) {
|
|
|
|
|
|
return sin (_number*M_PI/180);
|
|
@@ -178,6 +212,11 @@ double my_sinus (double _number) {
|
|
|
}
|
|
|
|
|
|
//=======================================
|
|
|
+/*!
|
|
|
+ calculate cosine in degrees
|
|
|
+ \param parametet of cosine
|
|
|
+ \return rezalt of cosine
|
|
|
+ */
|
|
|
double my_cosine (double _number) {
|
|
|
|
|
|
return cos (_number*M_PI/180);
|
|
@@ -185,6 +224,11 @@ double my_cosine (double _number) {
|
|
|
}
|
|
|
|
|
|
//======================================
|
|
|
+/*!
|
|
|
+ treats errors
|
|
|
+ \param number of error
|
|
|
+ \return bool parameter
|
|
|
+ */
|
|
|
bool processing_error (const double namb_0f_error) {
|
|
|
|
|
|
if (namb_0f_error == not_enouth_number) {
|