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 #include "mensagem.h"
00044 #include "memvirtu.h"
00045 #include "lowparam.h"
00046 #include "lowmacro.h"
00047 #include "lowsolid.h"
00048 #include "eulerops.h"
00049 #include "vectorop.h"
00050 #include "mancommd.h"
00051 #include "genfunc_.h"
00052 #include "hiegroup.h"
00053
00054 #ifdef __Extended_Version
00055 void MSD_execNameSetGroupCurrent(void)
00056 {
00057 char gname[30];
00058
00059 while (1 != sscanf(restbuf, "%s", gname))
00060 {
00061 printf("SetGroupCurrent: name\n");
00062 if (!lineins("? "))
00063 {
00064 return;
00065 }
00066 }
00067 MSD_highNameSetGroupCurrent(gname);
00068 }
00069
00070 #endif
00071
00072 void MSD_highNameSetGroupCurrent(char *nam)
00073 {
00074 GPTYPE gptr;
00075
00076 if (nam[0] == '\0')
00077 {
00078 return;
00079 }
00080 if (nam[0] == '\\')
00081 {
00082 MSD_lowSetGroupCurrent(GNIL);
00083 return;
00084 }
00085
00086 if (!strcmp(nam, ".."))
00087 {
00088 if (def_grpptr != GNIL)
00089 {
00090 MSD_lowSetGroupCurrent(GrpParent(def_grpptr));
00091 return;
00092 }
00093 fprintf(stderr, MEN_NaoPossuiAncestral, NAM_SetCurrentGroup);
00094 return;
00095 }
00096
00097 if ((gptr = MSD_lowFindGroupByName(nam)) != GNIL)
00098 {
00099 MSD_lowSetGroupCurrent(gptr);
00100 return;
00101 }
00102 fprintf(stderr, MEN_NaoEncontrouGroupNome, NAM_SetCurrentGroup, nam);
00103 }
00104
00105 #ifdef __Extended_Version
00106 void MSD_execSetGroupCurrent(void)
00107 {
00108 int gn;
00109
00110 while (1 != sscanf(restbuf, "%d", &gn))
00111 {
00112 printf("SetGroupCurrent: gn\n");
00113 if (!lineins("? "))
00114 {
00115 return;
00116 }
00117 }
00118 MSD_highSetGroupCurrent(gn);
00119 }
00120
00121 #endif
00122
00123 int MSD_highSetGroupCurrent(int gn)
00124 {
00125 GPTYPE gptr;
00126
00127 if (((gptr = MSD_getGroup(gn)) == GNIL) && (gn != -1))
00128 {
00129 fprintf(stderr, MEN_NaoEncontrouGroupId, NAM_SetCurrentGroup, gn);
00130 return(ERROR);
00131 }
00132 return(MSD_lowSetGroupCurrent(gptr));
00133 }
00134
00135 int MSD_lowSetGroupCurrent(GPTYPE gptr)
00136 {
00137 int gn;
00138
00139 if (Gdoinversion)
00140 {
00141 gn = def_grpptr == GNIL ? -1 : GrpGroupNo(def_grpptr);
00142 MSD_lowAddEulerOp(SNIL, SETGRP, gn, 0, 0, 0, 0, 0, 0, 0,
00143 0.0, 0.0, 0.0, 0.0);
00144 }
00145
00146 def_grpptr = gptr;
00147 return(SUCCESS);
00148 }
00149
00150 int MSD_execStructSetGroupCurrent(EulerOp *op)
00151 {
00152 return(MSD_highSetGroupCurrent(op->ip1));
00153 }
00154
00155 void MSD_printStructSetGroupCurrent(FILE *f, EulerOp *op)
00156 {
00157 Id sid, ip1;
00158
00159 sid = op->solidno;
00160 ip1 = op->ip1;
00161 fprintf(f, "setgrp %d %d\n", sid, ip1);
00162 }
00163
00164 int MSD_readStructSetGroupCurrent(FILE *f, EulerOp *op)
00165 {
00166 int solidno, ip1;
00167
00168 if (fscanf(f, "%d %d\n", &solidno, &ip1) != 2)
00169 {
00170 return(ERROR);
00171 }
00172 op->solidno = solidno;
00173 op->ip1 = ip1;
00174 op->ip2 = 0;
00175 op->ip3 = 0;
00176 op->ip4 = 0;
00177 op->ip5 = 0;
00178 op->ip6 = 0;
00179 op->ip7 = 0;
00180 op->ip8 = 0;
00181 op->fp1 = 0.0;
00182 op->fp2 = 0.0;
00183 op->fp3 = 0.0;
00184 op->fp4 = 0.0;
00185 return(SUCCESS);
00186 }
00187
00188 int MSD_modifyStructSetGroupCurrent(EulerOp *op)
00189 {
00190 int groupno;
00191
00192 groupno = MSD_lowCheckTranslatorTable(op->ip1, GROUP);
00193 op->ip1 = groupno;
00194 return(SUCCESS);
00195 }