This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: putc_unlocked stdio error when compiling class with mingw32-make


 I am trying to compile a huge collection of old code libraries
originally written for linux/unix (it manipulates genomic data) for
windows using cygwin/mingw32-make and have been successful up to ?the
last stage where I am getting the following error in class chromAnn.
>> chromAnn.c: In function `strVectorWrite':
>> chromAnn.c:119: warning: implicit declaration of function `putc_unlocked'
>> mingw32-make: *** [chromAnn.o] Error 1
I have searched and seen some information about missing definitions
etc. but am not sure how to correct this problem - or is there a more
recent code substitution for putc_unlocked and its compadres so the
stdio.h library definitions become irrelevant.
Any help on how to resolve the issue would be appreciated. The start
of the class follows. Compilation is on 64bit vista. A great number of
classes have compile no probs at all.
Cheers

Dennis Gascoigne

dennis.gascoigne@gmail.com

> /* chromAnn - chomosome annotations, generic object to store annotations from
> ?* other formats */
> #include "common.h"
> #include "chromAnn.h"
> #include "binRange.h"
> #include "rowReader.h"
> #include "psl.h"
> #include "bed.h"
> #include "chain.h"
> #include "genePred.h"
> #include "coordCols.h"
> #include "verbose.h"
> #include "stdio.h"
> static struct chromAnnBlk* chromAnnBlkNew(struct chromAnn *ca, int start, int end)
> /* create new block object and add to chromAnn object */
> {
> struct chromAnnBlk* caBlk;
> AllocVar(caBlk);
> if (end < start)
> ?? ?errAbort("invalid block coordinates for %s: start=%d end=%d", ca->name, start, end);
> caBlk->ca = ca;;
> caBlk->start = start;
> caBlk->end = end;
> if (ca->blocks == NULL)
> ?? ?{
> ?? ?ca->start = start;
> ?? ?ca->end = end;
> ?? ?}
> else
> ?? ?{
> ?? ?ca->start = min(ca->start, start);
> ?? ?ca->end = max(ca->end, end);
> ?? ?}
> ca->totalSize += (end - start);
> slAddHead(&ca->blocks, caBlk);
> return caBlk;
> }
> static void chromAnnBlkFreeList(struct chromAnnBlk *blks)
> /* free list of objects */
> {
> struct chromAnnBlk *blk;
> while ((blk = slPopHead(&blks)) != NULL)
> ?? ?freeMem(blk);
> }
> static struct chromAnn* chromAnnNew(char* chrom, char strand, char* name, void *rec,
> ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?void (*recWrite)(struct chromAnn*, FILE *, char),
> ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?void (*recFree)(struct chromAnn *))
> /* create new object, ownership of rawCols is passed */
> {
> struct chromAnn* ca;
> AllocVar(ca);
> ca->chrom = cloneString(chrom);
> ca->strand = strand;
> if (name != NULL)
> ?? ?ca->name = cloneString(name);
> ca->start = 0;
> ca->end = 0;
> ca->rec = rec;
> ca->recWrite = recWrite;
> ca->recFree = recFree;
> return ca;
> }
> static int chromAnnBlkCmp(const void *va, const void *vb)
> /* sort compare of two chromAnnBlk objects */
> {
> const struct chromAnnBlk *a = *((struct chromAnnBlk **)va);
> const struct chromAnnBlk *b = *((struct chromAnnBlk **)vb);
> int diff = a->start - b->start;
> if (diff == 0)
> ?? ?diff = a->end - b->end;
> return diff;
> }
> static void chromAnnFinish(struct chromAnn* ca)
> /* finish creation of a chromAnn after all blocks are added */
> {
> slSort(&ca->blocks, chromAnnBlkCmp);
> }
> void chromAnnFree(struct chromAnn **caPtr)
> /* free an object */
> {
> struct chromAnn *ca = *caPtr;
> if (ca != NULL)
> ?? ?{
> ?? ?ca->recFree(ca);
> ?? ?freeMem(ca->chrom);
> ?? ?freeMem(ca->name);
> ?? ?chromAnnBlkFreeList(ca->blocks);
> ?? ?freez(caPtr);
> ?? ?}
> }
> int chromAnnTotalBlockSize(struct chromAnn* ca)
> /* count the total bases in the blocks of a chromAnn */
> {
> int bases = 0;
> struct chromAnnBlk *cab;
> for (cab = ca->blocks; cab != NULL; cab = cab->next)
> ?? ?bases += (cab->end - cab->start);
> return bases;
> }
> static void strVectorWrite(struct chromAnn *ca, FILE *fh, char term)
> /* write a chromAnn that is represented as a vector of strings */
> {
> char **cols = ca->rec;
> assert(cols != NULL);
> int i;
> for (i = 0; cols[i] != NULL; i++)
> ?? ?{
> ?? ?if (i > 0)
> ?? ? ? ?putc_unlocked('\t', fh);
> ?? ?fputs(cols[i], fh);
> ?? ?}
> putc_unlocked(term, fh);
> }


--
Dennis Gascoigne
0407 639 995
dennis.gascoigne@gmail.com

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]