AcePerl
view release on metacpan or search on metacpan
acelib/arraysub.c view on Meta::CPAN
/* File: arraysub.c
* Author: Jean Thierry-Mieg (mieg@mrc-lmba.cam.ac.uk)
* Copyright (C) J Thierry-Mieg and R Durbin, 1991
*-------------------------------------------------------------------
* This file is part of the ACEDB genome database package, written by
* Richard Durbin (MRC LMB, UK) rd@mrc-lmba.cam.ac.uk, and
* Jean Thierry-Mieg (CRBM du CNRS, France) mieg@crbm.cnrs-mop.fr
*
* Description:
* Arbitrary length arrays, stacks, associators
* line breaking and all sorts of other goodies
* These functions are declared in array.h
* (part of regular.h - the header for libfree.a)
* Exported functions:
* See Header file: array.h (includes lots of macros)
* HISTORY:
* Last edited: Dec 4 11:12 1998 (fw)
* * Nov 1 16:11 1996 (srk)
* - MEM_DEBUG code clean-up
* (some loose ends crept in from WIN32)
* - int (*order)(void*,void*) prototypes used
* uniformly throughout
* * Jun 5 00:48 1996 (rd)
* * May 2 22:33 1995 (mieg): killed the arrayReport at 20000
otherwise it swamps 50 Mbytes of RAM
* * Jan 21 16:25 1992 (mieg): messcrash in uArrayCreate(size<=0)
* * Dec 17 11:40 1991 (mieg): stackTokeniseTextOn() tokeniser.
* * Dec 12 15:45 1991 (mieg): Stack magic and stackNextText
* Created: Thu Dec 12 15:43:25 1989 (mieg)
*-------------------------------------------------------------------
*/
/* $Id: arraysub.c,v 1.1 2002/11/14 20:00:06 lstein Exp $ */
/* Warning : if you modify Array or Stack structures or
procedures in this file or array.h, you may need to modify
accordingly the persistent array package asubs.c.
*/
#include "regular.h"
/*#include <limits.h>*/
extern BOOL finalCleanup ; /* in messubs.c */
/******** tells how much system stack used *********/
char *stackorigin ;
unsigned int stackused (void)
{ char x ;
if (!stackorigin) /* ideally should set in main() */
stackorigin = &x ;
return stackorigin - &x ; /* MSDOS stack grows down */
}
/************ Array : class to implement variable length arrays ************/
static int totalAllocatedMemory = 0 ;
static int totalNumberCreated = 0 ;
static int totalNumberActive = 0 ;
static Array reportArray = 0 ;
static void uArrayFinalise (void *cp) ;
#ifndef MEM_DEBUG
Array uArrayCreate (int n, int size, STORE_HANDLE handle)
{ int id = totalNumberCreated++ ;
Array new = (Array) handleAlloc (uArrayFinalise,
handle,
sizeof (struct ArrayStruct)) ;
#else
Array uArrayCreate_dbg (int n, int size, STORE_HANDLE handle,
const char *hfname,int hlineno)
{ int id = totalNumberCreated++ ;
Array new = (Array) handleAlloc_dbg (uArrayFinalise,
handle,
sizeof (struct ArrayStruct),
dbgPos(hfname, hlineno, __FILE__), __LINE__) ;
( run in 2.182 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )