예제 #1
0
파일: ae2.c 프로젝트: Pidbip/egtkwave
static void free_fn(void* ptr, size_t size)
{
if(ptr)
	{
	free_2(ptr);
	}
}
예제 #2
0
파일: tree.c 프로젝트: Pidbip/egtkwave
/*
 * for debugging purposes only
 */
void treedebug(struct tree *t, char *s)
{
while(t)
	{
	char *s2;

	s2=(char *)malloc_2(strlen(s)+strlen(t->name)+2);
	strcpy(s2,s);
	strcat(s2,".");
	strcat(s2,t->name);
	
	if(t->child)
		{
		treedebug(t->child, s2);
		}

	if(t->t_which>=0) /* for when valid netnames like A.B.C, A.B.C.D exist (not legal excluding texsim) */
			/* otherwise this would be an 'else' */
		{
		printf("%3d) %s\n", t->t_which, s2);
		}

	free_2(s2);
	t=t->next;
	}
}
예제 #3
0
파일: markerbox.c 프로젝트: acklinr/gtkwave
static void ok_callback(GtkWidget *widget, GtkWidget *nothing)
{
(void)widget;
(void)nothing;

if(GLOBALS->dirty_markerbox_c_1)
	{
	int i;
	for(i=0;i<WAVE_NUM_NAMED_MARKERS;i++)
		{
		GLOBALS->named_markers[i]=GLOBALS->shadow_markers_markerbox_c_1[i];
		if(GLOBALS->marker_names[i]) free_2(GLOBALS->marker_names[i]);
		GLOBALS->marker_names[i] = GLOBALS->shadow_marker_names[i];
		GLOBALS->shadow_marker_names[i] = NULL;
		}
        MaxSignalLength();
        signalarea_configure_event(GLOBALS->signalarea, NULL);
        wavearea_configure_event(GLOBALS->wavearea, NULL);
	}

  wave_gtk_grab_remove(GLOBALS->window_markerbox_c_4);
  gtk_widget_destroy(GLOBALS->window_markerbox_c_4);
  GLOBALS->window_markerbox_c_4 = NULL;

  GLOBALS->cleanup_markerbox_c_4();
}
예제 #4
0
/*
 * currently only called by parsewavline
 */
