Skip to content

Commit

Permalink
Portability to OS-X and *BSD.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianwalenz committed Jul 13, 2005
1 parent 542745d commit a890c1a
Show file tree
Hide file tree
Showing 11 changed files with 220 additions and 182 deletions.
14 changes: 12 additions & 2 deletions inc/cds.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#ifndef CDSH
#define CDSH

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>

#include <limits.h>
#include <float.h>
#include <inttypes.h>
Expand Down Expand Up @@ -108,8 +112,14 @@ typedef double float64;
32-bit architecture
***********************************************************************/

#define CDS_INT64_MAX INT64_MAX
#define CDS_UINT64_MAX UINT64_MAX
/* Newer gcc's know INT64_MAX, older ones don't. */
#ifdef UINT64_MAX
#define CDS_INT64_MAX INT64_MAX
#define CDS_UINT64_MAX UINT64_MAX
#else
#define CDS_INT64_MAX LLONG_MAX
#define CDS_UINT64_MAX ULLONG_MAX
#endif

#define F_S16 "%d"
#define F_U16 "%u"
Expand Down
3 changes: 1 addition & 2 deletions src/AS_CGB/check_breakers.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <string.h>
#include <memory.h>
#include <unistd.h>
#include <getopt.h>

#include "AS_global.h"
#include "AS_PER_ReadStruct.h"
Expand Down Expand Up @@ -1386,7 +1385,7 @@ typedef CheckGlobals * CheckGlobalsp;
void InitializeGlobals( CheckGlobalsp globals, char * program_name )
{
globals->program_name = program_name;
globals->version = "$Revision: 1.4 $";
globals->version = "$Revision: 1.5 $";
globals->chims_file = NULL;
globals->craps_file = NULL;
globals->cgb_file = NULL;
Expand Down
4 changes: 1 addition & 3 deletions src/AS_MPA/Quadrilateral.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*************************************************************************/
/* $Id: Quadrilateral.h,v 1.4 2005-03-22 19:48:56 jason_miller Exp $ */
/* $Id: Quadrilateral.h,v 1.5 2005-07-13 14:47:55 brianwalenz Exp $ */
#ifndef QUADRILATERAL_H
#define QUADRILATERAL_H

#include <cmath>
#include <values.h>

#include <algorithm>

#include "Point.h"
Expand Down
4 changes: 1 addition & 3 deletions src/AS_MPA/Trapezoid.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*************************************************************************/
/* $Id: Trapezoid.h,v 1.4 2005-03-22 19:48:56 jason_miller Exp $ */
/* $Id: Trapezoid.h,v 1.5 2005-07-13 14:47:55 brianwalenz Exp $ */
#ifndef TILTEDTRAPEZOID_H
#define TILTEDTRAPEZOID_H

#include <cmath>
#include <values.h>

#include <algorithm>

#include "Point.h"
Expand Down
6 changes: 3 additions & 3 deletions src/AS_OVL/AS_OVL_overlap_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
*************************************************/

/* RCS info
* $Id: AS_OVL_overlap_common.h,v 1.6 2005-07-11 21:55:48 brianwalenz Exp $
* $Revision: 1.6 $
* $Id: AS_OVL_overlap_common.h,v 1.7 2005-07-13 14:47:55 brianwalenz Exp $
* $Revision: 1.7 $
*/


Expand All @@ -68,7 +68,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <float.h>
#include "getopt.h"
#include "getopt.h" /* Use AS_UTL getopt, not the system one */

/*************************************************************************/
/* Local include files */
Expand Down
49 changes: 35 additions & 14 deletions src/AS_OVL/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,45 @@ include $(LOCAL_WORK)/src/c_make.as

# (MP) this should take care of intermittent "don't know how to make
# libpthread.a" problems
LDFLAGS+= -lpthread
CFLAGS+= -pthread
CPPFLAGS+= -pthread
#PTHREADS_LIBS=-lpthread

ifeq ($(OSTYPE), Linux)
LDFLAGS += -lpthread
CFLAGS += -pthread
CPPFLAGS += -pthread
endif

ifeq ($(OSTYPE), OSF1)
LDFLAGS += -lpthread
CFLAGS += -pthread
CPPFLAGS += -pthread
endif

ifeq ($(OSTYPE), FreeBSD)
LDFLAGS += -pthread
CFLAGS += -pthread
CPPFLAGS += -pthread
endif

ifeq ($(OSTYPE), Darwin)
LDFLAGS += -pthread
CFLAGS += -pthread
CPPFLAGS += -pthread
endif


#ifeq ($(OSTYPE), aix)
# PTHREADS_LIBS=libc_r.so /usr/lib/libpthread.so
# PTHREADS_LIBS=libc_r.a /usr/lib/libpthread.a
#else
# ifeq ($(OSTYPE), Darwin)
# PTHREADS_LIBS=libc_r.so /usr/lib/libpthread.dylib
# PTHREADS_LIBS=libc_r.a /usr/lib/libpthread.dylib
# else
# ifeq ($(OSTYPE), OSF1)
# PTHREADS_LIBS=-lpthread
#PTHREADS_LIBS=/usr/lib/libpthread.so
# endif
# endif
#endif

#ifeq ($(OSTYPE), Darwin)
# PTHREADS_LIBS=libc_r.so /usr/lib/libpthread.dylib
# PTHREADS_LIBS=libc_r.a /usr/lib/libpthread.dylib
#endif

#ifeq ($(OSTYPE), OSF1)
# PTHREADS_LIBS=-lpthread
# PTHREADS_LIBS=/usr/lib/libpthread.so
#endif

all: $(OBJECTS) $(LIBRARIES) $(PROGS) install
Expand Down
12 changes: 8 additions & 4 deletions src/AS_UID/SYS_UIDcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@

/**********************************************************************
$Source: /work/NIGHTLY/wgs-assembler-cvs/src/AS_UID/Attic/SYS_UIDcommon.h,v $
$Revision: 1.3 $
$Date: 2005-03-22 19:49:28 $
$Revision: 1.4 $
$Date: 2005-07-13 14:47:55 $
$Name: not supported by cvs2svn $
$Author: jason_miller $
$Author: brianwalenz $
$Log: not supported by cvs2svn $
Revision 1.3 2005/03/22 19:49:28 jason_miller
The TIGR tip as of March 22 2005. Commit by Jason Miller at TIGR.
Revision 1.4 2004/09/10 12:31:43 mschatz
Add standard copyright notice
Expand Down Expand Up @@ -170,12 +173,13 @@ extern "C" {
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/un.h>
#include <errno.h>
#include <unistd.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <time.h>
#include <sys/time.h>
Expand Down
11 changes: 8 additions & 3 deletions src/AS_UID/SYS_UIDserver_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@

/**********************************************************************
$Source: /work/NIGHTLY/wgs-assembler-cvs/src/AS_UID/Attic/SYS_UIDserver_main.c,v $
$Revision: 1.3 $
$Date: 2005-03-22 19:49:28 $
$Revision: 1.4 $
$Date: 2005-07-13 14:47:56 $
$Name: not supported by cvs2svn $
$Author: jason_miller $
$Author: brianwalenz $
$Log: not supported by cvs2svn $
Revision 1.3 2005/03/22 19:49:28 jason_miller
The TIGR tip as of March 22 2005. Commit by Jason Miller at TIGR.
Revision 1.3 2004/09/10 12:31:43 mschatz
Add standard copyright notice
Expand Down Expand Up @@ -278,9 +281,11 @@ SYS_UIDsignalHandlerFunction(int signal)
case SIGTTOU:
SYS_UIDerrorMsg("UID server: received SIGTTOU signal");
break;
#ifdef SIGPOLL
case SIGPOLL:
SYS_UIDerrorMsg("UID server: received SIGPOLL signal");
break;
#endif
case SIGXCPU:
SYS_UIDerrorMsg("UID server: received SIGXCPU signal");
break;
Expand Down
6 changes: 3 additions & 3 deletions src/AS_UTL/AS_UTL_Hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*************************************************************************/
static char CM_ID[] = "$Id: AS_UTL_Hash.c,v 1.4 2005-03-22 19:49:28 jason_miller Exp $";
static char CM_ID[] = "$Id: AS_UTL_Hash.c,v 1.5 2005-07-13 14:47:56 brianwalenz Exp $";

#include <string.h>
#include <math.h>
Expand Down Expand Up @@ -435,7 +435,7 @@ int NextHashTable_Iterator_AS(HashTable_Iterator_AS *iterator,
table->freeList = NULL;
assert(numItemsToHash > 0);
{
int logsize = (int) ceil(log2(numItemsToHash * 2.0));
int logsize = (int) ceil_log2(numItemsToHash * 2.0);
int i;
table->numBuckets = hashsize(logsize);
table->hashmask = hashmask(logsize);
Expand All @@ -450,7 +450,7 @@ int NextHashTable_Iterator_AS(HashTable_Iterator_AS *iterator,
}
}
{
int logsize = (int) ceil(log2(numItemsToHash));
int logsize = (int) ceil_log2(numItemsToHash);
table->numNodesAllocated = hashsize(logsize);

table->allocated = AllocateUIDHashNode_ASHeap(table->numNodesAllocated);
Expand Down
12 changes: 6 additions & 6 deletions src/AS_UTL/AS_UTL_Var.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*************************************************************************/
static char CM_ID[] = "$Id: AS_UTL_Var.c,v 1.7 2005-06-14 14:44:52 eliv Exp $";
static char CM_ID[] = "$Id: AS_UTL_Var.c,v 1.8 2005-07-13 14:47:56 brianwalenz Exp $";
/********************************************************************/
/* Variable Length C Array Package
*
Expand All @@ -30,8 +30,8 @@ static char CM_ID[] = "$Id: AS_UTL_Var.c,v 1.7 2005-06-14 14:44:52 eliv Exp $";
* It defines a basic set of operations, and provides a set of
* macros that expand to support typesafe manipulation of the
* arrays.
* Revision: $Revision: 1.7 $
* Date: $Date: 2005-06-14 14:44:52 $
* Revision: $Revision: 1.8 $
* Date: $Date: 2005-07-13 14:47:56 $
* CMM, 1999/03/29: Ported to large arrays on the Digital systems by declaring
* array sizes using size_t, rather than unit32.
*
Expand Down Expand Up @@ -129,9 +129,9 @@ int MakeRoom_VA
// Only allocate a power of 2 number of bytes.
tentativeNewSize = (((size_t)1) << ceil_log2(newSize));

int halfGig = 2 << 28; // Cap malloc size at 512MB to decrease failure rate
if ( tentativeNewSize - newSize > halfGig )
tentativeNewSize = oldSize + halfGig;
// Cap malloc size at 512MB to decrease failure rate
if ( tentativeNewSize - newSize > (2 << 28) )
tentativeNewSize = oldSize + (2 << 28);

// If we need to use the end of the block, do it
newSize = max(newSize, tentativeNewSize);
Expand Down
Loading

0 comments on commit a890c1a

Please sign in to comment.