00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <stdio.h>
00042 #include <string.h>
00043 #ifndef __UNIX_
00044 #include <malloc.h>
00045 #endif
00046 #include "mensagem.h"
00047 #include "memvirtu.h"
00048 #include "lowparam.h"
00049 #include "lowsolid.h"
00050 #include "curvgeom.h"
00051 #include "eulerops.h"
00052 #include "mancommd.h"
00053
00054 typedef struct TransTable TRANSTABLE;
00055
00056 struct TransTable
00057 {
00058 Id OldNo;
00059 Id NewNo;
00060 };
00061
00062 static TRANSTABLE STable[100], GTable[100], ATable[100];
00063 static int STableMax, GTableMax, ATableMax;
00064
00065 typedef struct eulercod EuCode;
00066
00067 struct eulercod
00068 {
00069 OpCode ecode;
00070 char *eop;
00071 int (*xeop)(EulerOp *op);
00072 void (*peop)(FILE *f, EulerOp *op);
00073 int (*reop)(FILE *f, EulerOp *op);
00074 int (*meop)(EulerOp *op);
00075 int num;
00076 };
00077
00078 extern EuCode ematrix[];
00079
00080
00081 SPTYPE MSD_lowModifyEulerOp(EulerOp *op)
00082 {
00083 EuCode *p;
00084
00085 for (p = ematrix; *p->eop; ++p)
00086 {
00087 if (p->ecode == op->opcode)
00088 {
00089 break;
00090 }
00091 }
00092 if ((*p->meop)(op) == ERROR)
00093 {
00094 fprintf(stderr, MEN_ParametrosIncorretos, NAM_ModifyEulerOp);
00095 return(SNIL);
00096 }
00097 return(MSD_getSolid(op->solidno));
00098 }
00099
00100 int MSD_modifyStructError(EulerOp *op)
00101 {
00102 MSD_lowNaoUtilizado(op);
00103
00104 fprintf(stderr, MEN_ParametrosIncorretos, NAM_ModifyEulerOp);
00105 return(ERROR);
00106 }
00107
00108 void MSD_lowIniciaTranslatorTable(void)
00109 {
00110 STableMax = ATableMax = GTableMax = 0;
00111 }
00112
00113 int MSD_lowCheckTranslatorTable(int elemno, int code)
00114 {
00115 int i;
00116
00117 if (elemno == -1)
00118 {
00119 return(-1);
00120 }
00121
00122 switch (code)
00123 {
00124 case SOLID:
00125 for (i = 0; i < STableMax; i++)
00126 {
00127 if (STable[i].OldNo == elemno)
00128 {
00129 return(STable[i].NewNo);
00130 }
00131 }
00132 STable[STableMax].OldNo = elemno;
00133 STable[STableMax++].NewNo = MSD_getMaxSolidId();
00134 return(STable[STableMax - 1].NewNo);
00135
00136 case AXIS:
00137 for (i = 0; i < ATableMax; i++)
00138 {
00139 if (ATable[i].OldNo == elemno)
00140 {
00141 return(ATable[i].NewNo);
00142 }
00143 }
00144 ATable[ATableMax].OldNo = elemno;
00145 ATable[ATableMax++].NewNo = MSD_getMaxAxisId();
00146 return(ATable[ATableMax - 1].NewNo);
00147
00148 case GROUP:
00149 for (i = 0; i < GTableMax; i++)
00150 {
00151 if (GTable[i].OldNo == elemno)
00152 {
00153 return(GTable[i].NewNo);
00154 }
00155 }
00156 GTable[GTableMax].OldNo = elemno;
00157 GTable[GTableMax++].NewNo = MSD_getMaxGroupId();
00158 return(GTable[GTableMax - 1].NewNo);
00159 }
00160 return(-1);
00161 }
00162
00163 void MSD_lowSetTranslatorTable(int elemnoold, int elemno, int code)
00164 {
00165 if ((elemnoold == -1) || (elemno == -1))
00166 {
00167 return;
00168 }
00169 switch (code)
00170 {
00171 case SOLID:
00172 STable[STableMax].OldNo = elemnoold;
00173 STable[STableMax++].NewNo = elemno;
00174 return;
00175
00176 case GROUP:
00177 GTable[GTableMax].OldNo = elemnoold;
00178 GTable[GTableMax++].NewNo = elemno;
00179 return;
00180
00181 case AXIS:
00182 ATable[ATableMax].OldNo = elemnoold;
00183 ATable[ATableMax++].NewNo = elemno;
00184 return;
00185 }
00186 }