コード例 #1
0
ファイル: pike.c プロジェクト: ajinkya007/pike-1
/*! @decl array(array(string)|string) tokenize(string code)
 *!
 *!   Tokenize a string of Pike tokens.
 *!
 *! @returns
 *!   Returns an array with Pike-level tokens and the remainder (a
 *!   partial token), if any.
 */
static void f_tokenize( INT32 args )
{
  struct array *res;
  struct pike_string *left_s = NULL; /* Make gcc happy. */
  struct pike_string *data;
  int left;
  ONERROR tmp;

  get_all_args("tokenize", args, "%W", &data);

  if(!data->len)
  {
    pop_n_elems(args);
    push_empty_array();
    push_empty_string();
    f_aggregate(2);
    return;
  }

  res = allocate_array_no_init( 0, 128 );
  SET_ONERROR(tmp, do_free_arrayptr, &res);
  
  switch(data->size_shift)
  {
    case 0:
      left = tokenize0(&res, STR0(data), data->len);
      left_s = make_shared_binary_string0(STR0(data)+left, data->len-left);
      break;
    case 1:
      left = tokenize1(&res, STR1(data), data->len);
      left_s = make_shared_binary_string1(STR1(data)+left, data->len-left);
      break;
    case 2:
      left = tokenize2(&res,STR2(data), data->len);
      left_s = make_shared_binary_string2(STR2(data)+left, data->len-left);
      break;
#ifdef PIKE_DEBUG
    default:
      Pike_error("Unknown shift size %d.\n", data->size_shift);
#endif
  }

  UNSET_ONERROR(tmp);
  pop_n_elems(args);
  if (!res->size) {
    free_array(res);
    push_empty_array();
  }
  else
    push_array(res);
  push_string( left_s );
  f_aggregate( 2 );
}
コード例 #2
0
ファイル: main.c プロジェクト: DarylX/4061
int main(int argc, const char * argv[]) {
	char filename[MAX_LENGTH];
	node_t * nodes[MAX_NODES];
	FILE * file;
	int count;
	int i;

    //check that there is correct number of arguments
	if (argc != 2) {
		printf("graphexec requires 2 arguments.\n");
        return -1;
    }
    
    //open file and check that it was sucessful
	file = fopen(argv[1], "r");
	if (!file) {
		printf("The file specified does not exist or could not be opened.\n");
	}
    
    //if things check out, proceed to read and process file
    else {
		count = read_file(file, nodes, MAX_NODES);
        bool finished;
        
		while (!finished) {
			finished = true;
			determine_eligible(nodes, count);
            
            //iterate through and run nodes that are marked READY
			for (i = 0; i < count; i++) {
				if (nodes[i]->status != FINISHED) {
					finished = false;
					if (nodes[i]->status == READY) {
						printf("Node %i Status: Running", i);
						if(run_node(nodes[i]) == FINISHED &&
                            run_node(nodes[i]) != -1) {
                            printf(" >> Finished!\n");
                        } else
                            perror("Error running node");
					}
				}
			}
		}
        
		//cleanup
		free_array(nodes, count);
        if (fclose(file) == -1)
            perror("Failed to close file");
	}
    
	return 0;
}
コード例 #3
0
ファイル: motif-in.c プロジェクト: a1aks/Haystack
/*
 * Set the background source to be used for pseudocounts.
 * The background is resolved by the following rules:
 * - If source is:
 *   null or "--nrdb--"       use nrdb frequencies
 *   "--uniform--"            use uniform frequencies
 *   "motif-file"             use frequencies in motif file
 *   file name                read frequencies from bg file
 */