void set_current_translate_proc(char *name)
{
int i;

for(i=1;i<GLOBALS->num_proc_filters+1;i++)
	{
	if(!strcmp(GLOBALS->procsel_filter[i], name)) { GLOBALS->current_translate_proc = i; return; } 
	}

if(GLOBALS->num_proc_filters < PROC_FILTER_MAX)
	{
	GLOBALS->num_proc_filters++;
	load_proc_filter(GLOBALS->num_proc_filters, name);
	if(!GLOBALS->proc_filter[GLOBALS->num_proc_filters])
		{
		GLOBALS->num_proc_filters--;
		GLOBALS->current_translate_proc = 0;
		}
		else
		{
		if(GLOBALS->procsel_filter[GLOBALS->num_proc_filters]) free_2(GLOBALS->procsel_filter[GLOBALS->num_proc_filters]);
		GLOBALS->procsel_filter[GLOBALS->num_proc_filters] = malloc_2(strlen(name) + 1);
		strcpy(GLOBALS->procsel_filter[GLOBALS->num_proc_filters], name);
		GLOBALS->current_translate_proc = GLOBALS->num_proc_filters;
		}
	}
}
예제 #5
0
static void
bundle_cleanup(GtkWidget *widget, gpointer data)
{   
if(entrybox_text_local)
	{
	char *efix;

        efix=entrybox_text_local;
        while(*efix)
                {
                if(*efix==' ')
                        {
                        *efix='_';
                        }
                efix++;
                }

	DEBUG(printf("Bundle name is: %s\n",entrybox_text_local));
	add_vector_selected(entrybox_text_local, selected_rows, bundle_direction);
	free_2(entrybox_text_local);
	}

MaxSignalLength();
signalarea_configure_event(signalarea, NULL);
wavearea_configure_event(wavearea, NULL);
}
예제 #6
0
void remove_all_proc_filters(void)
{
struct Global *GLOBALS_cache = GLOBALS;
int i, j;

for(j=0;j<GLOBALS->num_notebook_pages;j++)
	{
	GLOBALS = (*GLOBALS->contexts)[j];

	if(GLOBALS)
		{
		for(i=1;i<PROC_FILTER_MAX+1;i++)
			{
			if(GLOBALS->proc_filter[i])
				{
				pipeio_destroy(GLOBALS->proc_filter[i]);
				GLOBALS->proc_filter[i] = NULL;
				}
	
			if(GLOBALS->procsel_filter[i])
				{
				free_2(GLOBALS->procsel_filter[i]);
				GLOBALS->procsel_filter[i] = NULL;
				}
			}
		}

	GLOBALS = GLOBALS_cache;
	}
}
예제 #7
0
파일: ghw.c 프로젝트: Pidbip/egtkwave
static void incinerate_whichcache_tree(ghw_Tree *t)
{
if(t->left) incinerate_whichcache_tree(t->left);
if(t->right) incinerate_whichcache_tree(t->right);

free_2(t);
}
예제 #8
0
파일: ghw.c 프로젝트: Zak-Olyarnik/CS-281
static void
read_traces (struct ghw_handler *h)
{
  int *list;
  int i;
  enum ghw_res res;

  list = malloc_2((GLOBALS->numfacs + 1) * sizeof (int));

  while (1)
    {
      res = ghw_read_sm_hdr (h, list);
      switch (res)
	{
	case ghw_res_error:
	case ghw_res_eof:
	  free_2(list);
	  return;
	case ghw_res_ok:
	case ghw_res_other:
	  break;
	case ghw_res_snapshot:
	  if (h->snap_time > GLOBALS->max_time)
	    GLOBALS->max_time = h->snap_time;
	  /* printf ("Time is "GHWLLD"\n", h->snap_time); */

	  for (i = 0; i < h->nbr_sigs; i++)
	    add_history (h, GLOBALS->nxp_ghw_c_1[i], i);
	  break;
	case ghw_res_cycle:
	  while (1)
	    {
	      int sig;

	      /* printf ("Time is "GHWLLD"\n", h->snap_time); */
	      if (h->snap_time < LLDescriptor(9223372036854775807))
		{
		  if (h->snap_time > GLOBALS->max_time)
		    GLOBALS->max_time = h->snap_time;

		  for (i = 0; (sig = list[i]) != 0; i++)
		    add_history (h, GLOBALS->nxp_ghw_c_1[sig], sig);
		}
	      res = ghw_read_cycle_next (h);
	      if (res != 1)
		break;
	      res = ghw_read_cycle_cont (h, list);
	      if (res < 0)
		break;
	    }
	  if (res < 0)
	    break;
	  res = ghw_read_cycle_end (h);
	  if (res < 0)
	    break;
	  break;
	}
    }
}
예제 #9
0
파일: rc.c 프로젝트: Zak-Olyarnik/CS-281
int f_fontname_logfile(char *str)
{
DEBUG(printf("f_fontname_logfile(\"%s\")\n",str));
if(GLOBALS->fontname_logfile) free_2(GLOBALS->fontname_logfile);
GLOBALS->fontname_logfile=(char *)malloc_2(strlen(str)+1);
strcpy(GLOBALS->fontname_logfile,str);
return(0);
}
예제 #10
0
파일: rc.c 프로젝트: Zak-Olyarnik/CS-281
int f_fontname_waves(char *str)
{
DEBUG(printf("f_fontname_signals(\"%s\")\n",str));
if(GLOBALS->fontname_waves) free_2(GLOBALS->fontname_waves);
GLOBALS->fontname_waves=(char *)malloc_2(strlen(str)+1);
strcpy(GLOBALS->fontname_waves,str);
return(0);
}
예제 #11
0
파일: ghw.c 프로젝트: Zak-Olyarnik/CS-281
static void
set_fac_name_1 (struct tree *t)
{
  for (; t != NULL; t = t->next)
    {
      int prev_len = GLOBALS->fac_name_len_ghw_c_1;

      /* Complete the name.  */
      if(t->name[0]) /* originally (t->name != NULL) when using pointers */
	{
	  int len;

	  len = strlen (t->name) + 1;
	  if (len + GLOBALS->fac_name_len_ghw_c_1 >= GLOBALS->fac_name_max_ghw_c_1)
	    {
	      GLOBALS->fac_name_max_ghw_c_1 *= 2;
	      if (GLOBALS->fac_name_max_ghw_c_1 <= len + GLOBALS->fac_name_len_ghw_c_1)
		GLOBALS->fac_name_max_ghw_c_1 = len + GLOBALS->fac_name_len_ghw_c_1 + 1;
	      GLOBALS->fac_name_ghw_c_1 = realloc_2(GLOBALS->fac_name_ghw_c_1, GLOBALS->fac_name_max_ghw_c_1);
	    }
          if(t->name[0] != '[')
		{
	  	GLOBALS->fac_name_ghw_c_1[GLOBALS->fac_name_len_ghw_c_1] = '.';
	  	/* The NUL is copied, since LEN is 1 + strlen.  */
	  	memcpy (GLOBALS->fac_name_ghw_c_1 + GLOBALS->fac_name_len_ghw_c_1 + 1, t->name, len);
	  	GLOBALS->fac_name_len_ghw_c_1 += len;
		}
		else
		{
	  	memcpy (GLOBALS->fac_name_ghw_c_1 + GLOBALS->fac_name_len_ghw_c_1, t->name, len);
	  	GLOBALS->fac_name_len_ghw_c_1 += (len - 1);
		}
	}

      if (t->t_which >= 0)
	{
        struct symchain *sc = GLOBALS->firstnode;
	struct symbol *s = sc->symbol;

	s->name = strdup_2(GLOBALS->fac_name_ghw_c_1);
	s->n = GLOBALS->nxp_ghw_c_1[t->t_which];
	if(!s->n->nname) s->n->nname = s->name;

	t->t_which = GLOBALS->sym_which_ghw_c_1++; /* patch in gtkwave "which" as node is correct */

	GLOBALS->curnode = GLOBALS->firstnode->next;
	free_2(GLOBALS->firstnode);
	GLOBALS->firstnode = GLOBALS->curnode;
	}

      if (t->child)
	set_fac_name_1 (t->child);

      /* Revert name.  */
      GLOBALS->fac_name_len_ghw_c_1 = prev_len;
      GLOBALS->fac_name_ghw_c_1[GLOBALS->fac_name_len_ghw_c_1] = 0;
    }
}
예제 #12
0
파일: vcd2lxt2.c 프로젝트: Pidbip/egtkwave
static char *build_slisthier(void)
{
struct slist *s;
int len=0;

if(!slistroot)
	{
	if(slisthier)
		{
		free_2(slisthier);
		}

	slisthier_len=0;
	slisthier=(char *)malloc_2(1);
	*slisthier=0;
	return(slisthier);
	}

s=slistroot; len=0;
while(s)
	{
	len+=s->len+(s->next?1:0);
	s=s->next;
	}

if(slisthier)
	{
	free_2(slisthier);
	}

slisthier=(char *)malloc_2((slisthier_len=len)+1);
s=slistroot; len=0;
while(s)
	{
	strcpy(slisthier+len,s->str);
	len+=s->len;
	if(s->next)
		{
		strcpy(slisthier+len,vcd_hier_delimeter);
		len++;
		}
	s=s->next;
	}
return(slisthier);
}
예제 #13
0
xl_Tree * xl_delete(char *i, xl_Tree * t) {
/* Deletes i from the tree if it's there.               */
/* Return a pointer to the resulting tree.              */
    xl_Tree * x;
    if (t==NULL) return NULL;
    t = xl_splay(i,t);
    if (strcmp(i, t->item) == 0) {               /* found it */
        if (t->left == NULL) {
            x = t->right;
        } else {
            x = xl_splay(i, t->left);
            x->right = t->right;
        }
        if(t->trans) free_2(t->trans);
        free_2(t->item);
        free_2(t);
        return x;
    }
    return t;                         /* It wasn't there */
}
예제 #14
0
파일: tree.c 프로젝트: Pidbip/egtkwave
void treesort(struct tree *t, struct tree *p)
{
struct tree **tm = NULL;
int tm_siz = 0;

treesort_2(t, p, &tm, &tm_siz);
if(tm)
	{
	free_2(tm);
	}

}
예제 #15
0
파일: gconf.c 프로젝트: Pidbip/egtkwave
static void
writesave_callback(GConfClient* gclient,
                     guint cnxn_id,
                     GConfEntry *entry,
                     gpointer user_data)
{
  if (gconf_entry_get_value (entry) == NULL)
    {
      /* value is unset */
    }
  else
    {
      if (gconf_entry_get_value (entry)->type == GCONF_VALUE_STRING)
        {
	  const char *fni = gconf_value_get_string (gconf_entry_get_value (entry));
	  if(fni && !in_main_iteration())
		{
		  int use_arg = strcmp(fni, "+"); /* plus filename uses default */
		  const char *fn = use_arg ? fni : GLOBALS->filesel_writesave;
		  if(fn)
			{
		  	FILE *wave;
	
		  	if(!(wave=fopen(fn, "wb")))
		        	{
		        	fprintf(stderr, "GTKWAVE | RPC Writesave: error opening save file '%s' for writing.\n", fn);
		        	perror("Why");
		        	errno=0;
		        	}
		        	else
		        	{
		        	write_save_helper(fn, wave);
				if(use_arg)
					{
					if(GLOBALS->filesel_writesave) { free_2(GLOBALS->filesel_writesave); }
					GLOBALS->filesel_writesave = strdup_2(fn);
					}
		        	wave_gconf_client_set_string("/current/savefile", fn);
		        	fclose(wave);
		        	fprintf(stderr, "GTKWAVE | RPC Writesave: wrote save file '%s'.\n", GLOBALS->filesel_writesave);
		        	}
			}
		}

	  gconf_entry_set_value(entry, NULL);
        }
      else
        {
          /* value is of wrong type */
        }
    }
}
예제 #16
0
/*
 * Free up a trace's mallocs...
 */
