delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/03/10:50:35

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_64,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <87b69fc80908030747g6db167car54aba1e3d76feb0e@mail.gmail.com>
References: <87b69fc80908030747g6db167car54aba1e3d76feb0e AT mail DOT gmail DOT com>
Date: Tue, 4 Aug 2009 00:50:20 +1000
Message-ID: <87b69fc80908030750wd0ffedfh920e504356ee6c1c@mail.gmail.com>
Subject: Re: putc_unlocked stdio error when compiling class with mingw32-make
From: Dennis Gascoigne <dennis DOT gascoigne AT gmail DOT com>
To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

 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 =A0the
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 DOT gascoigne AT gmail DOT com

> /* chromAnn - chomosome annotations, generic object to store annotations =
from
> =A0* 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)
> =A0=A0 =A0errAbort("invalid block coordinates for %s: start=3D%d end=3D%d=
", ca->name, start, end);
> caBlk->ca =3D ca;;
> caBlk->start =3D start;
> caBlk->end =3D end;
> if (ca->blocks =3D=3D NULL)
> =A0=A0 =A0{
> =A0=A0 =A0ca->start =3D start;
> =A0=A0 =A0ca->end =3D end;
> =A0=A0 =A0}
> else
> =A0=A0 =A0{
> =A0=A0 =A0ca->start =3D min(ca->start, start);
> =A0=A0 =A0ca->end =3D max(ca->end, end);
> =A0=A0 =A0}
> ca->totalSize +=3D (end - start);
> slAddHead(&ca->blocks, caBlk);
> return caBlk;
> }
> static void chromAnnBlkFreeList(struct chromAnnBlk *blks)
> /* free list of objects */
> {
> struct chromAnnBlk *blk;
> while ((blk =3D slPopHead(&blks)) !=3D NULL)
> =A0=A0 =A0freeMem(blk);
> }
> static struct chromAnn* chromAnnNew(char* chrom, char strand, char* name,=
 void *rec,
> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0void (*recWrite)(struct chromAnn*, FILE *, char),
> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0void (*recFree)(struct chromAnn *))
> /* create new object, ownership of rawCols is passed */
> {
> struct chromAnn* ca;
> AllocVar(ca);
> ca->chrom =3D cloneString(chrom);
> ca->strand =3D strand;
> if (name !=3D NULL)
> =A0=A0 =A0ca->name =3D cloneString(name);
> ca->start =3D 0;
> ca->end =3D 0;
> ca->rec =3D rec;
> ca->recWrite =3D recWrite;
> ca->recFree =3D recFree;
> return ca;
> }
> static int chromAnnBlkCmp(const void *va, const void *vb)
> /* sort compare of two chromAnnBlk objects */
> {
> const struct chromAnnBlk *a =3D *((struct chromAnnBlk **)va);
> const struct chromAnnBlk *b =3D *((struct chromAnnBlk **)vb);
> int diff =3D a->start - b->start;
> if (diff =3D=3D 0)
> =A0=A0 =A0diff =3D 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 =3D *caPtr;
> if (ca !=3D NULL)
> =A0=A0 =A0{
> =A0=A0 =A0ca->recFree(ca);
> =A0=A0 =A0freeMem(ca->chrom);
> =A0=A0 =A0freeMem(ca->name);
> =A0=A0 =A0chromAnnBlkFreeList(ca->blocks);
> =A0=A0 =A0freez(caPtr);
> =A0=A0 =A0}
> }
> int chromAnnTotalBlockSize(struct chromAnn* ca)
> /* count the total bases in the blocks of a chromAnn */
> {
> int bases =3D 0;
> struct chromAnnBlk *cab;
> for (cab =3D ca->blocks; cab !=3D NULL; cab =3D cab->next)
> =A0=A0 =A0bases +=3D (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 =3D ca->rec;
> assert(cols !=3D NULL);
> int i;
> for (i =3D 0; cols[i] !=3D NULL; i++)
> =A0=A0 =A0{
> =A0=A0 =A0if (i > 0)
> =A0=A0 =A0 =A0 =A0putc_unlocked('\t', fh);
> =A0=A0 =A0fputs(cols[i], fh);
> =A0=A0 =A0}
> putc_unlocked(term, fh);
> }


--
Dennis Gascoigne
0407 639 995
dennis DOT gascoigne AT gmail DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019