void mread_set_bg_source(MREAD_T *mread, const char *source) {
  // clean up old bg
  if (mread->other_bg != NULL) free_array(mread->other_bg);
  mread->other_bg = NULL;
  if (mread->other_bg_src != NULL) free(mread->other_bg_src);
  mread->other_bg_src = NULL;
  // copy the passed source
  if (source != NULL) {
    mread->other_bg_src = strdup(source);
  }
  // check if we've chosen a parser already
  if (mread->success) set_pseudo_bg(mread);
}
コード例 #4
0
/*
 shrink(double** A, double t, int M) applies the shrink operator on A with thresholding parameter t. 
 
 The idea is to compute the SVD of A, A=U*S*V, then create the matrix B

     B = U * S2 * V, 

     where S2_{i,i} = S_{i,i} if ((S_{i,i}-)*t>0) and 
           S2_{i,i} = 0 otherwise.
   
    Then it returns B.

*/
double* shrink(double* A, double tau, int nrows, int ncols, char method){
	int i;
	int info = 0;
	char JOBU = 'A';
	char JOBVT = 'A';

	int LWORK = fmax(fmax(1,3*fmin(nrows,ncols)+fmax(nrows,ncols)),5*fmin(nrows,ncols));
	double* WORK = alloc_array(1, LWORK);
	double* U = alloc_array(nrows, nrows);
	double* VT = alloc_array(ncols, ncols);
	double* S = alloc_array(fmin(nrows,ncols), fmin(nrows, ncols));
	int min_dim = fmin(nrows,ncols);
	
	dgesvd_(&JOBU, &JOBVT, &nrows, &ncols, A, &nrows, S, U, &nrows, VT, &ncols, WORK, &LWORK, &info);
	
	if( method == 'S' ){
		for( i = 0; i < min_dim; i++){
				S[i] = fmax(0.0, S[i] - tau);
		}
	}
	else if( method == 'P' ){
		#pragma omp parallel for
		for(i=0; i < min_dim;i++){
				S[i] = fmax(0.0, S[i] - tau);
		}
	}
	double* C = alloc_array_z(nrows,ncols);
	
	//C = mm(mm(U, nrows, nrows, 't', diag(S,nrows, ncols), nrows, ncols, 'n'), nrows, ncols, 'n', VT, ncols, ncols, 't');
	C = mm(mm(VT, ncols, ncols, 'n', diag(S,ncols, nrows), ncols, nrows, 'n'), ncols, nrows, 'n', U, nrows, nrows, 'n');
	
	//free_array(A);
	free_array(WORK);
	free_array(U);
	free_array(VT);
	free_array(S);
	
	return C;
}	
コード例 #5
0
ファイル: motif-in.c プロジェクト: a1aks/Haystack
/*
 * Set the background to be used for pseudocounts.
 */