void FreeTrace(Trptr t)
{
if(straces)
	{
	struct strace_defer_free *sd = calloc_2(1, sizeof(struct strace_defer_free));
	sd->next = strace_defer_free_head;
	sd->defer = t;

	strace_defer_free_head = sd;
	return;
	}

if(t->vector)
      	{
      	bvptr bv;
	int i;

	bv=t->n.vec;
	for(i=0;i<bv->numregions;i++)
		{
		if(bv->vectors[i]) free_2(bv->vectors[i]);
		}
	
	if(bv->bits)
		{
		if(bv->bits->name) free_2(bv->bits->name);
		for(i=0;i<bv->nbits;i++)
			{
			DeleteNode(bv->bits->nodes[i]);
			}
		free_2(bv->bits);
		}

	if(bv->name) free_2(bv->name);
      	if(t->n.vec)free_2(t->n.vec);
      	}
	else
	{
	if(t->n.nd && t->n.nd->expansion)
		{
		DeleteNode(t->n.nd);
		}
	}

if(t->asciivalue) free_2(t->asciivalue);
if((t->is_alias)&&(t->name)) free_2(t->name);

free_2( t );
}
예제 #17
0
xl_Tree * xl_insert(char *i, xl_Tree * t, char *trans) {
/* Insert i into the tree t, unless it's already there.    */
/* Return a pointer to the resulting tree.                 */
    xl_Tree * n;
    int dir;

    n = (xl_Tree *) calloc_2(1, sizeof (xl_Tree));
    if (n == NULL) {
	fprintf(stderr, "xl_insert: ran out of memory, exiting.\n");
	exit(255);
    }
    n->item = strcpy(malloc_2(strlen(i)+1), i);
    if(trans) n->trans = strcpy(malloc_2(strlen(trans)+1), trans);

    if (t == NULL) {
	n->left = n->right = NULL;
	return n;
    }
    t = xl_splay(i,t);
    dir = strcasecmp(i,t->item);
    if (dir<0) {
	n->left = t->left;
	n->right = t;
	t->left = NULL;
	return n;
    } else if (dir>0) {
	n->right = t->right;
	n->left = t;
	t->right = NULL;
	return n;
    } else { /* We get here if it's already in the tree */
             /* Don't add it again                      */
	if(n->trans) free_2(n->trans);
	free_2(n->item);
	free_2(n);
	return t;
    }
}
예제 #18
0
/*
 * currently only called by parsewavline+tcl
 */
