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 #define _DVS_
00042 #include <stdio.h>
00043 #include <string.h>
00044 #include <ctype.h>
00045 #ifndef __UNIX_
00046 #include <malloc.h>
00047 #include <stdlib.h>
00048 #ifndef _Windows
00049 #include <graphics.h>
00050 #else
00051 #include <windows.h>
00052 #endif
00053 #endif
00054 #include "mensagem.h"
00055 #include "memvirtu.h"
00056 #include "lowparam.h"
00057 #include "curvgeom.h"
00058 #include "lowsolid.h"
00059 #include "eulerops.h"
00060 #include "shpshape.h"
00061 #include "sethmain.h"
00062 #include "splsplit.h"
00063 #include "hiegroup.h"
00064 #include "animatio.h"
00065 #include "disdispl.h"
00066 #include "genfunc_.h"
00067 #include "gphgraph.h"
00068 #include "analise_.h"
00069 #include "basrov__.h"
00070 #include "rndround.h"
00071 #include "prop.h"
00072 #include "mancommd.h"
00073
00074 int main(int argc, char **argv)
00075 {
00076 char com[20];
00077 COMTYPE *p;
00078 FILE *fp;
00079
00080 objary = SNIL;
00081 OpHead = EuNIL;
00082 SetTrace = FALSE;
00083 error = FALSE;
00084 Gdoinversion = TRUE;
00085 instream = stdin;
00086
00087 g_open();
00088 maninit();
00089
00090 printf("******************* USP Designer *******************\n");
00091 printf("*** Mecatronica/EPUSP - (C)Copyright 1990 - 2008 ***\n");
00092 printf("*** para Pentium IV ----------------- versao 1.3 ***\n");
00093
00094 #if !defined (_Windows)
00095 MSD_lowSetBreakInterruption();
00096 #endif
00097
00098 if ((fp = fopen("autodemo.cad", "r")) != (FILE *)NIL)
00099 {
00100 instream = fp;
00101 }
00102
00103 for ( ; ;)
00104 {
00105 #ifdef __UNIX_
00106 GGGraphicFlush();
00107 #endif
00108 if (lineins("USPDesigner:"))
00109 {
00110 sscanf(restbuf, "%s", com);
00111 skipnext(&restbuf);
00112 strupper((unsigned char *)com);
00113 for (p = comtable; *p->comname; ++p)
00114 {
00115 if (!strncmp(p->comname, com, strlen(com)))
00116 {
00117 break;
00118 }
00119 }
00120 (*p->comfunc)();
00121 }
00122 }
00123 }
00124
00125 void maninit(void)
00126 {
00127 #ifdef __VIRTUAL_MEM
00128 if (objary != SNIL)
00129 {
00130 MSD_highTerminateMemVirtual();
00131 }
00132 #endif
00133
00134 maxs = maxf = maxv = 1;
00135 maxd = 0;
00136 objary = SNIL;
00137 OpHead = EuNIL;
00138 OpHeadRedo = EuNIL;
00139 SetTrace = FALSE;
00140 error = FALSE;
00141 Gdoinversion = TRUE;
00142 Gdodirect = TRUE;
00143 instream = stdin;
00144
00145 g_clear();
00146 lncolor = defltcol = framecol = 0;
00147 Draw = TRUE;
00148 lntype = SOLID_LINE;
00149 abseps = 0.005;
00150 releps = 0.0001;
00151 OutputPlanoCorte = FALSE;
00152 #ifndef __UNIX_
00153 xyratio = 0.7;
00154 #else
00155 xyratio = 1.0;
00156 #endif
00157 dwindbox[0] = windbox[0] = 0.0;
00158 dwindbox[1] = windbox[1] = 0.0;
00159 dwindbox[2] = windbox[2] = 1.0;
00160 angsmooth = 0.4;
00161 camused = grpused = axsused = objused = 0;
00162 vtxused = edgused = facused = 0;
00163 camptr = camary = (CTYPE *)NIL;
00164 grpary = GNIL;
00165 axsary = ANIL;
00166 objary = SNIL;
00167 def_grpptr = GNIL;
00168 defonum = 0;
00169 monisw = FALSE;
00170 monicptr = (CTYPE *)NIL;
00171 instream = stdin;
00172 dspfrptr = dspfwptr = (FILE *)NIL;
00173 breakflg = FALSE;
00174 ListaEscoamento = (LOPType *)NIL;
00175 NumListaEscoamento = 0;
00176 #ifdef __VIRTUAL_MEM
00177 MSD_highIniciateMemVirtual();
00178 #endif
00179 }
00180
00181 void MSD_readFileExecute(void)
00182 {
00183 char name[30];
00184
00185 while (1 != sscanf(restbuf, "%s", name))
00186 {
00187 printf("Arquivo ");
00188 if (!lineins("? "))
00189 {
00190 instream = stdin;
00191 return;
00192 }
00193 }
00194 MSD_executeFileCommand(name);
00195 }
00196
00197 void MSD_executeFileCommand(char *name)
00198 {
00199 FILE *fp;
00200 char namecad[30];
00201
00202 if (instream != stdin)
00203 {
00204 fclose(instream);
00205 instream = stdin;
00206 }
00207 if ((fp = fopen(name, "r")) == (FILE *)NIL)
00208 {
00209 strcpy(namecad, name);
00210 strcat(namecad, ".cad");
00211 if ((fp = fopen(namecad, "r")) == (FILE *)NIL)
00212 {
00213 printf("Nao conseguiu abrir o arquivo %s !\n", name);
00214 instream = stdin;
00215 return;
00216 }
00217 }
00218 instream = fp;
00219 }
00220
00221 void endfunc(void)
00222 {
00223 if (instream == stdin)
00224 {
00225 g_close();
00226 printf("Sistema encerrado!\n");
00227 #ifdef __VIRTUAL_MEM
00228 MSD_highTerminateMemVirtual();
00229 #endif
00230 exit(0);
00231 }
00232 else
00233 {
00234 fclose(instream);
00235 instream = stdin;
00236 }
00237 }
00238
00239 void comerror(void)
00240 {
00241 printf("Comando Incorreto!\n");
00242 }