#include "machine.h"#include "stack-c.h"#include "core_math.h"#include "matboolean.h"Include dependency graph for matboolean.c:

Go to the source code of this file.
Defines | |
| #define | ISTK ((integer *)&C2F(stack)) |
Functions | |
| int C2F() | matlog (void) |
| #define ISTK ((integer *)&C2F(stack)) |
| int C2F() matlog | ( | void | ) |
TODO : comment
Definition at line 15 of file matboolean.c.
References C2F, error, fin, i1, i2, il1, ISTK, it1, it2, j, lw, m1, m2, Max, mn1, mn2, n1, n2, non, op, ou, and rhs.
00016 { 00017 static integer ou = 57; 00018 static integer non = 61; 00019 00020 static integer j=0; 00021 static double e1, e2; 00022 extern int C2F(error)(); 00023 static integer i1, i2, l1, l2, m2, n2, m1, n1, op, lw, il1, il2, mn2, it1, it2, mn1, top0; 00024 00025 top0 = C2F(vstk).top; 00026 op = C2F(com).fin; 00027 lw = C2F(vstk).lstk[C2F(vstk).top] + 1; 00028 00029 if (C2F(com).rhs == 2) 00030 { 00031 il2 = C2F(vstk).lstk[C2F(vstk).top - 1] + C2F(vstk).lstk[C2F(vstk).top - 1] - 1; 00032 if (ISTK[il2 - 1] < 0) 00033 { 00034 il2 = ISTK[il2] + ISTK[il2] - 1; 00035 } 00036 m2 = ISTK[il2]; 00037 n2 = ISTK[il2 + 1]; 00038 it2 = ISTK[il2 + 2]; 00039 l2 = (il2 + 4) / 2 + 1; 00040 mn2 = m2 * n2; 00041 --C2F(vstk).top; 00042 } 00043 00044 il1 = C2F(vstk).lstk[C2F(vstk).top - 1] + C2F(vstk).lstk[C2F(vstk).top - 1] - 1; 00045 if (ISTK[il1 - 1] < 0) 00046 { 00047 il1 = ISTK[il1] + ISTK[il1] - 1; 00048 } 00049 m1 = ISTK[il1]; 00050 n1 = ISTK[il1 + 1]; 00051 it1 = ISTK[il1 + 2]; 00052 00053 l1 = (il1 + 4) / 2 + 1; 00054 mn1 = m1 * n1; 00055 if (C2F(com).fin == non) 00056 { 00057 if (mn1 == 0) 00058 { 00059 ISTK[il1 - 1] = 1; 00060 ISTK[il1] = 0; 00061 ISTK[il1 + 1] = 0; 00062 ISTK[il1 + 2] = 0; 00063 00064 C2F(vstk).lstk[C2F(vstk).top] = (il1 + 4) / 2 + 1; 00065 return 0; 00066 } 00067 else 00068 { 00069 ISTK[il1 - 1] = 4; 00070 for (j = 0; j <= mn1 - 1; ++j) 00071 { 00072 e1 = C2F(stack).Stk[l1 + j - 1]; 00073 if (e1 == 0.) 00074 { 00075 ISTK[il1 + 3 + j - 1] = 1; 00076 } 00077 else 00078 { 00079 ISTK[il1 + 3 + j - 1] = 0; 00080 } 00081 } 00082 C2F(vstk).lstk[C2F(vstk).top] = (il1 + 3 + mn1) / 2 + 1; 00083 } 00084 } 00085 else 00086 { 00087 if (mn1 == 0 || mn2 == 0) 00088 { 00089 ISTK[il1 - 1] = 1; 00090 ISTK[il1] = 0; 00091 ISTK[il1 + 1] = 0; 00092 ISTK[il1 + 2] = 0; 00093 00094 C2F(vstk).lstk[C2F(vstk).top] = (il1 + 4) / 2 + 1; 00095 return 0; 00096 } 00097 if (mn1 == 1) 00098 { 00099 i1 = 0; 00100 mn1 = mn2; 00101 } 00102 else 00103 { 00104 i1 = 1; 00105 } 00106 if (mn2 == 1) 00107 { 00108 i2 = 0; 00109 mn2 = mn1; 00110 } 00111 else 00112 { 00113 i2 = 1; 00114 } 00115 if (mn1 != mn2) 00116 { 00117 static integer code_error = 60; 00118 C2F(error)(&code_error); 00119 return 0; 00120 } 00121 if (C2F(com).fin == ou) 00122 { 00123 for (j = 0; j <= mn1 - 1; ++j) 00124 { 00125 e1 = C2F(stack).Stk[l1 + j * i1 - 1]; 00126 e2 = C2F(stack).Stk[l2 + j * i2 - 1]; 00127 if (e1 != 0. || e2 != 0.) 00128 { 00129 ISTK[il1 + 3 + j - 1] = 1; 00130 } 00131 else 00132 { 00133 ISTK[il1 + 3 + j - 1] = 0; 00134 } 00135 } 00136 } 00137 else 00138 { 00139 for (j = 0; j <= mn1 - 1; ++j) 00140 { 00141 e1 = C2F(stack).Stk[l1 + j * i1 - 1]; 00142 e2 = C2F(stack).Stk[l2 + j * i2 - 1]; 00143 if (e1 != 0. && e2 != 0.) 00144 { 00145 ISTK[il1 + 3 + j - 1] = 1; 00146 } 00147 else 00148 { 00149 ISTK[il1 + 3 + j - 1] = 0; 00150 } 00151 } 00152 } 00153 ISTK[il1 - 1] = 4; 00154 ISTK[il1] = Max(m1,m2); 00155 ISTK[il1 + 1] = Max(n1,n2); 00156 00157 C2F(vstk).lstk[C2F(vstk).top] = (il1 + 3 + mn1) / 2 + 1; 00158 return 0; 00159 } 00160 return 0; 00161 }
1.5.1