/* Function: GenoVarSet_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [GenoVarSet *] * */ GenoVarSet * GenoVarSet_alloc_len(int len) { GenoVarSet * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = GenoVarSet_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->chr = (GenoVarChr ** ) ckcalloc (len,sizeof(GenoVarChr *))) == NULL) { warn("Warning, ckcalloc failed in GenoVarSet_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; if((out->ind = (Individual ** ) ckcalloc (len,sizeof(Individual *))) == NULL) { warn("Warning, ckcalloc failed in GenoVarSet_alloc_len"); return NULL; } out->ind_len = 0; out->ind_maxlen = len; return out; }
/* Function: Transcript_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [Transcript *] * */ Transcript * Transcript_alloc_len(int len) { Transcript * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = Transcript_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->exon = (Exon ** ) ckcalloc (len,sizeof(Exon *))) == NULL) { warn("Warning, ckcalloc failed in Transcript_alloc_len"); return NULL; } out->ex_len = 0; out->ex_maxlen = len; if((out->translation = (Translation ** ) ckcalloc (len,sizeof(Translation *))) == NULL) { warn("Warning, ckcalloc failed in Transcript_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: EstEvidence_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [EstEvidence *] * */ EstEvidence * EstEvidence_alloc_len(int len) { EstEvidence * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = EstEvidence_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->exon = (EstExon ** ) ckcalloc (len,sizeof(EstExon *))) == NULL) { warn("Warning, ckcalloc failed in EstEvidence_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; if((out->indel = (EstIndel ** ) ckcalloc (len,sizeof(EstIndel *))) == NULL) { warn("Warning, ckcalloc failed in EstEvidence_alloc_len"); return NULL; } out->indel_len = 0; out->indel_maxlen = len; return out; }
/* Function: DebugMatrix_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [DebugMatrix *] * */ DebugMatrix * DebugMatrix_alloc_len(int len) { DebugMatrix * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = DebugMatrix_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->state = (DebugState ** ) ckcalloc (len,sizeof(DebugState *))) == NULL) { warn("Warning, ckcalloc failed in DebugMatrix_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; if((out->point = (DebugBreakPoint ** ) ckcalloc (len,sizeof(DebugBreakPoint *))) == NULL) { warn("Warning, ckcalloc failed in DebugMatrix_alloc_len"); return NULL; } out->bp_len = 0; out->bp_maxlen = len; return out; }
/* Function: FuncInfo_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [FuncInfo *] * */ FuncInfo * FuncInfo_alloc_len(int len) { FuncInfo * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = FuncInfo_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->arg = (ArgInfo ** ) ckcalloc (len,sizeof(ArgInfo *))) == NULL) { warn("Warning, ckcalloc failed in FuncInfo_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; if((out->err = (ErrorInfo ** ) ckcalloc (len,sizeof(ErrorInfo *))) == NULL) { warn("Warning, ckcalloc failed in FuncInfo_alloc_len"); return NULL; } out->err_len = 0; out->err_maxlen = len; return out; }
/* Allocate storage to hold pointers to all rules, alternatives, members, meta rules and meta alternatives. */ static void allocate_rule_storage () { all_rules = (rule *) ckcalloc (nr_of_rules, sizeof (rule)); all_alts = (alt *) ckcalloc (nr_of_alts, sizeof (alt)); all_members = (member *) ckcalloc (nr_of_members, sizeof (member)); all_meta_rules = (meta_rule *) ckcalloc (nr_of_meta_rules, sizeof (meta_rule)); all_meta_alts = (meta_alt *) ckcalloc (nr_of_meta_alts, sizeof (meta_alt)); };
static void allocate_space_for_relations () { int i,j; member_leftcorner = (char *) ckcalloc (nr_of_members * nr_of_rules, sizeof (char)); member_leftcorner_closure = (char *) ckcalloc (nr_of_members * nr_of_rules, sizeof (char)); for (i=0; i < nr_of_members; i++) for (j=0; j < nr_of_rules; j++) { member_leftcorner [i*nr_of_rules + j] = 0; member_leftcorner_closure [i*nr_of_rules + j] = 0; }; };
/* Collect output vector */ static void check_for_space () { if (nrofparses < allocated) return; if (allocated == room) { int i; value **ocvals = my_cvals; my_cvals = (value **) ckcalloc (room * 2, sizeof (value *)); for (i=0; i < room - 1; i++) my_cvals[i] = ocvals[i]; room *= 2; ckfree (ocvals); }; my_cvals[allocated] = (value *) ckcalloc (my_nrps, sizeof (value)); allocated++; };
/* Function: MotifConsMatrix_alloc_matrix(leni,lenj) * * Descrip: Allocates structure and matrix * * * Arg: leni [UNKN ] Length of first dimension of matrix [int] * Arg: lenj [UNKN ] Length of second dimension of matrix [int] * * Return [UNKN ] Undocumented return value [MotifConsMatrix *] * */ MotifConsMatrix * MotifConsMatrix_alloc_matrix(int leni,int lenj) { MotifConsMatrix * out; /* out is exported */ register int i; /* for stepping down matrix */ register int j; /* for stepping across matrix */ /* Call alloc function, return NULL if NULL */ if((out = MotifConsMatrix_alloc()) == NULL) return NULL; /* Allocate memory for mat */ if((out->mat = (char **) ckcalloc (leni,sizeof(char *))) == NULL) { warn("Memory allocation problem in matrix for MotifConsMatrix mat, first pointer set"); ckfree(out); return NULL; } /* Add NULL to all matrix pointers so free can be called */ for(i=0;i<leni;i++) out->mat[i] = NULL; /* Allocate each matrix row */ for(i=0;i<leni;i++) { out->mat[i] = (char *) ckcalloc (lenj,sizeof(char )); if( out->mat[i] == NULL) { warn("Failed alloc on %d, calling free and returning NULL",i); free_MotifConsMatrix(out); return NULL; } } for(i=0;i<leni;i++) { for(j=0;j<lenj;j++) out->mat[i][j] = NULL; } out->leni=out->maxleni=leni; out->lenj=out->maxlenj=lenj; return out; }
Sequence * translate_Sequence(Sequence * dna,CodonTable * ct) { Sequence * out; int i; int j; int len; char * seq; char * name; char buffer[512]; if( is_dna_Sequence(dna) == FALSE) { warn("Trying to make a translation from a non DNA sequence... type is [%s]",Sequence_type_to_string(dna->type)); return NULL; } len = dna->len/3 + 1; seq = ckcalloc(len,sizeof(char)); sprintf(buffer,"%s.tr",dna->name == NULL ? "NoNameDNASeq" : dna->name); name = stringalloc(buffer); out = Sequence_from_dynamic_memory(name,seq); for(i=0,j=0;i<dna->len-3;i+=3,j++) { out->seq[j] = aminoacid_from_seq(ct,dna->seq+i); } out->seq[j] = '\0'; out->type = SEQUENCE_PROTEIN; out->len = strlen(out->seq); return out; }
Histogram * new_Histogram(int min, int max, int lumpsize) { Histogram *h; int newsize; int i; newsize = max - min + 1; h = Histogram_alloc(); /* ewan changed */ if( h == NULL ) { return NULL; } h->min = min; h->max = max; h->total = 0; h->lowscore = INT_MAX; h->highscore = INT_MIN; h->lumpsize = lumpsize; h->histogram = (int *) ckcalloc (newsize,sizeof(int)); /* ewan changed */ for (i = 0; i < newsize; i++) h->histogram[i] = 0; h->expect = NULL; h->fit_type = HISTFIT_NONE; h->param[EVD_WONKA] = 1.0; /* just in case, make sure this initializes */ return h; }
static void allocate_goal_relation () { int i,j; goal_relation = ckcalloc (goalnr * goalnr, sizeof (char)); for (i = 0; i < goalnr; i++) for (j = 0; j < goalnr; j++) goal_relation [i * goalnr + j] = 0; };
/* Allocate a new value list */ value_list new_value_list (int room) { value_list nvl = (value_list) ckmalloc (sizeof (struct value_list_rec)); int mroom = (room <= 0)?1:room; nvl -> size = 0; nvl -> room = mroom; nvl -> array = (value *) ckcalloc (mroom, sizeof (value)); return (nvl); };
/* Reserve space to collect output affixes */ void reserve_collection_space () { my_nrps = popi (); my_cvals = (value **) ckcalloc (1, sizeof (value *)); room = 1; allocated = 0; callq (); pushi (my_nrps); pushq (reserve_collection_space); };
static void build_reflexive_leftcorner_relation () { int i,j; refl_leftc_relation = (char *) ckcalloc (nr_of_rules * nr_of_rules, sizeof (char)); for (i=0; i < nr_of_rules; i++) for (j=0; j < nr_of_rules; j++) refl_leftc_relation [i * nr_of_rules + j] = leftc_relation [i * nr_of_rules + j]; /* add reflexivety */ for (i=0; i < nr_of_rules; i++) refl_leftc_relation [i * nr_of_rules + i] = 1; };
/* Function: MethodTypeSet_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [MethodTypeSet *] * */ MethodTypeSet * MethodTypeSet_alloc_len(int len) { MethodTypeSet * out;/* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = MethodTypeSet_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->me = (Method ** ) ckcalloc (len,sizeof(Method *))) == NULL) { warn("Warning, ckcalloc failed in MethodTypeSet_alloc_len"); return NULL; } out->me_len = 0; out->me_maxlen = len; if((out->ty = (Type ** ) ckcalloc (len,sizeof(Type *))) == NULL) { warn("Warning, ckcalloc failed in MethodTypeSet_alloc_len"); return NULL; } out->ty_len = 0; out->ty_maxlen = len; if((out->in = (Input ** ) ckcalloc (len,sizeof(Input *))) == NULL) { warn("Warning, ckcalloc failed in MethodTypeSet_alloc_len"); return NULL; } out->in_len = 0; out->in_maxlen = len; return out; }
Ascii_btc_Data * new_Ascii_btc_Data(FILE * ofp,int left,int main,int right,int height) { Ascii_btc_Data * out; int tot; int i; tot = left + main + right +2; out = Ascii_btc_Data_alloc(); out->ofp = ofp; out->res_left = left; out->main = main; out->res_right = right; out->current_x= left; out->paint_x = left; out->scratch = (char **) ckcalloc(height,sizeof(char *)); for(i=0;i<height;i++) { out->scratch[i] = (char *) ckcalloc(tot,sizeof(char)); memset(out->scratch[i],' ',tot-2); out->scratch[i][tot-1] = '\0'; out->scratch[i][tot-2] = '\n'; } out->depth_scratch = height; out->in_use = FALSE; out->bpa = btPasteArea_alloc(); out->bpa->height = height; out->bpa->canvas_data = (void *) out; out->bpa->decons = free_Ascii_btpa; out->bpa->paste_char = paste_char_bt_Ascii; return out; }
BaseMatrix * BaseMatrix_alloc_matrix_and_specials(int len_point,int len_array,int len_spec_point,int len_spec_array) { register int i; BaseMatrix * out; /* use dy matrix for main stuff */ if( (out = BaseMatrix_alloc_matrix(len_point,len_array)) == NULL ) { warn("Unable to allocate %d by %d [%d] int positions in basematrix main matrix",len_point,len_array,len_point*len_array); return NULL; } out->spec_len = 0; if( (out->specmatrix = (int **) ckcalloc(len_spec_point,sizeof(int *))) == NULL ) { warn("Unable to allocate %d special matrix pointers in basematrix",len_spec_point); free_BaseMatrix(out); return NULL; } for(i=0;i<len_spec_point;i++) { if( (out->specmatrix[i] = (int *) ckcalloc(len_spec_array,sizeof(int))) == NULL ) { warn("Unable to allocate the %d'th special array in basematrix for [length: %d]",i,len_spec_array); /*** sneaky. Put spec_len = i so that deconstructor will clear-up memory ***/ out->spec_len = i; free_BaseMatrix(out); return NULL; } } out->spec_len = len_spec_point; return out; }
void invert_PackAln(PackAln * pal) { PackAlnUnit ** temp; register int i; /*** there are better ways to do this! ***/ temp = (PackAlnUnit **) ckcalloc(pal->len,sizeof(PackAlnUnit *)); for(i=0;i<pal->len;i++) temp[i] = pal->pau[pal->len-1-i]; for(i=0;i<pal->len;i++) pal->pau[i] = temp[i]; ckfree(temp); }
/* Function: DnaHmmScore_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [DnaHmmScore *] * */ DnaHmmScore * DnaHmmScore_alloc_len(int len) { DnaHmmScore * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = DnaHmmScore_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->unit = (DnaHmmScoreUnit ** ) ckcalloc (len,sizeof(DnaHmmScoreUnit *))) == NULL) { warn("Warning, ckcalloc failed in DnaHmmScore_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: GeneConsensus_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [GeneConsensus *] * */ GeneConsensus * GeneConsensus_alloc_len(int len) { GeneConsensus * out;/* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = GeneConsensus_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->gsc = (GeneSingleCons ** ) ckcalloc (len,sizeof(GeneSingleCons *))) == NULL) { warn("Warning, ckcalloc failed in GeneConsensus_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: GenomeEvidenceSet_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [GenomeEvidenceSet *] * */ GenomeEvidenceSet * GenomeEvidenceSet_alloc_len(int len) { GenomeEvidenceSet * out;/* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = GenomeEvidenceSet_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->geu = (GenomeEvidenceUnit ** ) ckcalloc (len,sizeof(GenomeEvidenceUnit *))) == NULL) { warn("Warning, ckcalloc failed in GenomeEvidenceSet_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: SimpleBufferedServer_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [SimpleBufferedServer *] * */ SimpleBufferedServer * SimpleBufferedServer_alloc_len(int len) { SimpleBufferedServer * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = SimpleBufferedServer_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->buffer = (BufferedString ** ) ckcalloc (len,sizeof(BufferedString *))) == NULL) { warn("Warning, ckcalloc failed in SimpleBufferedServer_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: ModuleFunctionList_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [ModuleFunctionList *] * */ ModuleFunctionList * ModuleFunctionList_alloc_len(int len) { ModuleFunctionList * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = ModuleFunctionList_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->mf = (ModuleFunction ** ) ckcalloc (len,sizeof(ModuleFunction *))) == NULL) { warn("Warning, ckcalloc failed in ModuleFunctionList_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: ShatterMatrix_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [ShatterMatrix *] * */ ShatterMatrix * ShatterMatrix_alloc_len(int len) { ShatterMatrix * out;/* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = ShatterMatrix_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->smc = (ShatterMatrixComponent ** ) ckcalloc (len,sizeof(ShatterMatrixComponent *))) == NULL) { warn("Warning, ckcalloc failed in ShatterMatrix_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: TransferedFunctionCall_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [TransferedFunctionCall *] * */ TransferedFunctionCall * TransferedFunctionCall_alloc_len(int len) { TransferedFunctionCall * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = TransferedFunctionCall_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->input = (TransferedObjectMarshaller ** ) ckcalloc (len,sizeof(TransferedObjectMarshaller *))) == NULL) { warn("Warning, ckcalloc failed in TransferedFunctionCall_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: PfamHmmer1DB_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [PfamHmmer1DB *] * */ PfamHmmer1DB * PfamHmmer1DB_alloc_len(int len) { PfamHmmer1DB * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = PfamHmmer1DB_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->en = (PfamHmmer1Entry ** ) ckcalloc (len,sizeof(PfamHmmer1Entry *))) == NULL) { warn("Warning, ckcalloc failed in PfamHmmer1DB_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: DnaProfileMatchPairSet_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [DnaProfileMatchPairSet *] * */ DnaProfileMatchPairSet * DnaProfileMatchPairSet_alloc_len(int len) { DnaProfileMatchPairSet * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = DnaProfileMatchPairSet_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->pair = (DnaProfileMatchPair ** ) ckcalloc (len,sizeof(DnaProfileMatchPair *))) == NULL) { warn("Warning, ckcalloc failed in DnaProfileMatchPairSet_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: SequenceErrorSet_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [SequenceErrorSet *] * */ SequenceErrorSet * SequenceErrorSet_alloc_len(int len) { SequenceErrorSet * out; /* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = SequenceErrorSet_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->error = (SequenceError ** ) ckcalloc (len,sizeof(SequenceError *))) == NULL) { warn("Warning, ckcalloc failed in SequenceErrorSet_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }
/* Function: SingleNumberSpace_alloc_len(len) * * Descrip: Allocates len length to all lists * * * Arg: len [UNKN ] Length of lists to allocate [int] * * Return [UNKN ] Undocumented return value [SingleNumberSpace *] * */ SingleNumberSpace * SingleNumberSpace_alloc_len(int len) { SingleNumberSpace * out;/* out is exported at the end of function */ /* Call alloc function: return NULL if NULL */ /* Warning message alread in alloc function */ if((out = SingleNumberSpace_alloc()) == NULL) return NULL; /* Calling ckcalloc for list elements */ if((out->sns = (SingleNumberSequence ** ) ckcalloc (len,sizeof(SingleNumberSequence *))) == NULL) { warn("Warning, ckcalloc failed in SingleNumberSpace_alloc_len"); return NULL; } out->len = 0; out->maxlen = len; return out; }