static void set_current_translate_generic(char *name, int typ)
{
int i;

if(typ)
	{
	for(i=1;i<GLOBALS->num_file_filters+1;i++)
		{
		if(!strcmp(GLOBALS->filesel_filter[i], name)) { GLOBALS->current_translate_file = i; return; }
		}

	if(!strcmp(WAVE_TCL_INSTALLED_FILTER, name))
		{
		GLOBALS->current_translate_file = 0; return;
		}
	}

if(GLOBALS->num_file_filters < FILE_FILTER_MAX)
	{
	GLOBALS->num_file_filters++;

	if(typ)
		{
		load_file_filter(GLOBALS->num_file_filters, name);
		}
		else
		{
		load_enums_filter(GLOBALS->num_file_filters, name);
		}

	if(!GLOBALS->xl_file_filter[GLOBALS->num_file_filters])
		{
		GLOBALS->num_file_filters--;
		GLOBALS->current_translate_file = 0;
		}
		else
		{
		if(GLOBALS->filesel_filter[GLOBALS->num_file_filters]) free_2(GLOBALS->filesel_filter[GLOBALS->num_file_filters]);

		if(!typ)
			{
			name = WAVE_TCL_INSTALLED_FILTER;
			}

		GLOBALS->filesel_filter[GLOBALS->num_file_filters] = malloc_2(strlen(name) + 1);
		strcpy(GLOBALS->filesel_filter[GLOBALS->num_file_filters], name);
		GLOBALS->current_translate_file = GLOBALS->num_file_filters;
		}
	}
}
예제 #19
0
static void args_entry_callback(GtkWidget *widget, GtkWidget *entry)
{
G_CONST_RETURN gchar *entry_text;

entry_text=gtk_entry_get_text(GTK_ENTRY(entry));
entry_text = entry_text ? entry_text : "";

if(GLOBALS->ttranslate_args)
	{
	free_2(GLOBALS->ttranslate_args);
	}
GLOBALS->ttranslate_args = strdup_2(entry_text);

DEBUG(printf("Args Entry contents: %s\n",entry_text));
}
예제 #20
0
파일: markerbox.c 프로젝트: acklinr/gtkwave
static void str_enter_callback(GtkWidget *entry, gpointer which)
{
G_CONST_RETURN gchar *entry_text;
int i;
uint32_t hashmask =  WAVE_NUM_NAMED_MARKERS;
hashmask |= hashmask >> 1;   
hashmask |= hashmask >> 2;
hashmask |= hashmask >> 4;
hashmask |= hashmask >> 8;
hashmask |= hashmask >> 16;

i = ((int) (((intptr_t) which) & hashmask)) % WAVE_NUM_NAMED_MARKERS;
GLOBALS->dirty_markerbox_c_1 = 1;

entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
if(entry_text && strlen(entry_text))
	{
	if(GLOBALS->shadow_marker_names[i])
		{
		free_2(GLOBALS->shadow_marker_names[i]);
		}

	GLOBALS->shadow_marker_names[i] = strdup_2(entry_text);
	gtk_entry_select_region (GTK_ENTRY (entry),
                             0, GTK_ENTRY(entry)->text_length);

	}
	else
	{
	if(GLOBALS->shadow_marker_names[i])
		{
		free_2(GLOBALS->shadow_marker_names[i]);
		GLOBALS->shadow_marker_names[i] = NULL;
		}
	}
}
예제 #21
0
static void add_filter_callback_2(GtkWidget *widget, GtkWidget *nothing)
{
(void)widget;
(void)nothing;

int i;
GtkCList *cl;

if(!GLOBALS->filesel_ok) { return; }

if(*GLOBALS->fileselbox_text)
	{
	for(i=0;i<GLOBALS->num_file_filters;i++)
		{
		if(GLOBALS->filesel_filter[i])
			{
			if(!strcmp(GLOBALS->filesel_filter[i], *GLOBALS->fileselbox_text))
				{
				status_text("Filter already imported.\n");
				if(GLOBALS->is_active_translate_c_5) gdk_window_raise(GLOBALS->window_translate_c_11->window);
				return;
				}
			}
		}
	}

GLOBALS->num_file_filters++;
load_file_filter(GLOBALS->num_file_filters, *GLOBALS->fileselbox_text);
if(GLOBALS->xl_file_filter[GLOBALS->num_file_filters] && (*GLOBALS->fileselbox_text /* scan-build */))
	{
	if(GLOBALS->filesel_filter[GLOBALS->num_file_filters]) free_2(GLOBALS->filesel_filter[GLOBALS->num_file_filters]);
	GLOBALS->filesel_filter[GLOBALS->num_file_filters] = malloc_2(strlen(*GLOBALS->fileselbox_text) + 1);
	strcpy(GLOBALS->filesel_filter[GLOBALS->num_file_filters], *GLOBALS->fileselbox_text);

	cl=GTK_CLIST(GLOBALS->clist_translate_c_4);
	gtk_clist_freeze(cl);
	gtk_clist_append(cl,(gchar **)&(GLOBALS->filesel_filter[GLOBALS->num_file_filters]));

	gtk_clist_set_column_width(cl,0,gtk_clist_optimal_column_width(cl,0));
	gtk_clist_thaw(cl);
	}
	else
	{
	GLOBALS->num_file_filters--;
	}

if(GLOBALS->is_active_translate_c_5) gdk_window_raise(GLOBALS->window_translate_c_11->window);
}
예제 #22
0
static void load_file_filter(int which, char *name)
{
FILE *f = fopen(name, "rb");
if(!f)
	{
	status_text("Could not open filter file!\n");
	return;
	}

remove_file_filter(which, 0); /* should never happen from GUI, but possible from save files or other weirdness */

while(!feof(f))
	{
	char *s = fgetmalloc(f);
	if(s)
		{
		char *lhs = s;

		while(*lhs && isspace((int)(unsigned char)*lhs)) lhs++;
		if(lhs)
			{
			char *rhs = lhs;

			if(*lhs != '#')	/* ignore comments */
				{
				while(*rhs && !isspace((int)(unsigned char)*rhs)) rhs++;
				if(*rhs)
					{
					char *xlt = rhs+1;
					*rhs = 0;

					while(*xlt && isspace((int)(unsigned char)*xlt)) xlt++;
					if(*xlt)
						{
						GLOBALS->xl_file_filter[which] =  xl_insert(lhs, GLOBALS->xl_file_filter[which], xlt);
						}
					}
				}
			}

		free_2(s);
		}
	}

fclose(f);
}
예제 #23
0
파일: markerbox.c 프로젝트: acklinr/gtkwave
static void destroy_callback(GtkWidget *widget, GtkWidget *nothing)
{
(void)widget;
(void)nothing;

int i;
  for(i=0;i<WAVE_NUM_NAMED_MARKERS;i++)
	{
	if(GLOBALS->marker_names[i]) free_2(GLOBALS->marker_names[i]);
  	GLOBALS->marker_names[i] = GLOBALS->shadow_marker_names[i];
  	GLOBALS->shadow_marker_names[i] = NULL;
	}

  wave_gtk_grab_remove(GLOBALS->window_markerbox_c_4);
  gtk_widget_destroy(GLOBALS->window_markerbox_c_4);
  GLOBALS->window_markerbox_c_4 = NULL;
}
예제 #24
0
void sym_hash_destroy(void *g)
{
struct Global *gg = (struct Global *)g;

#ifdef _WAVE_HAVE_JUDY

JudySLFreeArray(&gg->sym_judy, PJE0);
gg->sym_judy = NULL;

#else

if(gg->sym_hash)
	{
	free_2(gg->sym_hash); gg->sym_hash = NULL;
	}

#endif
}
예제 #25
0
static void enter_callback(GtkWidget *widget, GtkFileSelection *fw)
{
char *allocbuf;
int alloclen;

allocbuf=gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs));
if((alloclen=strlen(allocbuf)))
	{
	filesel_ok=1;
	if(*fileselbox_text) free_2(*fileselbox_text);
	*fileselbox_text=(char *)malloc_2(alloclen+1);
	strcpy(*fileselbox_text, allocbuf);
	}

