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 "vectorop.h"
00049 #include "mancommd.h"
00050 #include "genfunc_.h"
00051 #include "eulerops.h"
00052 #include "hiegroup.h"
00053
00054 #ifdef __Extended_Version
00055 void MSD_execNameCreateGroup(void)
00056 {
00057 char name[30];
00058
00059 while (1 != sscanf(restbuf, "%s", name))
00060 {
00061 printf("crtgrp: nome\n");
00062 if (!lineins("? "))
00063 {
00064 return;
00065 }
00066 }
00067 MSD_highNameCreateGroup(name);
00068 }
00069
00070 #endif
00071
00072 int MSD_highNameCreateGroup(char *name)
00073 {
00074 GPTYPE gptr;
00075 int gn;
00076
00077 if (MSD_getGroupIdFromName(name) != -1)
00078 {
00079 fprintf(stderr, MEN_GroupJaExiste, NAM_CreateGroup, name);
00080 return(ERROR);
00081 }
00082 if ((gn = MSD_highCreateGroup()) != -1)
00083 {
00084 gptr = MSD_getGroup(gn);
00085 strcpy(GrpName(gptr), name);
00086 return(SUCCESS);
00087 }
00088 return(ERROR);
00089 }
00090
00091 #ifdef __Extended_Version
00092 void MSD_execCreateGroup(void)
00093 {
00094 printf("Id = %d\n", MSD_highCreateGroup());
00095 }
00096
00097 #endif
00098
00099 int MSD_highCreateGroup(void)
00100 {
00101 Id gn;
00102
00103 gn = MSD_getMaxGroupId();
00104 return(MSD_lowCreateGroup(gn) == ERROR ? -1 : gn);
00105 }
00106
00107 int MSD_middleCreateGroup(int gn)
00108 {
00109 return(MSD_lowCreateGroup(gn));
00110 }
00111
00112 int MSD_lowCreateGroup(Id gn)
00113 {
00114 GPTYPE gptr;
00115
00116 if ((gptr = (GPTYPE)MSD_lowNewElement(GROUP, NNIL)) == GNIL)
00117 {
00118 fprintf(stderr, MEN_NaoPossuiMemoria, NAM_CreateGroup);
00119 return(ERROR);
00120 }
00121 GrpGroupNo(gptr) = gn;
00122
00123 if (Gdoinversion)
00124 {
00125 MSD_lowAddEulerOp(SNIL, REMGRP, gn, 0, 0, 0, 0, 0, 0, 0,
00126 0.0, 0.0, 0.0, 0.0);
00127 }
00128 return(SUCCESS);
00129 }
00130
00131 int MSD_execStructCreateGroup(EulerOp *op)
00132 {
00133 return(MSD_middleCreateGroup(op->ip1));
00134 }
00135
00136 void MSD_printStructCreateGroup(FILE *f, EulerOp *op)
00137 {
00138 Id sid, ip1;
00139
00140 sid = op->solidno;
00141 ip1 = op->ip1;
00142 fprintf(f, "crtgrp %d %d\n", sid, ip1);
00143 }
00144
00145 int MSD_readStructCreateGroup(FILE *f, EulerOp *op)
00146 {
00147 int solidno, ip1;
00148
00149 if (fscanf(f, "%d %d\n", &solidno, &ip1) != 2)
00150 {
00151 return(ERROR);
00152 }
00153 op->solidno = solidno;
00154 op->ip1 = ip1;
00155 op->ip2 = 0;
00156 op->ip3 = 0;
00157 op->ip4 = 0;
00158 op->ip5 = 0;
00159 op->ip6 = 0;
00160 op->ip7 = 0;
00161 op->ip8 = 0;
00162 op->fp1 = 0.0;
00163 op->fp2 = 0.0;
00164 op->fp3 = 0.0;
00165 op->fp4 = 0.0;
00166 return(SUCCESS);
00167 }
00168
00169 int MSD_modifyStructCreateGroup(EulerOp *op)
00170 {
00171 int groupno;
00172
00173 groupno = MSD_lowCheckTranslatorTable(op->ip1, GROUP);
00174 op->ip1 = groupno;
00175 return(SUCCESS);
00176 }