void mread_set_background(MREAD_T *mread, const ARRAY_T *bg) {
  // clean up old bg
  if (mread->other_bg != NULL) free_array(mread->other_bg);
  mread->other_bg = NULL;
  if (mread->other_bg_src != NULL) free(mread->other_bg_src);
  mread->other_bg_src = NULL;
  // copy the passed background
  if (bg != NULL) {
    mread->other_bg = allocate_array(get_array_length(bg));
    copy_array(bg, mread->other_bg);
  }
  // check if we've chosen a parser already
  if (mread->success) set_pseudo_bg(mread);
}
コード例 #6
0
ファイル: circuit.c プロジェクト: DaniHaag/jsPlumb_Liviz.js
int circuit_model(graph_t * g, int nG)
{
    double **Gm;
    double **Gm_inv;
    int rv;
    long i, j;
    node_t *v;
    edge_t *e;

    Gm = new_array(nG, nG, 0.0);
    Gm_inv = new_array(nG, nG, 0.0);

    /* set non-diagonal entries */
    for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
	for (e = agfstedge(g, v); e; e = agnxtedge(g, e, v)) {
	    i = AGID(agtail(e));
	    j = AGID(aghead(e));
	    if (i == j)
		continue;
	    /* conductance is 1/resistance */
	    Gm[i][j] = Gm[j][i] = -1.0 / ED_dist(e);	/* negate */
	}
    }

    rv = solveCircuit(nG, Gm, Gm_inv);

    if (rv)
	for (i = 0; i < nG; i++) {
	    for (j = 0; j < nG; j++) {
		GD_dist(g)[i][j] =
		    Gm_inv[i][i] + Gm_inv[j][j] - 2.0 * Gm_inv[i][j];
	    }
	}
    free_array(Gm);
    free_array(Gm_inv);
    return rv;
}
コード例 #7
0
// Searches through the device along pathname for target file 
// Returns the target file's inode number if found
int getino(int device, const char* pathname)
{
    int ino = 0;
    char** name = NULL; 

    if(strcmp(pathname, "/") == 0)
        return ROOT_INODE;

    name = parse(pathname, "/");

    // Absolute or Relative?
    if(pathname[0] == '/')
        ino = search(root, name[0]);        // Absolute: start at root
    else
        ino = search(running->cwd, name[0]);// Relative: start at cwd

    if(ino <= 0)
    {
        free_array(name);
        return DOES_NOT_EXIST; 
    }

    // Continue search
    int i = 0;
    while(name[++i])
    {
        if((ino = search(iget(device, ino), name[i])) <= 0)
        {
            free_array(name);
            return DOES_NOT_EXIST;
        }
    }

    free_array(name);
    return ino;
}
コード例 #8
0
ファイル: profiler.c プロジェクト: alexsilva/lua_profiler
/* CLEANUP */
static void free_array(Meta **array, int size) {
    int index;
    Meta *meta;
    for (index = 0; index < size; index++) {
        meta = array[index]; // recursive cleaning
        if (meta->children->list)
            free_array(meta->children->list,
                       meta->children->index);
        free(meta->measure);
        free(meta->children);
        free(meta);
    }
    // free the main object
    free(array);
}
コード例 #9
0
void	obj_read_mtllib_read_tr(t_obj *obj, char *line)
{
	char	**datas;

	if (!(datas = ft_strsplit(line, ' ')))
		ERROR("ft_strsplit failed");
	if (!datas[0] || !datas[1] || datas[2])
		ERROR("invalid mtl tr line");
	if (!parse_valid_number(datas[1]))
		ERROR("invalid mtl tr value");
	if (!obj->current_mtl)
		ERROR("no current mtl for tr");
	obj->current_mtl->mtl.tr = 1 - ft_atod(datas[1]);
	free_array(datas);
}
コード例 #10
0
void
free_lex_ctxt (lex_ctxt * c)
{
  int i;

#if 0
  if (c->exit_flag && c->up_ctxt != NULL)
    ((lex_ctxt *) c->up_ctxt)->exit_flag = 1;
#endif
  deref_cell (c->ret_val);
  free_array (&c->ctx_vars);
  for (i = 0; i < FUNC_NAME_HASH; i++)
    {
      free_func_chain (c->functions[i]);
    }
  efree (&c);
}
コード例 #11
0
ファイル: main.c プロジェクト: Ap0c/sorting
int main(int argc, char *argv[]) {

	int *array = random_gen(ARRAY_SIZE);

	printf("\n# ----- Original Data ----- #\n\n");
	print_array(array, ARRAY_SIZE);

	insertion_int(array, ARRAY_SIZE);

	printf("\n# ----- Sorted Data ----- #\n\n");
	print_array(array, ARRAY_SIZE);
	printf("\n");
	free_array(array);

	return 0;

}
コード例 #12
0
ファイル: shadow.c プロジェクト: rebryant/Cloud-BDD
/* Use CUDD to compute number of BDD nodes to represent set of functions */
size_t cudd_size(shadow_mgr mgr, set_ptr roots) {
    if (!mgr->do_cudd)
	return 0;
    size_t nele = roots->nelements;
    DdNode **croots = calloc_or_fail(nele, sizeof(DdNode *), "cudd_size");
    word_t wr;
    int i = 0;
    set_iterstart(roots);
    while (set_iternext(roots, &wr)) {
	ref_t r = (ref_t) wr;
	DdNode *n = get_ddnode(mgr, r);
	croots[i++] = n;
    }
    int cnt = Cudd_SharingSize(croots, nele);
    free_array(croots, nele, sizeof(DdNode *));
    return (size_t) cnt;
}
コード例 #13
0
static void
free_anon_var(anon_nasl_var* v)
{
  if (v == NULL)
    return;
  switch(v->var_type)
    {
    case VAR2_STRING:
    case VAR2_DATA:
      efree(&v->v.v_str.s_val);
      break;
    case VAR2_ARRAY:
      free_array(&v->v.v_arr);
      break;
    }
  efree(&v);

}
コード例 #14
0
ファイル: dwlib.c プロジェクト: Yuffster/fluffOS
void f_fetch_class_member() {
   int pos = sp->u.number;
   array_t *arr;

   pos = sp->u.number;
   pop_stack();

   if( sp->type != T_CLASS )
      error( "Argument to fetch_class_member() not a class.\n" );

   arr = sp->u.arr;

   if( pos < 0 || pos >= arr->size )
      error( "Class index out of bounds.\n" );

   assign_svalue_no_free( sp, &arr->item[pos] );
   free_array( arr );
}
コード例 #15
0
ファイル: backend.c プロジェクト: Hobbitron/tmi2_fluffos_v3
/* New version used when not in -o mode. The epilog() in master.c is
 * supposed to return an array of files (castles in 2.4.5) to load. The array
 * returned by apply() will be freed at next call of apply(), which means that
 * the ref count has to be incremented to protect against deallocation.
 *
 * The master object is asked to do the actual loading.
 */
