home *** CD-ROM | disk | FTP | other *** search
- #include "../h/rccl.h"
-
-
- main()
- {
- static TRSF t0 = {"T0", NULL,1.,0.,0.,0.,1.,0.,0.,0.,1.,0.,0.,0.};
- static TRSF t1 = {"T1", NULL,1.,0.,0.,0.,1.,0.,0.,0.,1.,1.,1.,1.};
- static TRSF t2 = {"T2", NULL,1.,0.,0.,0.,1.,0.,0.,0.,1.,2.,2.,2.};
- static TRSF t3 = {"T3", NULL,1.,0.,0.,0.,1.,0.,0.,0.,1.,3.,3.,3.};
- static TRSF t4 = {"T4", NULL,1.,0.,0.,0.,1.,0.,0.,0.,1.,4.,4.,4.};
- char *gensym();
- int fd = makedb("big");
-
- savetr(&t2, fd);
- savetr(&t1, fd);
- savetr(&t0, fd);
- savetr(&t0, fd);
- savetr(&t1, fd);
- dumpdb(fd, NO);
- t0.p.x = t0.p.y = t0.p.z = -1.;
- gettr(&t0, fd);
- printf("%f %f %f\n", t0.p.x, t0.p.y, t0.p.z);
- gettr(&t3, fd);
- savetr(&t3, fd);
- gettr(&t3, fd);
- printf("%f %f %f\n", t3.p.x, t3.p.y, t3.p.z);
- dumpdb(fd, YES);
- remtr((&t2)->name, fd);
- dumpdb(fd, YES);
- remtr((&t2)->name, fd);
- savetr(&t2, fd);
- dumpdb(fd, NO);
- remtr((&t0)->name, fd);
- remtr((&t1)->name, fd);
- remtr((&t2)->name, fd);
- remtr((&t3)->name, fd);
- dumpdb(fd, YES);
- savetr(&t3, fd);
- savetr(&t2, fd);
- savetr(&t1, fd);
- savetr(&t0, fd);
- savetr(&t3, fd);
- dumpdb(fd, YES);
- remtr((&t3)->name, fd);
- remtr((&t2)->name, fd);
- remtr((&t1)->name, fd);
- remtr((&t0)->name, fd);
- dumpdb(fd, YES);
-
- for (; ; ) {
- t0.name = gensym();
- t0.p.x += 1.;
- printf("%s\n", t0.name);
- if (savetr(&t0, fd) < 0) {
- break;
- }
- }
- }
-
- char *gensym() /*::*/
- {
- char *strsave(), *sprintf(), *strcpy(), *strcat();
- static int n = 0;
- static char root[] = "_TEMP", str[10], name[15];
-
- n++;
- (void) sprintf(str, "%d", n);
- return(strsave(strcat(strcpy(name,root), str)));
- }
-
-
-
- #undef malloc
- char *strsave(s) /*::*/
- char *s;
- {
- char *p, *malloc(), *strcpy();
-
- if ((p = malloc((unsigned)strlen(s) + 1)) == NULL) {
- exit(99);
- }
- (void) strcpy(p, s);
- return(p);
- }
-