From dc1501028f961adf4939576fa59d9b1b7fb50798 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Thu, 16 Jul 2009 22:23:52 +0000 Subject: [PATCH] * samtools-0.1.5-8 (r404) * compatible with PDCurses --- Makefile | 12 +++++------- bam_tview.c | 24 ++++++++++++++++++------ bamtk.c | 6 +++--- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 7bb4469..450b3ab 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,6 @@ CC= gcc -CXX= g++ CFLAGS= -g -Wall -O2 #-m64 #-arch ppc -CXXFLAGS= $(CFLAGS) -DFLAGS= -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE #-D_NO_CURSES +DFLAGS= -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 LOBJS= bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o \ bam_pileup.o bam_lpileup.o bam_md.o glf.o razf.o faidx.o knetfile.o \ bam_sort.o @@ -10,9 +8,10 @@ AOBJS= bam_tview.o bam_maqcns.o bam_plcmd.o sam_view.o \ bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o \ bamtk.o PROG= samtools -INCLUDES= +INCLUDES= SUBDIRS= . misc -LIBPATH= +LIBPATH= +LIBCURSES= -lcurses # -lXCurses .SUFFIXES:.c .o @@ -36,9 +35,8 @@ lib:libbam.a libbam.a:$(LOBJS) $(AR) -cru $@ $(LOBJS) -### For the curses library: comment out `-lcurses' if you do not have curses installed samtools:lib $(AOBJS) - $(CC) $(CFLAGS) -o $@ $(AOBJS) $(LIBPATH) -lm -lcurses -lz -L. -lbam + $(CC) $(CFLAGS) -o $@ $(AOBJS) -lm $(LIBPATH) $(LIBCURSES) -lz -L. -lbam razip:razip.o razf.o $(CC) $(CFLAGS) -o $@ razf.o razip.o -lz diff --git a/bam_tview.c b/bam_tview.c index fd7c098..2442994 100644 --- a/bam_tview.c +++ b/bam_tview.c @@ -1,6 +1,21 @@ -#ifndef _NO_CURSES +#undef _HAVE_CURSES + +#if _CURSES_LIB == 0 +#elif _CURSES_LIB == 1 #include -#ifdef NCURSES_VERSION +#ifndef NCURSES_VERSION +#warning "_CURSES_LIB=1 but NCURSES_VERSION not defined; tview is NOT compiled" +#else +#define _HAVE_CURSES +#endif +#elif _CURSES_LIB == 2 +#include +#define _HAVE_CURSES +#else +#warning "_CURSES_LIB is not 0, 1 or 2; tview is NOT compiled" +#endif + +#ifdef _HAVE_CURSES #include #include #include @@ -348,9 +363,7 @@ void tv_loop(tview_t *tv) case 'k': ++tv->row_shift; break; case KEY_BACKSPACE: case '\177': pos -= tv->mcol; break; -#ifdef KEY_RESIZE case KEY_RESIZE: getmaxyx(stdscr, tv->mrow, tv->mcol); break; -#endif default: continue; } if (pos < 0) pos = 0; @@ -381,5 +394,4 @@ int bam_tview_main(int argc, char *argv[]) fprintf(stderr, "[bam_tview_main] The ncurses library is unavailable; tview is not compiled.\n"); return 1; } -#endif -#endif // #ifndef _NO_CURSES +#endif // #ifdef _HAVE_CURSES diff --git a/bamtk.c b/bamtk.c index f77f69a..970927c 100644 --- a/bamtk.c +++ b/bamtk.c @@ -4,7 +4,7 @@ #include "bam.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.1.5-7 (r403)" +#define PACKAGE_VERSION "0.1.5-8 (r404)" #endif int bam_taf2baf(int argc, char *argv[]); @@ -77,7 +77,7 @@ static int usage() fprintf(stderr, " merge merge multiple sorted alignment files\n"); fprintf(stderr, " pileup generate pileup output\n"); fprintf(stderr, " faidx index/extract FASTA\n"); -#ifndef _NO_CURSES +#if _CURSES_LIB != 0 fprintf(stderr, " tview text alignment viewer\n"); #endif fprintf(stderr, " index index alignment\n"); @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) else if (strcmp(argv[1], "flagstat") == 0) return bam_flagstat(argc-1, argv+1); else if (strcmp(argv[1], "tagview") == 0) return bam_tagview(argc-1, argv+1); else if (strcmp(argv[1], "fillmd") == 0) return bam_fillmd(argc-1, argv+1); -#ifndef _NO_CURSES +#if _CURSES_LIB != 0 else if (strcmp(argv[1], "tview") == 0) return bam_tview_main(argc-1, argv+1); #endif else { -- 2.39.2