void preload_objects (int eflag)
{
    VOLATILE array_t *prefiles;
    svalue_t *ret;
    VOLATILE int ix;
    error_context_t econ;

    save_context(&econ);
    if (SETJMP(econ.context)) {
        restore_context(&econ);
        pop_context(&econ);
        return;
    }
    push_number(eflag);
    ret = apply_master_ob(APPLY_EPILOG, 1);
    pop_context(&econ);
    if ((ret == 0) || (ret == (svalue_t *)-1) || (ret->type != T_ARRAY))
        return;
    else
        prefiles = ret->u.arr;
    if ((prefiles == 0) || (prefiles->size < 1))
        return;

    debug_message("\nLoading preloaded files ...\n");
    prefiles->ref++;
    ix = 0;
    /* in case of an error, effectively do a 'continue' */
    save_context(&econ);
    if (SETJMP(econ.context)) {
        restore_context(&econ);
        ix++;
    }
    for ( ; ix < prefiles->size; ix++) {
        if (prefiles->item[ix].type != T_STRING)
            continue;

        set_eval(max_cost);

        push_svalue(((array_t *)prefiles)->item + ix);
        (void) apply_master_ob(APPLY_PRELOAD, 1);
    }
    free_array((array_t *)prefiles);
    pop_context(&econ);
}       /* preload_objects() */
コード例 #16
0
ファイル: shape_utils.c プロジェクト: kvjanos/irodalom
/************************************************
 * gauss_elim(matrix, pivots, size)             *
 * --                                           *
 *  Performs Gaussian Elimination on matrix     *
 *  sizeXsize, storing the pivot order in pivot *
 ************************************************/
