From 7a5184e58e92bbef17feaf9a91449880ee55d937 Mon Sep 17 00:00:00 2001 From: epoch Date: Sat, 16 May 2020 16:54:13 -0500 Subject: I should stop commiting code that does not compile. it compiles now. going to commit, push, then check for runtime errors. --- src/hackvr.c | 105 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/src/hackvr.c b/src/hackvr.c index cf441ea..f2bc438 100644 --- a/src/hackvr.c +++ b/src/hackvr.c @@ -154,14 +154,12 @@ int hackvr_handler(char *line) { int ret=0; int len; int j,i,k,l; - int key_count; + unsigned int key_count; c3_group_rot_t *gr; real tmpx,tmpy,tmpz; char **a; char **keys; - char tmp[256]; struct entry *m; - struct entry *next; char helping=0;//a flag that we can check for to see if we need to output our help // radians tmpradx,tmprady,tmpradz; radians tmprady; @@ -229,26 +227,23 @@ int hackvr_handler(char *line) { global.shape[l]=0; } //now do the same stuff but for the group_rot structs. - if(!strchr(a[2],'*')) {//no globs, this is easy... - ht_delete(&global.ht_group,m->original); - } else { - keys=ht_getkeys(&global.ht_group,&key_count); - for(i=0;ioriginal)) { - if(m->target != &global.camera) { - free(m->target->id); - free(m->target);//ht_delete doesn't know that the target is a malloc()d structure, so we have to do this. - ht_delete(&global.ht_group,m->original); - } + keys=ht_getkeys(&global.ht_group,&key_count); + for(i=0;ioriginal)) {//we're inverting the glob match + if(m->target != &global.camera) { + gr=m->target; + free(gr->id); + free(gr);//ht_delete doesn't know that the target is a malloc()d structure, so we have to do this. + ht_delete(&global.ht_group,m->original); } - } else { - fprintf(stderr,"# somehow an item is in the list of keys but ht_getentry failed. '%s'\n",a[2]); - abort(); } + } else { + fprintf(stderr,"# somehow an item is in the list of keys but ht_getentry failed. '%s'\n",a[2]); + abort(); } - free(keys); } + free(keys); ret=1; return ret; } @@ -258,43 +253,53 @@ int hackvr_handler(char *line) { /* ---------- */ if(helping) fprintf(stderr,"# _ deletegroup grou*\n"); if(!strcmp(command,"deletegroup")) {//should the grouprot get deleted too? sure... - if(len == 3) { - for(j=0;global.shape[j] && j < MAXSHAPES;j++) { - if(!glob_match(a[2],global.shape[j]->id)) { - free(global.shape[j]->id); - free(global.shape[j]); - global.shape[j]=0; - } - } - //we now have an array that needs to be compressed. - //max length of j. - for(k=0;kid)) { + free(global.shape[j]->id); + free(global.shape[j]); + global.shape[j]=0; + } + } + //we now have an array that needs to be compressed. + //max length of j. + for(k=0;ktarget != &global.camera) { - free(m->target->id); - free(m->target); + //maybe later... + gr=m->target; + free(gr->id); + free(gr); ht_delete(&global.ht_group,m->original); } - } else { - fprintf(stderr,"# somehow an item is in the list of keys but ht_getentry failed. '%s'\n",a[2]); - abort(); } + } else { + keys=ht_getkeys(&global.ht_group,&key_count); + for(i=0;itarget != &global.camera) { + gr=m->target; + free(gr->id); + free(gr); + ht_delete(&global.ht_group,m->original); + } + } else { + fprintf(stderr,"# somehow an item is in the list of keys but ht_getentry failed. '%s'\n",a[2]); + abort(); + } + } + free(keys); } - free(keys); + ret=1; + return ret; } - ret=1; - return ret; - } } -- cgit v1.2.3