DEBUG(printf("Filesel OK %s\n",allocbuf));
gtk_grab_remove(fs);
gtk_widget_destroy(fs);
cleanup();
}
예제 #26
0
파일: tree.c 프로젝트: Pidbip/egtkwave
void order_facs_from_treesort(struct tree *t, void *v)
{
struct symbol ***f = (struct symbol ***)v; /* eliminate compiler warning in tree.h as symbol.h refs tree.h */

GLOBALS->facs2_tree_c_1=(struct symbol **)malloc_2(GLOBALS->numfacs*sizeof(struct symbol *));
GLOBALS->facs2_pos_tree_c_1 = GLOBALS->numfacs-1;
order_facs_from_treesort_2(t);

if(GLOBALS->facs2_pos_tree_c_1>=0)
	{
	fprintf(stderr, "Internal Error: GLOBALS->facs2_pos_tree_c_1 = %d\n",GLOBALS->facs2_pos_tree_c_1);
	fprintf(stderr, "[This is usually the result of multiply defined facilities.]\n");
	exit(255);
	}

free_2(*f);
*f = GLOBALS->facs2_tree_c_1;
GLOBALS->facs2_tree_c_1 = NULL;
}
예제 #27
0
static void
bundle_cleanup(GtkWidget *widget, gpointer data)
{ 
if(entrybox_text_local) 
        {
        char *efix;
 
	if(!strlen(entrybox_text_local))
		{
	        DEBUG(printf("Bundle name is not specified--recursing into hierarchy.\n"));
		fetchvex(selectedtree, bundle_direction);
		}
		else
		{
	        efix=entrybox_text_local;
	        while(*efix)
	                {
	                if(*efix==' ')
	                        {
	                        *efix='_';
	                        }
	                efix++;
	                }
	 
	        DEBUG(printf("Bundle name is: %s\n",entrybox_text_local));
	        add_vector_range(entrybox_text_local, 
				fetchlow(selectedtree)->which,
				fetchhigh(selectedtree)->which, 
				bundle_direction);
		}
        free_2(entrybox_text_local);
        }
	else
	{
        DEBUG(printf("Bundle name is not specified--recursing into hierarchy.\n"));
	fetchvex(selectedtree, bundle_direction);
	}

MaxSignalLength();
signalarea_configure_event(signalarea, NULL);
wavearea_configure_event(wavearea, NULL);
}
예제 #28
0
static void load_enums_filter(int which, char *name)
{
int argc;
char **spl = zSplitTclList(name, &argc);
int i;

if((!spl)||(!argc)||(argc&1))
	{
	status_text("Malformed enums list!\n");
	return;
	}

remove_file_filter(which, 0); /* should never happen from GUI, but possible from save files or other weirdness */

for(i=0;i<argc;i+=2)
	{
	char *lhs = spl[i];
	char *xlt = spl[i+1];

	GLOBALS->xl_file_filter[which] =  xl_insert(lhs, GLOBALS->xl_file_filter[which], xlt);
	}
free_2(spl);
}
예제 #29
0
파일: vcd_saver.c 프로젝트: acklinr/gtkwave
static vcdsav_Tree * vcdsav_insert(void *i, vcdsav_Tree * t, int val, unsigned char flags, hptr h) {
/* Insert i into the tree t, unless it's already there.    */
/* Return a pointer to the resulting tree.                 */
    vcdsav_Tree * n;
    int dir;

    n = (vcdsav_Tree *) calloc_2(1, sizeof (vcdsav_Tree));
    if (n == NULL) {
	fprintf(stderr, "vcdsav_insert: ran out of memory, exiting.\n");
	exit(255);
    }
    n->item = i;
    n->val = val;
    n->flags = flags;
    n->hist = h;
    if (t == NULL) {
	n->left = n->right = NULL;
	return n;
    }
    t = vcdsav_splay(i,t);
    dir = vcdsav_cmp_l(i,t->item);
    if (dir<0) {
	n->left = t->left;
	n->right = t;
	t->left = NULL;
	return n;
    } else if (dir>0) {
	n->right = t->right;
	n->left = t;
	t->right = NULL;
	return n;
    } else { /* We get here if it's already in the tree */
             /* Don't add it again                      */
	free_2(n);
	return t;
    }
}
예제 #30
0
파일: ghw.c 프로젝트: Zak-Olyarnik/CS-281
static ghw_Tree * ghw_insert(void *i, ghw_Tree * t, int val, struct symbol *sym) {
/* Insert i into the tree t, unless it's already there.    */
/* Return a pointer to the resulting tree.                 */
    ghw_Tree * n;
    int dir;

    n = (ghw_Tree *) calloc_2(1, sizeof (ghw_Tree));
    if (n == NULL) {
	fprintf(stderr, "ghw_insert: ran out of memory, exiting.\n");
	exit(255);
    }
    n->item = i;
    n->val_old = val;
    n->sym = sym;
    if (t == NULL) {
	n->left = n->right = NULL;
	return n;
    }
    t = ghw_splay(i,t);
    dir = ghw_cmp_l(i,t->item);
    if (dir<0) {
	n->left = t->left;
	n->right = t;
	t->left = NULL;
	return n;
    } else if (dir>0) {
	n->right = t->right;
	n->left = t;
	t->right = NULL;
	return n;
    } else { /* We get here if it's already in the tree */
             /* Don't add it again                      */
	free_2(n);
	return t;
    }
}