void gauss_elim(double *m, int *pivot, int n) {
  int i, j, k, max, temp;
  double s, s_max, pivot_el, pivot_el_max;
  double *scale = (double *) malloc(sizeof(double)*n);

  //print_matrix(stdout, m, n, n);
  
  //find largest value in each row
  for (i = 0; i < n; ++i) {
    s = s_max = 0;
    for (j = 0; j < n; ++j) {
      if ((s = fabs(m[(i*n)+j])) > s_max) {
        s_max = s;
      }
    }
    scale[i] = s_max;
  }

  //get largest element from each column
  for (j = 0; j < n-1; ++j) {
    pivot_el_max = -10e37;
    for (i = j; i < n; ++i) {
      pivot_el = fabs(m[(pivot[i]*n)+j]) / scale[pivot[i]];
      if (pivot_el > pivot_el_max) {
        pivot_el_max = pivot_el;
        max = i;
      }
    }
    //Interchange Row op
    temp = pivot[j];
    pivot[j] = pivot[max];
    pivot[max] = temp;
    for (i = j+1; i < n; ++i) {
      m[(pivot[i]*n)+j] /= m[(pivot[j]*n)+j];

      //other elements are affected
      for (k = j+1; k < n; ++k) {
        m[(pivot[i]*n)+k] -= (m[(pivot[i]*n)+j] * m[(pivot[j]*n)+k]);
      }
    }
  }
  
  free_array((void *)scale);
}
コード例 #17
0
ファイル: sph_system.cpp プロジェクト: NadineAB/SPHfluid
SPHSystem::~SPHSystem()
{
	free(hMem);
	free(hParam);
	free(hPoints);

	free_array(dMem);
	free_array(dHash);
	free_array(dIndex);
	free_array(dStart);
	free_array(dEnd);
	free_array(dPoints);
}
コード例 #18
0
ファイル: main.c プロジェクト: duyatran/cosc301-proj02
process *delete_process(process *head, pid_t pid){
	process *tmp = head;	
	if (head->pid == pid){
		head = head->next;
	}
	else {
		while (tmp->next != NULL){
			process *before = tmp;
			tmp = tmp->next;
			if (tmp->pid == pid){
				before->next = tmp->next;
				break;
			}
		}
	}
	free_array(tmp->command);
	free(tmp);
	return head;
}
コード例 #19
0
ファイル: objs__model_id.cpp プロジェクト: pgrawehr/golgotha
void g1_model_list_class::cleanup()
{
	free_array();
	if (g1_object_heap)
	{
		delete g1_object_heap;
	}

	if (name_buffer)
	{
		delete name_buffer;
	}

	if (array)
	{
		i4_free(array);
		array=0;
	}
}
コード例 #20
0
ファイル: basic.c プロジェクト: GrahamClemo/bitbasic
void bas_release_object(Object* object)
{
    object->ref_count --;
    if (object->ref_count == 0)
    {
        if (object->type == kTypeArray)
            free_array((Array*)object);
        else if (object->type == kTypeFunction)
            free_function((Function*)object);
        else if (object->type == kTypeString)
            free_string((String*)object);
        else
        {
            ASSERT(0); // object destructor not implemented!
        }
    }

    mem_free(object);
}
コード例 #21
0
ファイル: matrix.c プロジェクト: xcw0579/mudOS
void f_lookat_rotate2 (void)
{
    array_t *matrix;
    double ex, ey, ez, lx, ly, lz;
    Matrix current_matrix;
    Matrix lookat_matrix;
    int i, j;

    for (j = 4; j >= 0; j--) {
        if ((sp - j)->type != T_REAL) {
            bad_arg(7 - j, F_LOOKAT_ROTATE2);
        }
    }
    /*
     * get arguments from stack.
     */
    matrix = (sp - 6)->u.arr;
    ex = (sp - 5)->u.real;
    ey = (sp - 4)->u.real;
    ez = (sp - 3)->u.real;
    lx = (sp - 2)->u.real;
    ly = (sp - 1)->u.real;
    lz = sp->u.real;
    sp -= 5;
    free_array((sp--)->u.arr);

    /*
     * convert vec matrix to float matrix.
     */
    for (i = 0; i < 16; i++) {
        current_matrix[i] = matrix->item[i].u.real;
    }
    /*
     * create new viewing transformation matrix.
     */
    lookat_rotate2(ex, ey, ez, lx, ly, lz, lookat_matrix);
    /*
     * convert float matrix to vec matrix.
     */
    for (i = 0; i < 16; i++) {
        matrix->item[i].u.real = lookat_matrix[i];
    }
}
コード例 #22
0
ファイル: cfuns.c プロジェクト: xcw0579/mudOS
void c_expand_varargs(int  where) {
    svalue_t *s, *t;
    array_t *arr;
    int n;
    
    s = sp - where;
    
    if (s->type != T_ARRAY)
	error("Item being expanded with ... is not an array\n");
		
    arr = s->u.arr;
    n = arr->size;
    num_varargs += n - 1;
    if (!n) {
	t = s;
	while (t < sp) {
	    *t = *(t + 1);
	    t++;
	}
	sp--;
    } else if (n == 1) {
	assign_svalue_no_free(s, &arr->item[0]);
    } else {
	t = sp;
	CHECK_STACK_OVERFLOW(n - 1);
	sp += n - 1;
	while (t > s) {
	    *(t + n - 1) = *t;
	    t--;
	}
	t = s + n - 1;
	if (arr->ref == 1) {
	    memcpy(s, arr->item, n * sizeof(svalue_t));
	    free_empty_array(arr);
	    return;
	} else {
	    while (n--)
		assign_svalue_no_free(t--, &arr->item[n]);
	}
    }
    free_array(arr);
}
コード例 #23
0
static void
free_var_chain(named_nasl_var* v)
{

  if (v == NULL)
    return;
  free_var_chain(v->next_var);
  efree(&v->var_name);
  switch(v->u.var_type)
    {
    case VAR2_STRING:
    case VAR2_DATA:
      efree(&v->u.v.v_str.s_val);
      break;
    case VAR2_ARRAY:
      free_array(&v->u.v.v_arr);
      break;
    }
  efree(&v);
}
コード例 #24
0
ファイル: tr_debug.c プロジェクト: janetuk/trust_router
void tr_audit_req(TID_REQ *req) {

  if (NULL != req) {

    char *attrs[] = { audit_fmt("comm", NULL != req->comm ? req->comm->buf : NULL),
                      audit_fmt("rp_realm", NULL != req->rp_realm ? req->rp_realm->buf : NULL),
                      audit_fmt("realm", NULL != req->realm ? req->realm->buf : NULL),
                    };

    char *msg = join_audit_msg(sizeof(attrs) / sizeof(attrs[0]), attrs);
    free_array(sizeof(attrs) / sizeof(attrs[0]), attrs);

    fire_log(LOG_INFO, AUDIT_FACILITY, "%s%s%s", LOG_PREFIX, msg, LOG_MSG_TERMINATOR);

    free(msg);
  }
  else {

        tr_debug("tr_audit_req: Message dropped, null pointer passed.");
  }
}
コード例 #25
0
ファイル: test_1.c プロジェクト: 8l/rose
int main() {

  const int n = 8;
  const int m = 8;

  float ** a;

  {
    a = create_array(n, m);

    print_array(0, 8, 0, 8, a);

    kernel_0(n, m, a, 3.5);

    print_array(0, 8, 0, 8, a);

    free_array(a);
  }

  return 0;
}
コード例 #26
0
ファイル: daemond.c プロジェクト: submorino/daemon
int fresh_node_data(tree_node_t* node)
{
    int size = 0;
    char **content = NULL;
    char *pos = NULL;
    char *end = NULL;
    int j = 0;
    if (!assert_tree_node(node))
        return 1;

    node->data->pid = PID_UNDEFINED;
    if (0 != parse_ps(&content, &size, node->data->ps_conf->comm))
        return 1;

    for (j=0; j<size; j++)
    {
      if (isspace(*content[j]))
      	  pos = strchr(content[j]+1, ' ');
      else
          pos = strchr(content[j], ' ');
      
      if (pos!=NULL && node->data->ps_conf->args!=NULL)
      {
          char *p = node->data->ps_conf->args + strlen(node->data->ps_conf->args) - 1;
          while(p>node->data->ps_conf->args && (*p=='&' || isspace(*p)))
          {
              p--;
          }
          if (strncmp(pos+1, node->data->ps_conf->args, p+1-node->data->ps_conf->args)==0) 
          {
              char *pid = strndup(content[j], pos-content[j]);
              node->data->pid = atoi(pid);
              free(pid);
          }
      }
    }
    free_array(content, size);
    free(content);
    return 0;
}
コード例 #27
0
ファイル: dictionary.c プロジェクト: hww3/pexts
static void
dict_foreach(DICT *dict, dict_cb_fn cb)
{
    struct array      *arr;
    int               i;

    INFUN();
    
    if (!dict || !cb)
        return;

    if (!dict->dict->data->num_keypairs)
        return;

    arr = mapping_to_array(dict->dict);
    for (i = 0; i < arr->size; i++)
        cb(arr->item[i].u.object);

    free_array(arr);

    OUTFUN();
}
コード例 #28
0
ファイル: seq.c プロジェクト: CPFL/gmeme
/***************************************************************************
 * Set the sequence weights according to an external file.
 *
 * If the filename is "none," "internal," or NULL, then the weights are
 * set uniformly.
 ***************************************************************************/
void set_sequence_weights
  (char*    weight_filename, // Name of file containing sequence weights.
   int      num_seqs,        // Number of sequences.
   SEQ_T**  sequences)       // The sequences.
{
  ARRAY_T* weights;
  FILE *   weight_file;
  int      i_seq;

  /* Allocate the weights. */
  weights = allocate_array(num_seqs);

  /* Set uniform weights if no file was supplied. */
  if ((weight_filename == NULL) || (strcmp(weight_filename, "none") == 0) ||
      (strcmp(weight_filename, "internal") == 0)) {
    init_array(1.0, weights);
  }

  /* Read the weights from a file. */
  else {
    if (open_file(weight_filename, "r", FALSE, "weight", "weights",
		  &weight_file) == 0)
      exit(1);
    read_array(weight_file, weights);
    fclose(weight_file);

    /* Normalize the weights so they add to the total number of sequences. */
    normalize(0.0, weights);
    scalar_mult(num_seqs, weights);
  }

  /* Assign the weights to the sequences. */
  for (i_seq = 0; i_seq < num_seqs; i_seq++) {
    (sequences[i_seq])->weight = get_array_item(i_seq, weights);
  }

  /* Free the weights. */
  free_array(weights);
}
コード例 #29
0
ファイル: SSCplex.cpp プロジェクト: aleeee/floodlight
SSCplex::~SSCplex(){
  /* Free up the class data member arrays */

  delete[] dest_dist;
  delete[] source_dist;

  for( int i = 0; i < num_vf; i++ )
   delete proc_time[i];
  delete[] proc_time;

  for( int i = 0; i < num_vf; i++ )
   delete incom[i];
  delete[] incom;

  delete[] cap;
  
  for( int i = 0; i < num_vm; i++ )
    delete tempi_lat[i];
  delete[] tempi_lat;

 free_array(Y);
}
コード例 #30
0
/*****************************************************************************
 * Destroy the parser along with any motifs which weren't retrieved.
 ****************************************************************************/
static void destroy_parser_data(CTX_T *data) {
  if (data->fscope.scanned_sites) {
    if (!(data->fscope.options_returned & SCANNED_SITES)) {
      arraylst_destroy(sseq_destroy, data->fscope.scanned_sites);
    }
  }
  if (data->fscope.background) {
    free_array(data->fscope.background);
  }
  if (data->fscope.release) {
    free(data->fscope.release);
  }
  if (data->sequence_lookup) rbtree_destroy(data->sequence_lookup);
  linklst_destroy_all(data->warnings, free);
  linklst_destroy_all(data->errors, free);
  linklst_destroy_all(data->motif_queue, destroy_motif);
  rbtree_destroy(data->letter_lookup);
  if (data->alph) alph_release(data->alph);
  if (data->alph_rdr) alph_reader_destroy(data->alph_rdr);
  memset(data, 0, sizeof(CTX_T));
  free(data);
}