memdebug0.1/0040775000175200017560000000000007364177153013361 5ustar stephensstephensmemdebug0.1/src/0040775000175200017560000000000007364177103014143 5ustar stephensstephensmemdebug0.1/src/memdebug/0042755000175200017560000000000007364164111015723 5ustar stephensstephensmemdebug0.1/src/memdebug/CVS/0042755000175200017560000000000007364164112016357 5ustar stephensstephensmemdebug0.1/src/memdebug/CVS/Root0100664000175200017560000000006107336072176017226 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/memdebug/CVS/Repository0100644000175200017560000000002607236675452020466 0ustar stephensstephenshome/ion/src/memdebug memdebug0.1/src/memdebug/CVS/Entries0100664000175200017560000000052407364164112017711 0ustar stephensstephens/Makefile/1.2/Tue Jan 4 06:29:54 2000// /Makefile.use/1.1/Tue Jan 4 06:31:32 2000// /getpagesize.h/1.1/Tue Jan 4 06:29:54 2000// /gmalloc.c/1.1/Tue Jan 4 05:31:32 2000// /memcpp.cc/1.1/Tue Jan 4 05:31:32 2000// /memdebug.c/1.2/Tue Jan 4 06:29:54 2000// /memdebug.h/1.1/Tue Jan 4 05:31:32 2000// /PKG/1.1/Sat Oct 20 02:36:17 2001// D memdebug0.1/src/memdebug/Makefile0100644000175200017560000000112607034311542017352 0ustar stephensstephens# $Id: Makefile,v 1.2 2000/01/04 06:29:54 stephensk Exp $ INCLS += .. H_FILES = \ memdebug.h \ gmalloc.c \ getpagesize.h C_FILES = \ memdebug.c CC_FILES = \ memcpp.cc DEFINES+= MEMDEBUG_INTERLOPER ################################################################# include $(MAKS)/pre.mak ################################################################# # Create LIB_NAME:=ionmemdebug include $(MAKS)/lib.mak ################################################################# # Basic include $(MAKS)/basic.mak ################################################################# # EOF memdebug0.1/src/memdebug/Makefile.use0100644000175200017560000000013207034311704020141 0ustar stephensstephens# $Id: Makefile.use,v 1.1 2000/01/04 06:31:32 stephensk Exp $ LIBS:=ionmemdebug $(LIBS) memdebug0.1/src/memdebug/getpagesize.h0100644000175200017560000000000007034311542020360 0ustar stephensstephensmemdebug0.1/src/memdebug/gmalloc.c0100644000175200017560000014330207034302664017504 0ustar stephensstephens/* This file is no longer automatically generated from libc. */ #define _MALLOC_INTERNAL /* The malloc headers and source files from the C library follow here. */ /* Declarations for `malloc' and friends. Copyright 1990, 91, 92, 93, 95, 96 Free Software Foundation, Inc. Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be reached (Email) at the address mike@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ #ifndef _MALLOC_H #define _MALLOC_H 1 #ifdef _MALLOC_INTERNAL #ifdef HAVE_CONFIG_H #include #endif #if defined (__cplusplus) || (defined (__STDC__) && __STDC__) #undef PP #define PP(args) args #undef __ptr_t #define __ptr_t void * #else /* Not C++ or ANSI C. */ #undef PP #define PP(args) () #undef const #define const #undef __ptr_t #define __ptr_t char * #endif /* C++ or ANSI C. */ #if defined(_LIBC) || defined(STDC_HEADERS) || defined(USG) #include #else #ifndef memset #define memset(s, zero, n) bzero ((s), (n)) #endif #ifndef memcpy #define memcpy(d, s, n) bcopy ((s), (d), (n)) #endif #endif #if defined (__GNU_LIBRARY__) || (defined (__STDC__) && __STDC__) #include #else #ifndef CHAR_BIT #define CHAR_BIT 8 #endif #endif #ifdef HAVE_UNISTD_H #include #endif #endif /* _MALLOC_INTERNAL. */ #ifdef __cplusplus extern "C" { #endif #if defined (__STDC__) && __STDC__ #include #define __malloc_size_t size_t #define __malloc_ptrdiff_t ptrdiff_t #else #define __malloc_size_t unsigned int #define __malloc_ptrdiff_t int #endif #ifndef NULL #define NULL 0 #endif /* Allocate SIZE bytes of memory. */ extern __ptr_t malloc PP ((__malloc_size_t __size)); /* Re-allocate the previously allocated block in __ptr_t, making the new block SIZE bytes long. */ extern __ptr_t realloc PP ((__ptr_t __ptr, __malloc_size_t __size)); /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ extern __ptr_t calloc PP ((__malloc_size_t __nmemb, __malloc_size_t __size)); /* Free a block allocated by `malloc', `realloc' or `calloc'. */ extern void free PP ((__ptr_t __ptr)); /* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ #if ! (defined (_MALLOC_INTERNAL) && __DJGPP__ - 0 == 1) /* Avoid conflict. */ extern __ptr_t memalign PP ((__malloc_size_t __alignment, __malloc_size_t __size)); #endif /* Allocate SIZE bytes on a page boundary. */ #if ! (defined (_MALLOC_INTERNAL) && defined (GMALLOC_INHIBIT_VALLOC)) extern __ptr_t valloc PP ((__malloc_size_t __size)); #endif #ifdef _MALLOC_INTERNAL /* The allocator divides the heap into blocks of fixed size; large requests receive one or more whole blocks, and small requests receive a fragment of a block. Fragment sizes are powers of two, and all fragments of a block are the same size. When all the fragments in a block have been freed, the block itself is freed. */ #define INT_BIT (CHAR_BIT * sizeof(int)) #define BLOCKLOG (INT_BIT > 16 ? 12 : 9) #define BLOCKSIZE (1 << BLOCKLOG) #define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE) /* Determine the amount of memory spanned by the initial heap table (not an absolute limit). */ #define HEAP (INT_BIT > 16 ? 4194304 : 65536) /* Number of contiguous free blocks allowed to build up at the end of memory before they will be returned to the system. */ #define FINAL_FREE_BLOCKS 8 /* Data structure giving per-block information. */ typedef union { /* Heap information for a busy block. */ struct { /* Zero for a large (multiblock) object, or positive giving the logarithm to the base two of the fragment size. */ int type; union { struct { __malloc_size_t nfree; /* Free frags in a fragmented block. */ __malloc_size_t first; /* First free fragment of the block. */ } frag; /* For a large object, in its first block, this has the number of blocks in the object. In the other blocks, this has a negative number which says how far back the first block is. */ __malloc_ptrdiff_t size; } info; } busy; /* Heap information for a free block (that may be the first of a free cluster). */ struct { __malloc_size_t size; /* Size (in blocks) of a free cluster. */ __malloc_size_t next; /* Index of next free cluster. */ __malloc_size_t prev; /* Index of previous free cluster. */ } free; } malloc_info; /* Pointer to first block of the heap. */ extern char *_heapbase; /* Table indexed by block number giving per-block information. */ extern malloc_info *_heapinfo; /* Address to block number and vice versa. */ #define BLOCK(A) (((char *) (A) - _heapbase) / BLOCKSIZE + 1) #define ADDRESS(B) ((__ptr_t) (((B) - 1) * BLOCKSIZE + _heapbase)) /* Current search index for the heap table. */ extern __malloc_size_t _heapindex; /* Limit of valid info table indices. */ extern __malloc_size_t _heaplimit; /* Doubly linked lists of free fragments. */ struct list { struct list *next; struct list *prev; }; /* Free list headers for each fragment size. */ extern struct list _fraghead[]; /* List of blocks allocated with `memalign' (or `valloc'). */ struct alignlist { struct alignlist *next; __ptr_t aligned; /* The address that memaligned returned. */ __ptr_t exact; /* The address that malloc returned. */ }; extern struct alignlist *_aligned_blocks; /* Instrumentation. */ extern __malloc_size_t _chunks_used; extern __malloc_size_t _bytes_used; extern __malloc_size_t _chunks_free; extern __malloc_size_t _bytes_free; /* Internal versions of `malloc', `realloc', and `free' used when these functions need to call each other. They are the same but don't call the hooks. */ extern __ptr_t _malloc_internal PP ((__malloc_size_t __size)); extern __ptr_t _realloc_internal PP ((__ptr_t __ptr, __malloc_size_t __size)); extern void _free_internal PP ((__ptr_t __ptr)); #endif /* _MALLOC_INTERNAL. */ /* Given an address in the middle of a malloc'd object, return the address of the beginning of the object. */ extern __ptr_t malloc_find_object_address PP ((__ptr_t __ptr)); /* Underlying allocation function; successive calls should return contiguous pieces of memory. */ extern __ptr_t (*__morecore) PP ((__malloc_ptrdiff_t __size)); /* Default value of `__morecore'. */ extern __ptr_t __default_morecore PP ((__malloc_ptrdiff_t __size)); /* If not NULL, this function is called after each time `__morecore' is called to increase the data size. */ extern void (*__after_morecore_hook) PP ((void)); /* Number of extra blocks to get each time we ask for more core. This reduces the frequency of calling `(*__morecore)'. */ extern __malloc_size_t __malloc_extra_blocks; /* Nonzero if `malloc' has been called and done its initialization. */ extern int __malloc_initialized; /* Function called to initialize malloc data structures. */ extern int __malloc_initialize PP ((void)); /* Hooks for debugging versions. */ extern void (*__malloc_initialize_hook) PP ((void)); extern void (*__free_hook) PP ((__ptr_t __ptr)); extern __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size)); extern __ptr_t (*__realloc_hook) PP ((__ptr_t __ptr, __malloc_size_t __size)); extern __ptr_t (*__memalign_hook) PP ((__malloc_size_t __size, __malloc_size_t __alignment)); /* Return values for `mprobe': these are the kinds of inconsistencies that `mcheck' enables detection of. */ enum mcheck_status { MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */ MCHECK_OK, /* Block is fine. */ MCHECK_FREE, /* Block freed twice. */ MCHECK_HEAD, /* Memory before the block was clobbered. */ MCHECK_TAIL /* Memory after the block was clobbered. */ }; /* Activate a standard collection of debugging hooks. This must be called before `malloc' is ever called. ABORTFUNC is called with an error code (see enum above) when an inconsistency is detected. If ABORTFUNC is null, the standard function prints on stderr and then calls `abort'. */ extern int mcheck PP ((void (*__abortfunc) PP ((enum mcheck_status)))); /* Check for aberrations in a particular malloc'd block. You must have called `mcheck' already. These are the same checks that `mcheck' does when you free or reallocate a block. */ extern enum mcheck_status mprobe PP ((__ptr_t __ptr)); /* Activate a standard collection of tracing hooks. */ extern void mtrace PP ((void)); extern void muntrace PP ((void)); /* Statistics available to the user. */ struct mstats { __malloc_size_t bytes_total; /* Total size of the heap. */ __malloc_size_t chunks_used; /* Chunks allocated by the user. */ __malloc_size_t bytes_used; /* Byte total of user-allocated chunks. */ __malloc_size_t chunks_free; /* Chunks in the free list. */ __malloc_size_t bytes_free; /* Byte total of chunks in the free list. */ }; /* Pick up the current statistics. */ extern struct mstats mstats PP ((void)); /* Call WARNFUN with a warning message when memory usage is high. */ extern void memory_warnings PP ((__ptr_t __start, void (*__warnfun) PP ((const char *)))); /* Relocating allocator. */ /* Allocate SIZE bytes, and store the address in *HANDLEPTR. */ extern __ptr_t r_alloc PP ((__ptr_t *__handleptr, __malloc_size_t __size)); /* Free the storage allocated in HANDLEPTR. */ extern void r_alloc_free PP ((__ptr_t *__handleptr)); /* Adjust the block at HANDLEPTR to be SIZE bytes long. */ extern __ptr_t r_re_alloc PP ((__ptr_t *__handleptr, __malloc_size_t __size)); #ifdef __cplusplus } #endif #endif /* malloc.h */ /* Memory allocator `malloc'. Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be reached (Email) at the address mike@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ #ifndef _MALLOC_INTERNAL #define _MALLOC_INTERNAL #include #endif #include /* How to really get more memory. */ __ptr_t (*__morecore) PP ((ptrdiff_t __size)) = __default_morecore; /* Debugging hook for `malloc'. */ __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size)); /* Pointer to the base of the first block. */ char *_heapbase; /* Block information table. Allocated with align/__free (not malloc/free). */ malloc_info *_heapinfo; /* Number of info entries. */ static __malloc_size_t heapsize; /* Search index in the info table. */ __malloc_size_t _heapindex; /* Limit of valid info table indices. */ __malloc_size_t _heaplimit; /* Free lists for each fragment size. */ struct list _fraghead[BLOCKLOG]; /* Instrumentation. */ __malloc_size_t _chunks_used; __malloc_size_t _bytes_used; __malloc_size_t _chunks_free; __malloc_size_t _bytes_free; /* Are you experienced? */ int __malloc_initialized; __malloc_size_t __malloc_extra_blocks; void (*__malloc_initialize_hook) PP ((void)); void (*__after_morecore_hook) PP ((void)); /* Aligned allocation. */ static __ptr_t align PP ((__malloc_size_t)); static __ptr_t align (size) __malloc_size_t size; { __ptr_t result; unsigned long int adj; result = (*__morecore) (size); adj = (unsigned long int) ((unsigned long int) ((char *) result - (char *) NULL)) % BLOCKSIZE; if (adj != 0) { __ptr_t new; adj = BLOCKSIZE - adj; new = (*__morecore) (adj); result = (char *) result + adj; } if (__after_morecore_hook) (*__after_morecore_hook) (); return result; } /* Get SIZE bytes, if we can get them starting at END. Return the address of the space we got. If we cannot get space at END, fail and return 0. */ static __ptr_t get_contiguous_space PP ((__malloc_ptrdiff_t, __ptr_t)); static __ptr_t get_contiguous_space (size, position) __malloc_ptrdiff_t size; __ptr_t position; { __ptr_t before; __ptr_t after; before = (*__morecore) (0); /* If we can tell in advance that the break is at the wrong place, fail now. */ if (before != position) return 0; /* Allocate SIZE bytes and get the address of them. */ after = (*__morecore) (size); if (!after) return 0; /* It was not contiguous--reject it. */ if (after != position) { (*__morecore) (- size); return 0; } return after; } /* This is called when `_heapinfo' and `heapsize' have just been set to describe a new info table. Set up the table to describe itself and account for it in the statistics. */ static void register_heapinfo PP ((void)); #ifdef __GNUC__ __inline__ #endif static void register_heapinfo () { __malloc_size_t block, blocks; block = BLOCK (_heapinfo); blocks = BLOCKIFY (heapsize * sizeof (malloc_info)); /* Account for the _heapinfo block itself in the statistics. */ _bytes_used += blocks * BLOCKSIZE; ++_chunks_used; /* Describe the heapinfo block itself in the heapinfo. */ _heapinfo[block].busy.type = 0; _heapinfo[block].busy.info.size = blocks; /* Leave back-pointers for malloc_find_address. */ while (--blocks > 0) _heapinfo[block + blocks].busy.info.size = -blocks; } /* Set everything up and remember that we have. */ int __malloc_initialize () { if (__malloc_initialized) return 0; if (__malloc_initialize_hook) (*__malloc_initialize_hook) (); heapsize = HEAP / BLOCKSIZE; _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info)); if (_heapinfo == NULL) return 0; memset (_heapinfo, 0, heapsize * sizeof (malloc_info)); _heapinfo[0].free.size = 0; _heapinfo[0].free.next = _heapinfo[0].free.prev = 0; _heapindex = 0; _heapbase = (char *) _heapinfo; _heaplimit = BLOCK (_heapbase + heapsize * sizeof (malloc_info)); register_heapinfo (); __malloc_initialized = 1; return 1; } static int morecore_recursing; /* Get neatly aligned memory, initializing or growing the heap info table as necessary. */ static __ptr_t morecore PP ((__malloc_size_t)); static __ptr_t morecore (size) __malloc_size_t size; { __ptr_t result; malloc_info *newinfo, *oldinfo; __malloc_size_t newsize; if (morecore_recursing) /* Avoid recursion. The caller will know how to handle a null return. */ return NULL; result = align (size); if (result == NULL) return NULL; /* Check if we need to grow the info table. */ if ((__malloc_size_t) BLOCK ((char *) result + size) > heapsize) { /* Calculate the new _heapinfo table size. We do not account for the added blocks in the table itself, as we hope to place them in existing free space, which is already covered by part of the existing table. */ newsize = heapsize; do newsize *= 2; while ((__malloc_size_t) BLOCK ((char *) result + size) > newsize); /* We must not reuse existing core for the new info table when called from realloc in the case of growing a large block, because the block being grown is momentarily marked as free. In this case _heaplimit is zero so we know not to reuse space for internal allocation. */ if (_heaplimit != 0) { /* First try to allocate the new info table in core we already have, in the usual way using realloc. If realloc cannot extend it in place or relocate it to existing sufficient core, we will get called again, and the code above will notice the `morecore_recursing' flag and return null. */ int save = errno; /* Don't want to clobber errno with ENOMEM. */ morecore_recursing = 1; newinfo = (malloc_info *) _realloc_internal (_heapinfo, newsize * sizeof (malloc_info)); morecore_recursing = 0; if (newinfo == NULL) errno = save; else { /* We found some space in core, and realloc has put the old table's blocks on the free list. Now zero the new part of the table and install the new table location. */ memset (&newinfo[heapsize], 0, (newsize - heapsize) * sizeof (malloc_info)); _heapinfo = newinfo; heapsize = newsize; goto got_heap; } } /* Allocate new space for the malloc info table. */ while (1) { newinfo = (malloc_info *) align (newsize * sizeof (malloc_info)); /* Did it fail? */ if (newinfo == NULL) { (*__morecore) (-size); return NULL; } /* Is it big enough to record status for its own space? If so, we win. */ if ((__malloc_size_t) BLOCK ((char *) newinfo + newsize * sizeof (malloc_info)) < newsize) break; /* Must try again. First give back most of what we just got. */ (*__morecore) (- newsize * sizeof (malloc_info)); newsize *= 2; } /* Copy the old table to the beginning of the new, and zero the rest of the new table. */ memcpy (newinfo, _heapinfo, heapsize * sizeof (malloc_info)); memset (&newinfo[heapsize], 0, (newsize - heapsize) * sizeof (malloc_info)); oldinfo = _heapinfo; _heapinfo = newinfo; heapsize = newsize; register_heapinfo (); /* Reset _heaplimit so _free_internal never decides it can relocate or resize the info table. */ _heaplimit = 0; _free_internal (oldinfo); /* The new heap limit includes the new table just allocated. */ _heaplimit = BLOCK ((char *) newinfo + heapsize * sizeof (malloc_info)); return result; } got_heap: _heaplimit = BLOCK ((char *) result + size); return result; } /* Allocate memory from the heap. */ __ptr_t _malloc_internal (size) __malloc_size_t size; { __ptr_t result; __malloc_size_t block, blocks, lastblocks, start; register __malloc_size_t i; struct list *next; /* ANSI C allows `malloc (0)' to either return NULL, or to return a valid address you can realloc and free (though not dereference). It turns out that some extant code (sunrpc, at least Ultrix's version) expects `malloc (0)' to return non-NULL and breaks otherwise. Be compatible. */ #if 0 if (size == 0) return NULL; #endif if (size < sizeof (struct list)) size = sizeof (struct list); #ifdef SUNOS_LOCALTIME_BUG if (size < 16) size = 16; #endif /* Determine the allocation policy based on the request size. */ if (size <= BLOCKSIZE / 2) { /* Small allocation to receive a fragment of a block. Determine the logarithm to base two of the fragment size. */ register __malloc_size_t log = 1; --size; while ((size /= 2) != 0) ++log; /* Look in the fragment lists for a free fragment of the desired size. */ next = _fraghead[log].next; if (next != NULL) { /* There are free fragments of this size. Pop a fragment out of the fragment list and return it. Update the block's nfree and first counters. */ result = (__ptr_t) next; next->prev->next = next->next; if (next->next != NULL) next->next->prev = next->prev; block = BLOCK (result); if (--_heapinfo[block].busy.info.frag.nfree != 0) _heapinfo[block].busy.info.frag.first = (unsigned long int) ((unsigned long int) ((char *) next->next - (char *) NULL) % BLOCKSIZE) >> log; /* Update the statistics. */ ++_chunks_used; _bytes_used += 1 << log; --_chunks_free; _bytes_free -= 1 << log; } else { /* No free fragments of the desired size, so get a new block and break it into fragments, returning the first. */ result = malloc (BLOCKSIZE); if (result == NULL) return NULL; /* Link all fragments but the first into the free list. */ next = (struct list *) ((char *) result + (1 << log)); next->next = NULL; next->prev = &_fraghead[log]; _fraghead[log].next = next; for (i = 2; i < (__malloc_size_t) (BLOCKSIZE >> log); ++i) { next = (struct list *) ((char *) result + (i << log)); next->next = _fraghead[log].next; next->prev = &_fraghead[log]; next->prev->next = next; next->next->prev = next; } /* Initialize the nfree and first counters for this block. */ block = BLOCK (result); _heapinfo[block].busy.type = log; _heapinfo[block].busy.info.frag.nfree = i - 1; _heapinfo[block].busy.info.frag.first = i - 1; _chunks_free += (BLOCKSIZE >> log) - 1; _bytes_free += BLOCKSIZE - (1 << log); _bytes_used -= BLOCKSIZE - (1 << log); } } else { /* Large allocation to receive one or more blocks. Search the free list in a circle starting at the last place visited. If we loop completely around without finding a large enough space we will have to get more memory from the system. */ blocks = BLOCKIFY (size); start = block = _heapindex; while (_heapinfo[block].free.size < blocks) { block = _heapinfo[block].free.next; if (block == start) { /* Need to get more from the system. Get a little extra. */ __malloc_size_t wantblocks = blocks + __malloc_extra_blocks; block = _heapinfo[0].free.prev; lastblocks = _heapinfo[block].free.size; /* Check to see if the new core will be contiguous with the final free block; if so we don't need to get as much. */ if (_heaplimit != 0 && block + lastblocks == _heaplimit && /* We can't do this if we will have to make the heap info table bigger to accomodate the new space. */ block + wantblocks <= heapsize && get_contiguous_space ((wantblocks - lastblocks) * BLOCKSIZE, ADDRESS (block + lastblocks))) { /* We got it contiguously. Which block we are extending (the `final free block' referred to above) might have changed, if it got combined with a freed info table. */ block = _heapinfo[0].free.prev; _heapinfo[block].free.size += (wantblocks - lastblocks); _bytes_free += (wantblocks - lastblocks) * BLOCKSIZE; _heaplimit += wantblocks - lastblocks; continue; } result = morecore (wantblocks * BLOCKSIZE); if (result == NULL) return NULL; block = BLOCK (result); /* Put the new block at the end of the free list. */ _heapinfo[block].free.size = wantblocks; _heapinfo[block].free.prev = _heapinfo[0].free.prev; _heapinfo[block].free.next = 0; _heapinfo[0].free.prev = block; _heapinfo[_heapinfo[block].free.prev].free.next = block; ++_chunks_free; /* Now loop to use some of that block for this allocation. */ } } /* At this point we have found a suitable free list entry. Figure out how to remove what we need from the list. */ result = ADDRESS (block); if (_heapinfo[block].free.size > blocks) { /* The block we found has a bit left over, so relink the tail end back into the free list. */ _heapinfo[block + blocks].free.size = _heapinfo[block].free.size - blocks; _heapinfo[block + blocks].free.next = _heapinfo[block].free.next; _heapinfo[block + blocks].free.prev = _heapinfo[block].free.prev; _heapinfo[_heapinfo[block].free.prev].free.next = _heapinfo[_heapinfo[block].free.next].free.prev = _heapindex = block + blocks; } else { /* The block exactly matches our requirements, so just remove it from the list. */ _heapinfo[_heapinfo[block].free.next].free.prev = _heapinfo[block].free.prev; _heapinfo[_heapinfo[block].free.prev].free.next = _heapindex = _heapinfo[block].free.next; --_chunks_free; } _heapinfo[block].busy.type = 0; _heapinfo[block].busy.info.size = blocks; ++_chunks_used; _bytes_used += blocks * BLOCKSIZE; _bytes_free -= blocks * BLOCKSIZE; /* Mark all the blocks of the object just allocated except for the first with a negative number so you can find the first block by adding that adjustment. */ while (--blocks > 0) _heapinfo[block + blocks].busy.info.size = -blocks; } return result; } __ptr_t malloc (size) __malloc_size_t size; { if (!__malloc_initialized && !__malloc_initialize ()) return NULL; return (__malloc_hook != NULL ? *__malloc_hook : _malloc_internal) (size); } #ifndef _LIBC /* On some ANSI C systems, some libc functions call _malloc, _free and _realloc. Make them use the GNU functions. */ __ptr_t _malloc (size) __malloc_size_t size; { return malloc (size); } void _free (ptr) __ptr_t ptr; { free (ptr); } __ptr_t _realloc (ptr, size) __ptr_t ptr; __malloc_size_t size; { return realloc (ptr, size); } #endif /* Free a block of memory allocated by `malloc'. Copyright 1990, 1991, 1992, 1994, 1995 Free Software Foundation, Inc. Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be reached (Email) at the address mike@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ #ifndef _MALLOC_INTERNAL #define _MALLOC_INTERNAL #include #endif /* Cope with systems lacking `memmove'. */ #ifndef memmove #if (defined (MEMMOVE_MISSING) || \ !defined(_LIBC) && !defined(STDC_HEADERS) && !defined(USG)) #ifdef emacs #undef __malloc_safe_bcopy #define __malloc_safe_bcopy safe_bcopy #endif /* This function is defined in realloc.c. */ extern void __malloc_safe_bcopy PP ((__ptr_t, __ptr_t, __malloc_size_t)); #define memmove(to, from, size) __malloc_safe_bcopy ((from), (to), (size)) #endif #endif /* Debugging hook for free. */ void (*__free_hook) PP ((__ptr_t __ptr)); /* List of blocks allocated by memalign. */ struct alignlist *_aligned_blocks = NULL; /* Return memory to the heap. Like `free' but don't call a __free_hook if there is one. */ void _free_internal (ptr) __ptr_t ptr; { int type; __malloc_size_t block, blocks; register __malloc_size_t i; struct list *prev, *next; __ptr_t curbrk; const __malloc_size_t lesscore_threshold /* Threshold of free space at which we will return some to the system. */ = FINAL_FREE_BLOCKS + 2 * __malloc_extra_blocks; register struct alignlist *l; if (ptr == NULL) return; for (l = _aligned_blocks; l != NULL; l = l->next) if (l->aligned == ptr) { l->aligned = NULL; /* Mark the slot in the list as free. */ ptr = l->exact; break; } block = BLOCK (ptr); type = _heapinfo[block].busy.type; switch (type) { case 0: /* Get as many statistics as early as we can. */ --_chunks_used; _bytes_used -= _heapinfo[block].busy.info.size * BLOCKSIZE; _bytes_free += _heapinfo[block].busy.info.size * BLOCKSIZE; /* Find the free cluster previous to this one in the free list. Start searching at the last block referenced; this may benefit programs with locality of allocation. */ i = _heapindex; if (i > block) while (i > block) i = _heapinfo[i].free.prev; else { do i = _heapinfo[i].free.next; while (i > 0 && i < block); i = _heapinfo[i].free.prev; } /* Determine how to link this block into the free list. */ if (block == i + _heapinfo[i].free.size) { /* Coalesce this block with its predecessor. */ _heapinfo[i].free.size += _heapinfo[block].busy.info.size; block = i; } else { /* Really link this block back into the free list. */ _heapinfo[block].free.size = _heapinfo[block].busy.info.size; _heapinfo[block].free.next = _heapinfo[i].free.next; _heapinfo[block].free.prev = i; _heapinfo[i].free.next = block; _heapinfo[_heapinfo[block].free.next].free.prev = block; ++_chunks_free; } /* Now that the block is linked in, see if we can coalesce it with its successor (by deleting its successor from the list and adding in its size). */ if (block + _heapinfo[block].free.size == _heapinfo[block].free.next) { _heapinfo[block].free.size += _heapinfo[_heapinfo[block].free.next].free.size; _heapinfo[block].free.next = _heapinfo[_heapinfo[block].free.next].free.next; _heapinfo[_heapinfo[block].free.next].free.prev = block; --_chunks_free; } /* How many trailing free blocks are there now? */ blocks = _heapinfo[block].free.size; /* Where is the current end of accessible core? */ curbrk = (*__morecore) (0); if (_heaplimit != 0 && curbrk == ADDRESS (_heaplimit)) { /* The end of the malloc heap is at the end of accessible core. It's possible that moving _heapinfo will allow us to return some space to the system. */ __malloc_size_t info_block = BLOCK (_heapinfo); __malloc_size_t info_blocks = _heapinfo[info_block].busy.info.size; __malloc_size_t prev_block = _heapinfo[block].free.prev; __malloc_size_t prev_blocks = _heapinfo[prev_block].free.size; __malloc_size_t next_block = _heapinfo[block].free.next; __malloc_size_t next_blocks = _heapinfo[next_block].free.size; if (/* Win if this block being freed is last in core, the info table is just before it, the previous free block is just before the info table, and the two free blocks together form a useful amount to return to the system. */ (block + blocks == _heaplimit && info_block + info_blocks == block && prev_block != 0 && prev_block + prev_blocks == info_block && blocks + prev_blocks >= lesscore_threshold) || /* Nope, not the case. We can also win if this block being freed is just before the info table, and the table extends to the end of core or is followed only by a free block, and the total free space is worth returning to the system. */ (block + blocks == info_block && ((info_block + info_blocks == _heaplimit && blocks >= lesscore_threshold) || (info_block + info_blocks == next_block && next_block + next_blocks == _heaplimit && blocks + next_blocks >= lesscore_threshold))) ) { malloc_info *newinfo; __malloc_size_t oldlimit = _heaplimit; /* Free the old info table, clearing _heaplimit to avoid recursion into this code. We don't want to return the table's blocks to the system before we have copied them to the new location. */ _heaplimit = 0; _free_internal (_heapinfo); _heaplimit = oldlimit; /* Tell malloc to search from the beginning of the heap for free blocks, so it doesn't reuse the ones just freed. */ _heapindex = 0; /* Allocate new space for the info table and move its data. */ newinfo = (malloc_info *) _malloc_internal (info_blocks * BLOCKSIZE); memmove (newinfo, _heapinfo, info_blocks * BLOCKSIZE); _heapinfo = newinfo; /* We should now have coalesced the free block with the blocks freed from the old info table. Examine the entire trailing free block to decide below whether to return some to the system. */ block = _heapinfo[0].free.prev; blocks = _heapinfo[block].free.size; } /* Now see if we can return stuff to the system. */ if (block + blocks == _heaplimit && blocks >= lesscore_threshold) { register __malloc_size_t bytes = blocks * BLOCKSIZE; _heaplimit -= blocks; (*__morecore) (-bytes); _heapinfo[_heapinfo[block].free.prev].free.next = _heapinfo[block].free.next; _heapinfo[_heapinfo[block].free.next].free.prev = _heapinfo[block].free.prev; block = _heapinfo[block].free.prev; --_chunks_free; _bytes_free -= bytes; } } /* Set the next search to begin at this block. */ _heapindex = block; break; default: /* Do some of the statistics. */ --_chunks_used; _bytes_used -= 1 << type; ++_chunks_free; _bytes_free += 1 << type; /* Get the address of the first free fragment in this block. */ prev = (struct list *) ((char *) ADDRESS (block) + (_heapinfo[block].busy.info.frag.first << type)); if (_heapinfo[block].busy.info.frag.nfree == (BLOCKSIZE >> type) - 1) { /* If all fragments of this block are free, remove them from the fragment list and free the whole block. */ next = prev; for (i = 1; i < (__malloc_size_t) (BLOCKSIZE >> type); ++i) next = next->next; prev->prev->next = next; if (next != NULL) next->prev = prev->prev; _heapinfo[block].busy.type = 0; _heapinfo[block].busy.info.size = 1; /* Keep the statistics accurate. */ ++_chunks_used; _bytes_used += BLOCKSIZE; _chunks_free -= BLOCKSIZE >> type; _bytes_free -= BLOCKSIZE; free (ADDRESS (block)); } else if (_heapinfo[block].busy.info.frag.nfree != 0) { /* If some fragments of this block are free, link this fragment into the fragment list after the first free fragment of this block. */ next = (struct list *) ptr; next->next = prev->next; next->prev = prev; prev->next = next; if (next->next != NULL) next->next->prev = next; ++_heapinfo[block].busy.info.frag.nfree; } else { /* No fragments of this block are free, so link this fragment into the fragment list and announce that it is the first free fragment of this block. */ prev = (struct list *) ptr; _heapinfo[block].busy.info.frag.nfree = 1; _heapinfo[block].busy.info.frag.first = (unsigned long int) ((unsigned long int) ((char *) ptr - (char *) NULL) % BLOCKSIZE >> type); prev->next = _fraghead[type].next; prev->prev = &_fraghead[type]; prev->prev->next = prev; if (prev->next != NULL) prev->next->prev = prev; } break; } } /* Return memory to the heap. */ void free (ptr) __ptr_t ptr; { if (__free_hook != NULL) (*__free_hook) (ptr); else _free_internal (ptr); } /* Define the `cfree' alias for `free'. */ #ifdef weak_alias weak_alias (free, cfree) #else void cfree (ptr) __ptr_t ptr; { free (ptr); } #endif /* Change the size of a block allocated by `malloc'. Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be reached (Email) at the address mike@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ #ifndef _MALLOC_INTERNAL #define _MALLOC_INTERNAL #include #endif /* Cope with systems lacking `memmove'. */ #if (defined (MEMMOVE_MISSING) || \ !defined(_LIBC) && !defined(STDC_HEADERS) && !defined(USG)) #ifdef emacs #undef __malloc_safe_bcopy #define __malloc_safe_bcopy safe_bcopy #else /* Snarfed directly from Emacs src/dispnew.c: XXX Should use system bcopy if it handles overlap. */ /* Like bcopy except never gets confused by overlap. */ void __malloc_safe_bcopy (afrom, ato, size) __ptr_t afrom; __ptr_t ato; __malloc_size_t size; { char *from = afrom, *to = ato; if (size <= 0 || from == to) return; /* If the source and destination don't overlap, then bcopy can handle it. If they do overlap, but the destination is lower in memory than the source, we'll assume bcopy can handle that. */ if (to < from || from + size <= to) bcopy (from, to, size); /* Otherwise, we'll copy from the end. */ else { register char *endf = from + size; register char *endt = to + size; /* If TO - FROM is large, then we should break the copy into nonoverlapping chunks of TO - FROM bytes each. However, if TO - FROM is small, then the bcopy function call overhead makes this not worth it. The crossover point could be about anywhere. Since I don't think the obvious copy loop is too bad, I'm trying to err in its favor. */ if (to - from < 64) { do *--endt = *--endf; while (endf != from); } else { for (;;) { endt -= (to - from); endf -= (to - from); if (endt < to) break; bcopy (endf, endt, to - from); } /* If SIZE wasn't a multiple of TO - FROM, there will be a little left over. The amount left over is (endt + (to - from)) - to, which is endt - from. */ bcopy (from, to, endt - from); } } } #endif /* emacs */ #ifndef memmove extern void __malloc_safe_bcopy PP ((__ptr_t, __ptr_t, __malloc_size_t)); #define memmove(to, from, size) __malloc_safe_bcopy ((from), (to), (size)) #endif #endif #define min(A, B) ((A) < (B) ? (A) : (B)) /* Debugging hook for realloc. */ __ptr_t (*__realloc_hook) PP ((__ptr_t __ptr, __malloc_size_t __size)); /* Resize the given region to the new size, returning a pointer to the (possibly moved) region. This is optimized for speed; some benchmarks seem to indicate that greater compactness is achieved by unconditionally allocating and copying to a new region. This module has incestuous knowledge of the internals of both free and malloc. */ __ptr_t _realloc_internal (ptr, size) __ptr_t ptr; __malloc_size_t size; { __ptr_t result; int type; __malloc_size_t block, blocks, oldlimit; if (size == 0) { _free_internal (ptr); return _malloc_internal (0); } else if (ptr == NULL) return _malloc_internal (size); block = BLOCK (ptr); type = _heapinfo[block].busy.type; switch (type) { case 0: /* Maybe reallocate a large block to a small fragment. */ if (size <= BLOCKSIZE / 2) { result = _malloc_internal (size); if (result != NULL) { memcpy (result, ptr, size); _free_internal (ptr); return result; } } /* The new size is a large allocation as well; see if we can hold it in place. */ blocks = BLOCKIFY (size); if (blocks < _heapinfo[block].busy.info.size) { /* The new size is smaller; return excess memory to the free list. */ _heapinfo[block + blocks].busy.type = 0; _heapinfo[block + blocks].busy.info.size = _heapinfo[block].busy.info.size - blocks; _heapinfo[block].busy.info.size = blocks; /* We have just created a new chunk by splitting a chunk in two. Now we will free this chunk; increment the statistics counter so it doesn't become wrong when _free_internal decrements it. */ ++_chunks_used; _free_internal (ADDRESS (block + blocks)); result = ptr; } else if (blocks == _heapinfo[block].busy.info.size) /* No size change necessary. */ result = ptr; else { /* Won't fit, so allocate a new region that will. Free the old region first in case there is sufficient adjacent free space to grow without moving. */ blocks = _heapinfo[block].busy.info.size; /* Prevent free from actually returning memory to the system. */ oldlimit = _heaplimit; _heaplimit = 0; _free_internal (ptr); result = _malloc_internal (size); if (_heaplimit == 0) _heaplimit = oldlimit; if (result == NULL) { /* Now we're really in trouble. We have to unfree the thing we just freed. Unfortunately it might have been coalesced with its neighbors. */ if (_heapindex == block) (void) _malloc_internal (blocks * BLOCKSIZE); else { __ptr_t previous = _malloc_internal ((block - _heapindex) * BLOCKSIZE); (void) _malloc_internal (blocks * BLOCKSIZE); _free_internal (previous); } return NULL; } if (ptr != result) memmove (result, ptr, blocks * BLOCKSIZE); } break; default: /* Old size is a fragment; type is logarithm to base two of the fragment size. */ if (size > (__malloc_size_t) (1 << (type - 1)) && size <= (__malloc_size_t) (1 << type)) /* The new size is the same kind of fragment. */ result = ptr; else { /* The new size is different; allocate a new space, and copy the lesser of the new size and the old. */ result = _malloc_internal (size); if (result == NULL) return NULL; memcpy (result, ptr, min (size, (__malloc_size_t) 1 << type)); _free_internal (ptr); } break; } return result; } __ptr_t realloc (ptr, size) __ptr_t ptr; __malloc_size_t size; { if (!__malloc_initialized && !__malloc_initialize ()) return NULL; return (__realloc_hook != NULL ? *__realloc_hook : _realloc_internal) (ptr, size); } #if 0 #ifdef MEMDEBUG_INTERLOPER #ifdef malloc #undef malloc #endif #ifdef realloc #undef realloc #endif #ifdef free #undef free #endif #endif #endif /* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be reached (Email) at the address mike@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ #ifndef _MALLOC_INTERNAL #define _MALLOC_INTERNAL #include #endif /* Allocate an array of NMEMB elements each SIZE bytes long. The entire array is initialized to zeros. */ __ptr_t calloc (nmemb, size) register __malloc_size_t nmemb; register __malloc_size_t size; { register __ptr_t result = malloc (nmemb * size); if (result != NULL) (void) memset (result, 0, nmemb * size); return result; } /* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the GNU C Library; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MALLOC_INTERNAL #define _MALLOC_INTERNAL #include #endif #ifndef __GNU_LIBRARY__ #define __sbrk sbrk #endif #ifdef __GNU_LIBRARY__ /* It is best not to declare this and cast its result on foreign operating systems with potentially hostile include files. */ #include extern __ptr_t __sbrk PP ((ptrdiff_t increment)); #endif #ifndef NULL #define NULL 0 #endif /* Allocate INCREMENT more bytes of data space, and return the start of data space, or NULL on errors. If INCREMENT is negative, shrink data space. */ __ptr_t __default_morecore (increment) __malloc_ptrdiff_t increment; { __ptr_t result = (__ptr_t) __sbrk (increment); if (result == (__ptr_t) -1) return NULL; return result; } /* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MALLOC_INTERNAL #define _MALLOC_INTERNAL #include #endif #if __DJGPP__ - 0 == 1 /* There is some problem with memalign in DJGPP v1 and we are supposed to omit it. Noone told me why, they just told me to do it. */ #else __ptr_t (*__memalign_hook) PP ((size_t __size, size_t __alignment)); __ptr_t memalign (alignment, size) __malloc_size_t alignment; __malloc_size_t size; { __ptr_t result; unsigned long int adj, lastadj; if (__memalign_hook) return (*__memalign_hook) (alignment, size); /* Allocate a block with enough extra space to pad the block with up to (ALIGNMENT - 1) bytes if necessary. */ result = malloc (size + alignment - 1); if (result == NULL) return NULL; /* Figure out how much we will need to pad this particular block to achieve the required alignment. */ adj = (unsigned long int) ((char *) result - (char *) NULL) % alignment; do { /* Reallocate the block with only as much excess as it needs. */ free (result); result = malloc (adj + size); if (result == NULL) /* Impossible unless interrupted. */ return NULL; lastadj = adj; adj = (unsigned long int) ((char *) result - (char *) NULL) % alignment; /* It's conceivable we might have been so unlucky as to get a different block with weaker alignment. If so, this block is too short to contain SIZE after alignment correction. So we must try again and get another block, slightly larger. */ } while (adj > lastadj); if (adj != 0) { /* Record this block in the list of aligned blocks, so that `free' can identify the pointer it is passed, which will be in the middle of an allocated block. */ struct alignlist *l; for (l = _aligned_blocks; l != NULL; l = l->next) if (l->aligned == NULL) /* This slot is free. Use it. */ break; if (l == NULL) { l = (struct alignlist *) malloc (sizeof (struct alignlist)); if (l == NULL) { free (result); return NULL; } l->next = _aligned_blocks; _aligned_blocks = l; } l->exact = result; result = l->aligned = (char *) result + alignment - adj; } return result; } #endif /* Not DJGPP v1 */ /* Allocate memory on a page boundary. Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be reached (Email) at the address mike@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ #if defined (_MALLOC_INTERNAL) && defined (GMALLOC_INHIBIT_VALLOC) /* Emacs defines GMALLOC_INHIBIT_VALLOC to avoid this definition on MSDOS, where it conflicts with a system header file. */ #define ELIDE_VALLOC #endif #ifndef ELIDE_VALLOC #if defined (__GNU_LIBRARY__) || defined (_LIBC) #include #include #if defined (__GLIBC__) && __GLIBC__ >= 2 /* __getpagesize is already declared in with return type int */ #else extern size_t __getpagesize PP ((void)); #endif #else #include "getpagesize.h" #define __getpagesize() getpagesize() #endif #ifndef _MALLOC_INTERNAL #define _MALLOC_INTERNAL #include #endif static __malloc_size_t pagesize; __ptr_t valloc (size) __malloc_size_t size; { if (pagesize == 0) pagesize = __getpagesize (); return memalign (pagesize, size); } #endif /* Not ELIDE_VALLOC. */ memdebug0.1/src/memdebug/memcpp.cc0100644000175200017560000000055707034302664017516 0ustar stephensstephens#include /* size_t */ #include /* memset() */ #include "memdebug.h" void *operator new(size_t s) { return memdebug_operator_new(s); } void operator delete(void *p) { memdebug_operator_delete(p); } void *operator new[](size_t s) { return memdebug_operator_new_A(s); } void operator delete[](void *p) { memdebug_operator_delete_A(p); } memdebug0.1/src/memdebug/memdebug.c0100644000175200017560000004237307034311542017654 0ustar stephensstephens#ifndef __rcs_id__ #ifndef __rcs_id_util_memdebug_c__ #define __rcs_id_util_memdebug_c__ static const char __rcs_id_util_memdebug_c[] = "$Id: memdebug.c,v 1.2 2000/01/04 06:29:54 stephensk Exp $"; #endif #endif /* __rcs_id__ */ #ifdef MEMDEBUG #undef MEMDEBUG #endif #include "memdebug.h" #include #include #include #include #include #include /* getpid() */ #ifdef malloc #undef malloc #endif #ifdef realloc #undef realloc #endif #ifdef free #undef free #endif #ifdef calloc #undef calloc #endif /************************************************************************/ #ifdef MEMDEBUG_INTERLOPER /* ** Compile MEMDEBUG_INTERLOPER in here redefining it to something ** that memdebug_* can call for allocation. */ #define malloc _mdi_malloc #define _real_malloc _mdi_malloc #define realloc _mdi_realloc #define _real_realloc _mdi_realloc #define free _mdi_free #define _real_free _mdi_free #define calloc _mdi_calloc #define memalign _mdi_memalign #define valloc _mdi_valloc /* For gmalloc.c */ #define _MALLOC_INTERNAL #ifdef __STDC__ #undef __STDC__ #define __STDC__ 1 #endif #ifndef MEMDEBUG_INTERLOPER_C #include "gmalloc.c" #else #include MEMDEBUG_INTERLOPER_C #endif /* ** memdebug_* now uses MEMDEBUG_INTERLOPER for allocation */ #ifdef malloc #undef malloc #endif #ifdef realloc #undef realloc #endif #ifdef free #undef free #endif #ifdef calloc #undef calloc #endif #ifdef memalign #undef memalign #endif #ifdef valloc #undef valloc #endif /* ** Make memdebug_malloc malloc, etc. */ #define memdebug_malloc malloc #define memdebug_realloc realloc #define memdebug_free free #define memdebug_calloc calloc #define memdebug_valloc valloc #define memdebug_memalign memalign #endif #ifdef const #undef const #endif #ifndef _real_malloc #define _real_malloc malloc #endif #ifndef _real_free #define _real_free free #endif #ifndef _real_realloc #define _real_realloc realloc #endif /************************************************************************/ size_t memdebug_blocks = 0; size_t memdebug_bytes = 0; size_t memdebug_blocks_total = 0; size_t memdebug_bytes_total = 0; size_t memdebug_blocks_max = 0; size_t memdebug_bytes_max = 0; typedef struct line_info { const char *file; unsigned short line; } line_info; typedef struct memdebug_blk { struct memdebug_blk *next, *prev; line_info li; unsigned char in_use; unsigned char stop_on_error; unsigned short routine; unsigned long id; size_t size; unsigned long hash; double data[1]; /*unsigned long hash_after*/ } memdebug_blk; #define memdebug_blk_PTR(b) ((char*)((b)->data)) #define memdebug_blk_OFFSET ((size_t)&((memdebug_blk*)0)->data) #define memdebug_blk_SIZE (memdebug_blk_OFFSET+sizeof(unsigned long)) #define PTR_memdebug_blk(p) ((void*)(((char*) ptr) - memdebug_blk_OFFSET)) #define memdebug_blk_HASH(b,X) (((unsigned long)(b) << 3) ^ ((unsigned long)(b) >> 7) ^ (b->size) ^ (X)) #define memdebug_blk_BEFORE(b) (b)->hash #define memdebug_blk_AFTER(b) (*(unsigned long*) (memdebug_blk_PTR(b) + (b)->size)) #define memdebug_blk_IS_FREE(b) (! (b)->in_use) #define memdebug_blk_INIT(b,SIZE) \ (b)->size = (SIZE); \ (b)->li.file = file; \ (b)->li.line = line; \ (b)->stop_on_error = 0; \ memdebug_blk_BEFORE(b) = memdebug_blk_HASH(b,0); \ { unsigned long h = memdebug_blk_HASH(b, (b)->size); \ memcpy(&memdebug_blk_AFTER(b), &h, sizeof(h)); } static memdebug_blk live_blocks = { &live_blocks, &live_blocks }; static memdebug_blk free_blocks = { &free_blocks, &free_blocks }; #define memdebug_blk_LOOP(e,b) do{ memdebug_blk *_##b = (e)->next; while ( _##b != (e) ) { memdebug_blk *b = _##b; _##b = _##b->next; { #define memdebug_blk_LOOP_END }}}while(0) /********************************************************************/ enum memdebug_routines { mdr_malloc = 0, mdr_free, mdr_realloc, mdr_calloc, mdr_memalign, mdr_valloc, mdr_operator_new, mdr_operator_delete, mdr_operator_new_A, mdr_operator_delete_A, mdr_LAST }; static char *memdebug_routine_names[] = { "malloc", "free", "realloc", "calloc", "memalign", "valloc", "operator new", "operator delete", "operator new[]", "operator delete[]", 0 }; /********************************************************************/ int memdebug_keep_free_blocks = 0; static void memdebug_blk_insert_after(memdebug_blk *b, memdebug_blk *e) { e->next->prev = b; b->prev = e; b->next = e->next; e->next = b; } static void memdebug_blk_remove(memdebug_blk *b) { b->prev->next = b->next; b->next->prev = b->prev; } static void memdebug_blk_HASH_FREE(memdebug_blk *b) { size_t i; for ( i = sizeof(line_info); i + sizeof(unsigned long) <= b->size ; i += sizeof(unsigned long) ) { *(unsigned long*) (memdebug_blk_PTR(b) + i) = memdebug_blk_HASH(b, i); } } /********************************************************************/ /* logging */ FILE *memdebug_output = 0; /* stderr */ const char *memdebug_output_prefix = "\tMEMDEBUG: "; int memdebug_log_procid = 1; static void vssprintf(char **s, const char *format, va_list *vap) { vsprintf(*s, format, *vap); *s = strchr(*s, '\0'); } static void ssprintf(char **s, const char *format, ...) { va_list(vap); va_start(vap, format); vssprintf(s, format, &vap); va_end(vap); } static void msg(memdebug_blk *b, const char *format, ...) { char buf[1024]; char *_s = buf, **s = &_s; va_list(vap); if ( format[0] == '\n' ) { ssprintf(s, "\n"); format ++; } ssprintf(s, "%s", memdebug_output_prefix); if ( memdebug_log_procid ) ssprintf(s, "%d: ", getpid()); if ( b ) { ssprintf(s, "%lu: ", (unsigned long) b->id); ssprintf(s, "%p[%lu]: ", b->data, b->size); if ( b->li.line ) { ssprintf(s, "%s:%d: ", b->li.file ? b->li.file : "" , b->li.line); } else { ssprintf(s, "%p: ", b->li.file); } ssprintf(s, "%s: ", b->routine < mdr_LAST ? memdebug_routine_names[b->routine] : "" ); if ( ! b->in_use ) { line_info *li = (void*) memdebug_blk_PTR(b); ssprintf(s, "freed at "); if ( li->line ) { ssprintf(s, "%s:%d: ", li->file ? li->file : "", li->line); } else { ssprintf(s, "%p: ", li->file); } } } va_start(vap, format); vssprintf(s, format, &vap); va_end(vap); if ( ! memdebug_output ) { memdebug_output = stderr; } fwrite(buf, 1, strlen(buf), memdebug_output); fflush(memdebug_output); } int memdebug_log_each_alloc = 0; /********************************************************************/ /* block validation */ /* Set a debugger breakpoint here to catch all blk with bounds overwritten */ void memdebug_blk_invalid(memdebug_blk *b) { /* Nothing */ } /* Set a debugger breakpoint here to catch freed blks that are modified. */ void memdebug_free_blk_modified(memdebug_blk *b) { /* Nothing */ } static int memdebug_blk_CHECK(memdebug_blk *b) { int faults = 0; if ( memdebug_blk_BEFORE(b) != memdebug_blk_HASH(b,0) ) { msg(b, "invalid before hash\n"); memdebug_blk_invalid(b); faults ++; } if ( ! (memdebug_blk_IS_FREE(b) && b->size < sizeof(line_info)) ) { unsigned long h = memdebug_blk_HASH(b,(b)->size); if ( memcmp(&memdebug_blk_AFTER(b), &h, sizeof(h)) != 0 ) { msg(b, "invalid after hash\n"); memdebug_blk_invalid(b); faults ++; } } if ( memdebug_keep_free_blocks && memdebug_blk_IS_FREE(b) ) { size_t i; int lfaults = 0; for ( i = sizeof(line_info); i + sizeof(unsigned long) <= b->size; i += sizeof(unsigned long) ) { if ( *(unsigned long*) (memdebug_blk_PTR(b) + i) != memdebug_blk_HASH(b, i) ) { msg(b, "modified at %lu\n", i); lfaults ++; } } if ( lfaults ) { memdebug_free_blk_modified(b); } faults += lfaults; } return faults; } /********************************************************************/ /* Pointer validation */ unsigned long memdebug_stop_on_id = 0; size_t memdebug_stop_on_size_limit = 0; /* Set a debugger breakpoint here to catch all bad pointers */ void memdebug_stop(memdebug_blk *b) { } int memdebug_validate_ptrs = 1; /* Set a debugger breakpoint here to catch all bad pointers */ void memdebug_ptr_invalid(void *ptr) { /* Nothing */ } int memdebug_ptr_valid(void *ptr, const char *routine) { memdebug_blk_LOOP(&live_blocks, b); { memdebug_blk_CHECK(b); if ( memdebug_blk_PTR(b) == ptr ) { return 0; } if ( memdebug_blk_PTR(b) < (char*) ptr && (char*) ptr < memdebug_blk_PTR(b) + b->size ) { msg(b, "\n%s: Interior ptr %p\n", routine, ptr); memdebug_ptr_invalid(ptr); return 1; } } memdebug_blk_LOOP_END; msg(0, "\n%s: Bad ptr %p\n", routine, ptr); memdebug_ptr_invalid(ptr); return 2; } int memdebug_check_live_always = 1; int memdebug_stats_every_checks = 0; void memdebug_check_live() { static unsigned long nchecks = 0; int faults = 0; ++ nchecks; if ( memdebug_stats_every_checks && (nchecks % memdebug_stats_every_checks == 0) ) { msg(0, "\ncheck id %lu", nchecks); memdebug_stats(); } else { memdebug_blk_LOOP(&live_blocks, b); { faults += memdebug_blk_CHECK(b); } memdebug_blk_LOOP_END; memdebug_blk_LOOP(&free_blocks, b); { faults += memdebug_blk_CHECK(b); } memdebug_blk_LOOP_END; if ( faults ) { msg(0, " %lu faults.\n\n", faults); } } } /********************************************************************/ /* free list allocation */ int memdebug_use_free_list = 1; memdebug_blk *memdebug_free_list_alloc(size_t s) { memdebug_blk_LOOP(&free_blocks, b); { memdebug_blk_CHECK(b); if ( b->size == s ) { memdebug_blk_remove(b); return b; } } memdebug_blk_LOOP_END; return 0; } /********************************************************************/ /* init */ static void memdebug_atexit() { msg(0, "\nat exit()"); memdebug_stats(); } static int memdebug_inited = 0; static void memdebug_init_() { memdebug_inited ++; atexit(memdebug_atexit); } #define memdebug_init() if ( ! memdebug_inited ) { memdebug_init_(); } /********************************************************************/ /* internal malloc/free */ static unsigned long memdebug_alloc_id = 0; void *memdebug_malloc__ (size_t s, const char *file, int line, int routine) { memdebug_blk *b = 0; memdebug_init(); if ( memdebug_check_live_always ) { memdebug_check_live(); } /* accounting */ memdebug_blocks ++; if ( memdebug_blocks_max < memdebug_blocks ) memdebug_blocks_max = memdebug_blocks; memdebug_blocks_total ++; memdebug_bytes += s; if ( memdebug_bytes_max < memdebug_bytes ) memdebug_bytes_max = memdebug_bytes; memdebug_bytes_total += s; if ( memdebug_stop_on_size_limit && s > memdebug_stop_on_size_limit ) { memdebug_stop(0); } if ( memdebug_use_free_list ) { b = memdebug_free_list_alloc(s); } if ( ! b ) { b = (void*) _real_malloc ((s > sizeof(line_info) ? s : sizeof(line_info)) + memdebug_blk_SIZE); } b->in_use = 1; b->routine = routine; b->id = ++ memdebug_alloc_id; memdebug_blk_INIT(b, s); memdebug_blk_insert_after(b, &live_blocks); if ( memdebug_log_each_alloc ) { msg(b, "ALLOC\n"); } if ( b->id == memdebug_stop_on_id ) { memdebug_stop(b); } return b->data; } void memdebug_free__ (void *ptr, const char *file, int line, int routine) { line_info *li = ptr; memdebug_blk *b; memdebug_init(); if ( memdebug_check_live_always ) { memdebug_check_live(); } if ( ! ptr ) { return; } if ( memdebug_validate_ptrs ) { if ( memdebug_ptr_valid(ptr, "free") ) return; } b = PTR_memdebug_blk(ptr); if ( b->id == memdebug_stop_on_id ) { memdebug_stop(b); } if ( ! b->in_use ) { msg(b, "already freed\n"); abort(); } memdebug_blk_CHECK(b); if ( memdebug_log_each_alloc ) { msg(b, "DEALLOC\n"); } /* accounting */ assert(memdebug_blocks > 0); memdebug_blocks --; assert(memdebug_bytes >= b->size); memdebug_bytes -= b->size; b->in_use = 0; li->file = file; li->line = line; memdebug_blk_remove(b); if ( memdebug_keep_free_blocks || memdebug_use_free_list ) { memdebug_blk_HASH_FREE(b); memdebug_blk_insert_after(b, &free_blocks); } else { _real_free (b); } } /********************************************************************/ /* Versions with line_info */ void *memdebug_malloc_ (size_t s, const char *file, int line) { return memdebug_malloc__(s, file, line, mdr_malloc); } void memdebug_free_ (void *ptr, const char *file, int line) { memdebug_free__ (ptr, file, line, mdr_free); } void *memdebug_realloc_ (void *ptr, size_t s, const char *file, int line) { memdebug_blk *b = PTR_memdebug_blk(ptr); unsigned long prev_id; if ( ! ptr ) return memdebug_malloc__ (s, file, line, mdr_realloc); prev_id = b->id; if ( memdebug_check_live_always ) { memdebug_check_live(); } if ( memdebug_validate_ptrs ) { if ( memdebug_ptr_valid(ptr, "realloc") ) return memdebug_malloc_(s, file, line); } memdebug_blk_CHECK(b); assert(memdebug_blocks > 0); memdebug_blocks --; assert(memdebug_bytes >= b->size); memdebug_bytes -= b->size; memdebug_blk_remove(b); memdebug_bytes_total -= b->size; b = (void*) _real_realloc (b, (s > sizeof(line_info) ? s : sizeof(line_info)) + memdebug_blk_SIZE); memdebug_blocks ++; memdebug_bytes += s; memdebug_bytes_total += s; b->in_use = 1; b->id = prev_id; memdebug_blk_INIT(b, s); memdebug_blk_insert_after(b, &live_blocks); if ( memdebug_log_each_alloc ) { msg(b, "REALLOC\n"); } return b->data; } void *memdebug_calloc_ (size_t s1, size_t s2, const char *file, int line) { void *p; s1 *= s2; p = memdebug_malloc__ (s1, file, line, mdr_calloc); memset(p, 0, s1); return p; } void *memdebug_memalign_ (size_t s1, size_t s2, const char *file, int line) { abort(); return 0; } void *memdebug_valloc_ (size_t s1, const char *file, int line) { abort(); return 0; } void *memdebug_operator_new_ (size_t s, const char *file, int line) { return memdebug_malloc__(s, file, line, mdr_operator_new); } void memdebug_operator_delete_ (void *ptr, const char *file, int line) { memdebug_free__ (ptr, file, line, mdr_operator_delete); } void *memdebug_operator_new_A_ (size_t s, const char *file, int line) { return memdebug_malloc__(s, file, line, mdr_operator_new_A); } void memdebug_operator_delete_A_ (void *ptr, const char *file, int line) { memdebug_free__ (ptr, file, line, mdr_operator_delete_A); } /*********************************************************************/ /* Versions without line_info */ #ifndef __ptr_t #define __ptr_t void * #endif #ifdef SOLARIS /* SAVED_FP RETURN_ADDR s SECOND_ARG ... */ #define GET_RETURN_ADDR(s) ((void**)&s)[-2] #endif #ifndef GET_RETURN_ADDR /* SAVED_FP RETURN_ADDR s SECOND_ARG ... */ #define GET_RETURN_ADDR(s) ((void**)&s)[-1] #endif __ptr_t memdebug_malloc (size_t s) { return memdebug_malloc_ (s, GET_RETURN_ADDR(s), 0); } void memdebug_free (__ptr_t p) { memdebug_free_ (p, GET_RETURN_ADDR(p), 0); } __ptr_t memdebug_realloc (__ptr_t p, size_t s) { return memdebug_realloc_ (p, s, GET_RETURN_ADDR(p), 0); } __ptr_t memdebug_calloc (size_t s1, size_t s2) { return memdebug_calloc_ (s1, s2, GET_RETURN_ADDR(s1), 0); } __ptr_t memdebug_memalign (size_t s1, size_t s2) { return memdebug_memalign_ (s1, s2, GET_RETURN_ADDR(s1), 0); } __ptr_t memdebug_valloc (size_t s1) { return memdebug_valloc_ (s1, GET_RETURN_ADDR(s1), 0); } __ptr_t memdebug_operator_new (size_t s) { return memdebug_operator_new_ (s, GET_RETURN_ADDR(s), 0); } void memdebug_operator_delete (__ptr_t p) { memdebug_operator_delete_ (p, GET_RETURN_ADDR(p), 0); } __ptr_t memdebug_operator_new_A (size_t s) { return memdebug_operator_new_A_ (s, GET_RETURN_ADDR(s), 0); } void memdebug_operator_delete_A (__ptr_t p) { memdebug_operator_delete_A_ (p, GET_RETURN_ADDR(p), 0); } /**********************************************************************/ /* statistics */ void memdebug_stats() { int faults = 0; msg(0, "\nblocks %lu, bytes %lu: bytes/block %g in use\n", (unsigned long) memdebug_blocks, (unsigned long) memdebug_bytes, (double) memdebug_bytes / (double) memdebug_blocks); msg(0, "blocks %lu, bytes %lu: bytes/block %g max\n", (unsigned long) memdebug_blocks_max, (unsigned long) memdebug_bytes_max, (double) memdebug_bytes_max / (double) memdebug_blocks_max); msg(0, "blocks %lu, bytes %lu: bytes/block %g total\n", (unsigned long) memdebug_blocks_total, (unsigned long) memdebug_bytes_total, (double) memdebug_bytes_total / (double) memdebug_blocks_total); fflush(memdebug_output); { unsigned long n; size_t s; msg(0, "scanning live blocks:\n"); s = n = 0; memdebug_blk_LOOP(&live_blocks, b); { faults += memdebug_blk_CHECK(b); n ++; s += b->size; } memdebug_blk_LOOP_END; msg(0, " %lu (%lu bytes) DONE.\n", n, s); msg(0, "scanning free blocks:\n"); n = s = 0; memdebug_blk_LOOP(&free_blocks, b); { faults += memdebug_blk_CHECK(b); n ++; s += b->size; } memdebug_blk_LOOP_END; msg(0, " %lu (%lu bytes) DONE.\n", n, s); } msg(0, " %lu faults.\n\n", faults); } /**********************************************************************/ /* EOF */ memdebug0.1/src/memdebug/memdebug.h0100644000175200017560000000530207034302664017655 0ustar stephensstephens#ifndef _util_memdebug_h #define _util_memdebug_h #ifndef __rcs_id__ #ifndef __rcs_id_util_memdebug_h__ #define __rcs_id_util_memdebug_h__ static const char __rcs_id_util_memdebug_h[] = "$Id: memdebug.h,v 1.1 2000/01/04 05:31:32 stephensk Exp $"; #endif #endif /* __rcs_id__ */ #ifdef MEMDEBUG #include /* size_t */ #ifdef malloc #undef malloc #endif #define malloc(X) memdebug_malloc_(X,__FILE__,__LINE__) #ifdef realloc #undef realloc #endif #define realloc(X,Y) memdebug_realloc_(X,Y,__FILE__,__LINE__) #ifdef free #undef free #endif #define free(X) memdebug_free_(X,__FILE__,__LINE__) #ifdef valloc #undef valloc #endif #define valloc(X) memdebug_valloc_(X,__FILE__,__LINE__) #ifdef memalign #undef memalign #endif #define memalign(X,Y) memdebug_memalign_(X,Y,__FILE__,__LINE__) #ifdef calloc #undef calloc #endif #define calloc(X,Y) memdebug_calloc_(X,Y,__FILE__,__LINE__) #else #include #endif #ifdef __cplusplus extern "C" { #endif extern size_t memdebug_blocks, memdebug_bytes; /* Current live block/bytes. */ extern size_t memdebug_blocks_total, memdebug_bytes_total; /* Total blocks/bytes allocated since start. */ extern int memdebug_keep_free_blocks; /* Never actually free blocks */ extern int memdebug_log_each_alloc; /* Log each allocation/reallocation/free. */ extern unsigned long memdebug_stop_on_id; extern size_t memdebug_stop_on_size_limit; extern int memdebug_validate_ptrs; extern int memdebug_check_live_always; extern int memdebug_stats_every_checks; /* Versions without line info. */ void *memdebug_malloc(size_t s); void memdebug_free(void *p); void *memdebug_realloc(void *p, size_t s); void *memdebug_calloc(size_t s1, size_t s2); void *memdebug_memalign(size_t s1, size_t s2); void *memdebug_valloc(size_t s); /* C++ support */ void *memdebug_operator_new(size_t s); void memdebug_operator_delete(void *p); void *memdebug_operator_new_A(size_t s); void memdebug_operator_delete_A(void *p); /* Versions with line info. */ void *memdebug_malloc_(size_t s, const char *file, int line); void memdebug_free_(void *p, const char *file, int line); void *memdebug_realloc_(void *p, size_t s, const char *file, int line); void *memdebug_calloc_(size_t s1, size_t s2, const char *file, int line); void *memdebug_memalign_(size_t s1, size_t s2, const char *file, int line); void *memdebug_valloc_(size_t s, const char *file, int line); /* C++ support */ void *memdebug_operator_new_(size_t s, const char *file, int line); void memdebug_operator_delete_(void *p, const char *file, int line); void *memdebug_operator_new_A_(size_t s, const char *file, int line); void memdebug_operator_delete_A_(void *p, const char *file, int line); void memdebug_stats(); #ifdef __cplusplus } #endif #endif memdebug0.1/src/memdebug/PKG0100664000175200017560000000034007364161441016264 0ustar stephensstephensNAME=memdebug VERSION=0.1 RCS_ID="$Id: PKG,v 1.1 2001/10/20 02:36:17 stephens Exp $" DESC="A malloc() replacement for debugging" CHANGES_RELEASES="0.1" CATEGORY="Development Tools" REQUIRES_PKGS="../maks" REQUIRES_OTHERS="" memdebug0.1/src/maks/0042755000175200017560000000000007326751162015077 5ustar stephensstephensmemdebug0.1/src/maks/CVS/0042755000175200017560000000000007336072176015534 5ustar stephensstephensmemdebug0.1/src/maks/CVS/Root0100664000175200017560000000006107336072176016374 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/maks/CVS/Repository0100644000175200017560000000002207236675452017630 0ustar stephensstephenshome/ion/src/maks memdebug0.1/src/maks/CVS/Entries0100644000175200017560000000056207262562005017057 0ustar stephensstephens/fixpound.pl/1.2/Fri Feb 19 09:26:01 1999// /tool.mak/1.7/Tue Mar 21 08:21:48 2000// /tools.mak/1.5/Thu Sep 9 04:59:21 1999// D/bin//// D/opengl//// D/os//// D/win32//// /PKG/1.2/Tue Apr 3 18:51:56 2001// /lib.mak/1.6/Tue Apr 3 18:51:56 2001// /pre.mak/1.10/Tue Apr 3 18:51:56 2001// /use.mak/1.4/Tue Apr 3 18:51:56 2001// /basic.mak/1.9/Wed Apr 4 09:09:10 2001// memdebug0.1/src/maks/bin/0042755000175200017560000000000007326751162015647 5ustar stephensstephensmemdebug0.1/src/maks/bin/CVS/0042755000175200017560000000000007336072176016304 5ustar stephensstephensmemdebug0.1/src/maks/bin/CVS/Root0100664000175200017560000000006107336072176017144 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/maks/bin/CVS/Repository0100644000175200017560000000002607236675452020404 0ustar stephensstephenshome/ion/src/maks/bin memdebug0.1/src/maks/bin/CVS/Entries0100644000175200017560000000011607236675452017636 0ustar stephensstephens/mak/1.2/Mon Jun 28 14:03:33 1999// /mak.bat/1.3/Mon Jun 28 14:03:33 1999// D memdebug0.1/src/maks/bin/mak0100644000175200017560000000064206735700265016340 0ustar stephensstephens#!/bin/sh HOME=`cd "$HOME" && pwd` if [ -z "$DEV_ROOT" ] then DEV_ROOT="${HOME}/src" fi DEV_ROOT=`cd "$DEV_ROOT" && pwd` export DEV_ROOT if [ -z "$MAKS" ] then MAKS='/home/stephens/src/maks' fi MAKS=`cd "$MAKS" && pwd` export MAKS if [ -z "$MAKE_ARCH" ] then MAKE_ARCH=`uname` fi export MAKE_ARCH echo "HOME=$HOME" echo "DEV_ROOT=$DEV_ROOT" echo "MAKS=$MAKS" echo "MAKE_ARCH=$MAKE_ARCH" exec make ${1+"$@"} memdebug0.1/src/maks/bin/mak.bat0100644000175200017560000000015206735700265017101 0ustar stephensstephens@REM $Id: mak.bat,v 1.3 1999/06/28 14:03:33 stephensk Exp $ @sh %MAKS%\bin\mak %1 %2 %3 %4 %5 %6 %7 %8 %9 memdebug0.1/src/maks/PKG0100744000175200017560000000031607262415714015436 0ustar stephensstephensNAME=maks VERSION=0.2 DESC="A Makefile library. Handles automatic header file dependencies and interpackage dependencies." CATEGORY="Development Tools" REQUIRES_PKGS="../bin" REQUIRES_OTHERS="gnumake sh" memdebug0.1/src/maks/basic.mak0100744000175200017560000001046707262562266016662 0ustar stephensstephens# $Id: basic.mak,v 1.9 2001/04/04 09:09:10 stephens Exp $ Makefile=Makefile Makefile.use=Makefile.use ########################################################################## # Suffix translation rules # SWIG SWIG.swig=swig $(SWIG_C_FILES_GEN) : $(GEN_FILE_DIR)/$(notdir %)_swig$(c) : %$(swig) $(foreach w,$(SWIG_WRAPPER),$(SWIG.swig) -$w $(SWIG_WRAPPER_$w) -o $(GEN_FILE_DIR)/$(notdir $*)_swig_$(w)$(c) $<;) touch $(GEN_FILE_DIR)/$(notdir $*)_swig$(c) # C %$(c):%$(o) $(C_O_FILES_GEN) : $(O_FILE_DIR)/$(notdir %)$(o) : %$(c) $(COMPILE.c) $< -o $(O_FILE_DIR)/$(notdir $*)$(o) $(C_GEN_O_FILES_GEN) : $(O_FILE_DIR)/%$(o) : $(GEN_FILE_DIR)/%$(c) $(COMPILE.c) $< -o $(O_FILE_DIR)/$*$(o) # C++ %$(cc):%$(o) $(CC_O_FILES_GEN) : $(O_FILE_DIR)/$(notdir %)$(o) : %$(cc) $(COMPILE.cc) $< -o $(O_FILE_DIR)/$(notdir $*)$(o) # yacc %$(y):%$(o) %$(y):%$(c) ifeq "$(strip $(MACHTYPE))" "i586-pc-cygwin32" YACC+= -S '$(CYGFS)/share/bison.simple' else YACC=bison --yacc endif $(Y_C_FILES_GEN) : $(GEN_FILE_DIR)/$(notdir %)$(c) : %.y $(CP) $*$(y) $(GEN_FILE_DIR)/$(notdir $*)$(y) cd $(GEN_FILE_DIR) && $(YACC) -d $(notdir $*)$(y) $(MV) $(GEN_FILE_DIR)/y.tab.c $(GEN_FILE_DIR)/$(notdir $*)$(c) $(MV) $(GEN_FILE_DIR)/y.tab.h $(GEN_FILE_DIR)/$(notdir $*).yh # Java ifneq "$(strip $(JAVA_FILES_ALL))" "" ifeq "$(strip $(JAVA_TIMESTAMP))" "" JAVA_TIMESTAMP=$(JAVA_CLASS_FILE_DIR)/../.jc endif $(JAVA_TIMESTAMP) : $(JAVA_FILES_ALL) '$(JAVAC)' $(JAVACFLAGS) -d $(JAVA_CLASS_FILE_DIR) $(JAVA_FILES_ALL) $(TOUCH) $@ PRODUCTS+=$(JAVA_TIMESTAMP) GARBAGE_DIRS+=$(JAVA_CLASS_FILE_DIR) endif #DIRS += $(GEN_FILE_DIR) ########################################################################## EARLY_TARGETS+= USE_ALL DIRS $(Y_C_FILES_GEN) DEPS ########################################################################## all : $(EARLY_TARGETS) $(PRODUCTS) $(TARGETS) @$(MSG) Made $@ ########################################################################## # Autodependencies # Header deps #$(O_FILES_GEN) : $(H_FILES) DEP_FILE_DIR:=$(O_FILE_DIR) make_dep = $(ECHO) "Making include deps for $<"; $(SHELL) -ec 'o="$(notdir $*)$(o)"; od="$(O_FILE_DIR)/$$o"; d="$(DEP_FILE_DIR)/$(notdir $*).d"; $(CC) -MM $(CPPFLAGS) $< | sed -e "s@$$o[ ]*:@$$od : $(Makefile) $(Makefile.use) @g" > $$d; [ -s $$d ] || rm -f $$d' C_D_FILES += $(_C_FILES_ALL:%.c=$(DEP_FILE_DIR)/$(notdir %).d) $(C_D_FILES) : $(DEP_FILE_DIR)/$(notdir %).d : %.c $(make_dep) CC_D_FILES += $(_CC_FILES_ALL:%.cc=$(DEP_FILE_DIR)/$(notdir %).d) $(CC_D_FILES) : $(DEP_FILE_DIR)/$(notdir %).d : %.cc @$(make_dep) DEPS+= $(C_D_FILES) $(CC_D_FILES) # Disable deps DEPS:= DEPS : DIRS $(DEPS) .PHONY : DEPS GARBAGE+= $(DEPS) GENERATED_DIRS+= $(DEP_FILE_DIR) GARBAGE_DIRS+= $(DEP_FILE_DIR) ifeq "$(strip $(__DISABLE_DEPS__))" "" EARLY_TARGETS+= DEPS ifneq "$(strip $(DEPS))" "" $(DEPS) : $(DEP_FILE_DIR) -include $(DEPS) endif endif ########################################################################## # Use USE_ALL : @for f in $(USE_ALL) . ; \ do \ [ "$$f" = . ] && break; \ $(ECHO) "Using '$$f'" ;\ $(MAKE) -C "$$f" > /dev/null ; \ done .PHONY : USE_ALL ########################################################################## # Directories DIRS+= $(GENERATED_DIRS) $(OUTPUT_DIRS) DIRS:=$(sort $(DIRS)) $(DIRS) : $(MKDIRS) $@ DIRS : $(DIRS) .PHONY : DIRS ########################################################################## # Clean GARBAGE += $(O_FILES_GEN) GARBAGE += $(C_FILES_GEN) GARBAGE += $(PRODUCTS) GARBAGE += core *.core #GARBAGE += *.o clean : rm -f $(filter-out .,$(sort $(GARBAGE))) rm -rf $(filer-out .,$(sort $(GARBAGE_DIRS))) @$(MSG) Made $@ cleanproducts : rm -f $(PRODUCTS) veryclean : clean rm -rf $(filter-out .,$(sort $(GENERATED_DIRS) $(GARBAGE_VERY_DIRS))) @$(MSG) Made $@ archiveclean : veryclean @$(MSG) Made $@ .PHONY : clean veryclean archiveclean cleanproducts ########################################################################## # Archive archive : tgz tgz : archiveclean pwd=`pwd`;dname=`basename $$pwd`;cd ..; $(TAR) -cvf - "$$dname" | $(GZIP) > "$$dname.tgz" .PHONY : archive tgz ######################################################################### # Variable make ifdef vm _vm : $(foreach f,$(vm), $($(f))) @$(MSG) Made $(vm): $< .PHONY : _vm endif ########################################################################## # EOF memdebug0.1/src/maks/fixpound.pl0100644000175200017560000000025406663227051017262 0ustar stephensstephens# $Id: fixpound.pl,v 1.2 1999/02/19 09:26:01 stephensk Exp $ while ( <> ) { chop; if ( /^#/ ) { print "/* ", $_, "*/\n"; } else { print $_, "\n"; } } memdebug0.1/src/maks/lib.mak0100744000175200017560000000430607262415714016335 0ustar stephensstephens# $Id: lib.mak,v 1.6 2001/04/03 18:42:08 stephens Exp $ # # Usage: # # LIB_NAME:= # include $(MAKS)/lib.mak # # Adds targets to create a library named LIB_NAME from LIB_O_FILES. # LIB_O_FILES defaults to O_FILES. # ############################################################## # Defaults LIB_PREFIX:=lib# LIB_SUFFIX:=.a# LIB:=$(LIB_DIR)/$(LIB_PREFIX)$(LIB_NAME)$(LIB_SUFFIX)# ifeq "$(strip $(LIB_O_FILES))" "" LIB_O_FILES:=$(O_FILES)# endif ifeq "$(strip $(LIB_LIB_FLAGS))" "" LIB_LIB_FLAGS:=$(LIB_FLAGS) endif ifeq "$(strip $(LIB_LIBS))" "" LIB_LIBS:=$(LIBS) endif ############################################################## # Target ifneq "$(strip $(LIB_DYNAMIC))" "" LIB_DLL_SUFFIX=.dll# LIB_DLL:=$(LIB_DIR)/$(LIB_NAME)$(LIB_DLL_SUFFIX)# LIB_DLL_DEF:=$(LIB_DIR)/$(LIB_NAME).def# ifneq "$(strip $(SWIG2DEF))" "" LIB_SWIG2DEF:=perl $(MAKS)/../bin/swig2def.pl $(SWIG2DEF) > $(LIB_DLL_DEF)# LIB_DEF:=--def $(LIB_DLL_DEF)# else LIB_SWIG2DEF:=true# LIB_DEF:=--output-def $(LIB_DLL_DEF)# endif $(LIB_DLL) $(LIB) : $(LIB_O_FILES) $(LIB_SWIG2DEF) dllwrap --verbose --output-lib $(LIB) $(LIB_DEF) --dllname $(LIB_DLL) $(LIB_O_FILES) $(LIB_LIB_FLAGS) $(foreach l,$(LIB_LIBS),-l'$(l)') else LIB_DLL:=# $(LIB) : $(LIB_O_FILES) -$(RM) $@ $(AR) cr $@ $(LIB_O_FILES) endif $(LIB_DLL) $(LIB) : LIB:=$(LIB) $(LIB_DLL) $(LIB) : LIB_O_FILES:=$(LIB_O_FILES) $(LIB_DLL) $(LIB) : LIB_DLL:=$(LIB_DLL) $(LIB_DLL) $(LIB) : LIB_DLL_DEF:=$(LIB_DLL_DEF) $(LIB_DLL) $(LIB) : LIB_SWIG2DEF:=$(LIB_SWIG2DEF) $(LIB_DLL) $(LIB) : LIB_DEF:=$(LIB_DEF) $(LIB_DLL) $(LIB) : LIB_LIB_FLAGS:=$(LIB_LIB_FLAGS) $(LIB_DLL) $(LIB) : LIB_LIBS:=$(LIB_LIBS) ############################################################## # Alias .PHONY : $(LIB_NAME) $(LIB_NAME) : $(LIB) ############################################################## # Exports LOCAL_LIBS:=$(LOCAL_LIBS) $(LIB)# LIB_PRODUCTS:=$(LIB_PRODUCTS) $(LIB) $(LIB_DLL)# PRODUCTS:=$(PRODUCTS) $(LIB) $(LIB_DLL)# libs :: $(LIB_PRODUCTS) @$(MSG) Made $@: $(LIB_PRODUCTS) .PHONY : libs ############################################################## # Reset vars LIB:=# LIB_NAME:=# LIB_O_FILES:=# LIB_DLL:=# SWIG2DEF:=# ############################################################## # EOF memdebug0.1/src/maks/pre.mak0100744000175200017560000001501307262415714016352 0ustar stephensstephens# $Id: pre.mak,v 1.10 2001/03/17 20:20:04 stephens Exp $ include $(MAKS)/tools.mak ######################################################################### # Variable query ifdef v _v : @$(foreach f,$(v),$(ECHO) "$(f)='$($(f))'"; ) .PHONY : _v endif ######################################################################### # Variable make ifdef vm _vm : endif ######################################################################### # Default targets all : .PHONY : all clean ######################################################################### # Build Options ifndef DEBUG DEBUG=YES endif export DEBUG ifndef OPTIMIZE OPTIMIZE=NO endif export OPTIMIZE ######################################################################### # Disable RCS and SCCS get % : %,v % : RCS/%,v % : s.% % : SCCS/s.% %.mak : %.use : Makefile : ######################################################################### # Config CWD=$(shell pwd) export CWD ifeq "$(strip $(MAKE_ARCH))" "" MAKE_ARCH:=$(shell uname) export MAKE_ARCH endif ifeq "$(strip $(DEV_ROOT))" "" DEV_ROOT:=$(HOME) export DEV_ROOT endif #DEV_ROOT:=$(strip $(shell cd "$(DEV_ROOT)" && pwd)) ######################################################################### # Directories # libraries go in LIB_DIR ifeq "$(strip $(LIB_DIR))" "" LIB_DIR:=$(DEV_ROOT)/lib/$(MAKE_ARCH) export LIB_DIR endif OUTPUT_DIRS+= $(LIB_DIR) # executables go in TOOL_DIR ifeq "$(strip $(TOOL_DIR))" "" TOOL_DIR:=$(DEV_ROOT)/bin/$(MAKE_ARCH) export TOOL_DIR endif OUTPUT_DIRS+= $(TOOL_DIR) ifeq "$(strip $(GEN_FILE_ROOT))" "" GEN_FILE_ROOT:=mak_gen GARBAGE_VERY_DIRS:=$(GARBAGE_VERY_DIRS) $(GEN_FILE_ROOT) endif # test executables go in TEST_DIR ifeq "$(strip $(TEST_DIR))" "" TEST_DIR:=$(GEN_FILE_ROOT)/$(MAKE_ARCH)/t export TEST_DIR endif OUTPUT_DIRS+= $(TEST_DIR) # object files go in O_FILE_DIR ifeq "$(strip $(O_FILE_DIR))" "" O_FILE_DIR:=$(GEN_FILE_ROOT)/$(MAKE_ARCH)/o export O_FILE_DIR endif #VPATH:=$(VPATH) $(O_FILE_DIR)# # Java class files go in JAVA_CLASS_FILE_DIR ifeq "$(strip $(JAVA_CLASS_FILE_DIR))" "" JAVA_CLASS_FILE_DIR:=$(GEN_FILE_ROOT)/jvm export JAVA_CLASS_FILE_DIR endif ifeq "$(DEBUG)" "YES" JAVACFLAGS+=-g CFLAGS+= $(DEBUG_FLAGS) CXXFLAGS+= $(DEBUG_FLAGS) O_FILE_DIR:=$(strip $(O_FILE_DIR)d) endif ifeq "$(OPTIMIZE)" "YES" JAVACFLAGS+=-O CFLAGS+= $(OPTIMIZE_FLAGS) CXXFLAGS+= $(OPTIMIZE_FLAGS) O_FILE_DIR:=$(strip $(O_FILE_DIR)o) endif GENERATED_DIRS+= $(O_FILE_DIR) # # yacc, lex and other tools put there output in GEN_FILE_DIR ifeq "$(strip $(GEN_FILE_DIR))" "" GEN_FILE_DIR:=$(MAKE_ARCH)/g GEN_FILE_DIR:=$(O_FILE_DIR) export GEN_FILE_DIR endif GENERATED_DIRS+= $(GEN_FILE_DIR) #EARLY_TARGETS+= $(DIRS) # Expect to be using some libs generated by us LIB_DIRS+= $(LIB_DIR) ######################################################################### # Suffixes exe= o=.o c=.c cc=.cc y=.y yy=.yy h=.h hh=.h java=.java class=.class swig=.swig ######################################################################### # Default CC options OPTIMIZE_FLAGS+= -O3 DEBUG_FLAGS+= -g CFLAGS+= -Wall ######################################################################### # Target-specifics include $(MAKS)/os/$(MAKE_ARCH).mak ######################################################################### # BUILD_VARS ifndef BUILD_TARGET export BUILD_TARGET:=$(MAKE_ARCH) endif BUILD_VARS+= BUILD_TARGET ifndef BUILD_DATE export BUILD_DATE:=$(shell date) endif BUILD_VARS+= BUILD_DATE ifndef BUILD_HOST export BUILD_HOST:=$(shell hostname) endif BUILD_VARS+= BUILD_HOST ifndef BUILD_USER export BUILD_USER:=$(USER) endif BUILD_VARS+= BUILD_USER ifndef BUILD_ROOT export BUILD_ROOT:=$(CWD) endif BUILD_VARS+= BUILD_ROOT _DEFINES:= $(foreach v,$(BUILD_VARS),-D'$v="$(${v})"' ) DEFINE_FLAGS:=$(DEFINE_FLAGS) $(_DEFINES) ######################################################################### # BUILD_VARS build_vars_h = $(GEN_FILE_DIR)/build_vars.h build_vars_h : $(dir $(build_vars_h)) $(ECHO) '/* DO NOT MODIFY Generated by maks/pre.mak. */' > $(build_vars_h) $(foreach v,$(BUILD_VARS),$(ECHO) '#define $(v) "$($(v))"' >> $(build_vars_h); ) @$(MSG) Made $@ EARLY_TARGETS+= build_vars_h GARBAGE+= $(build_vars_h) ######################################################################### # Defines DEFINE_FLAGS+= $(foreach f,$(DEFINES), -D'$(f)') ######################################################################### # Includes INCLS+= $(O_FILE_DIR) INCL_FLAGS+= $(foreach f,$(INCLS), -I'$(f)') CPPFLAGS+= $(DEFINE_FLAGS) $(INCL_FLAGS) ######################################################################### # Libs LIB_FLAGS+= $(foreach f,$(LIB_DIRS), -L'$(f)') LIB_FLAGS+= $(foreach f,$(LIBS), -l'$(f)') ######################################################################### # version ######################################################################### # yacc Y_FILES_ALL+= $(Y_FILES) $(Y_FILES_GEN) _Y_FILES_ALL=$(notdir $(Y_FILES_ALL)) Y_C_FILES_GEN+= $(_Y_FILES_ALL:%$(y)=$(GEN_FILE_DIR)/$(notdir %)$(c)) C_FILES_GEN+= $(Y_C_FILES_GEN) ######################################################################### # swig SWIG_WRAPPER=tcl8# SWIG_WRAPPER_tcl8=-namespace -module $(notdir $*) SWIG_FILES_ALL+= $(SWIG_FILES) $(SWIG_FILES_GEN) _SWIG_FILES_ALL=$(notdir $(SWIG_FILES_ALL)) SWIG_C_FILES_GEN+= \ $(_SWIG_FILES_ALL:%$(swig)=$(GEN_FILE_DIR)/$(notdir %)_swig$(c)) SWIG_WRAPPER_C_FILES_GEN+= \ $(foreach w,$(SWIG_WRAPPER),$(_SWIG_FILES_ALL:%$(swig)=$(GEN_FILE_DIR)/$(notdir %)_swig_$(w)$(c))) C_FILES_GEN+= $(SWIG_C_FILES_GEN) $(SWIG_WRAPPER_C_FILES_GEN) ######################################################################### # C C_FILES_ALL+= $(C_FILES)# $(C_FILES_GEN) _C_FILES_ALL=$(notdir $(C_FILES_ALL)) C_O_FILES_GEN+= $(_C_FILES_ALL:%$(c)=$(O_FILE_DIR)/$(notdir %)$(o)) C_GEN_O_FILES_GEN+= $(C_FILES_GEN:%$(c)=%$(o)) O_FILES_GEN+= $(C_O_FILES_GEN) $(C_GEN_O_FILES_GEN) ######################################################################### # C++ CC_FILES_ALL+= $(CC_FILES) $(CC_FILES_GEN) _CC_FILES_ALL=$(notdir $(CC_FILES_ALL)) CC_O_FILES_GEN+= $(_CC_FILES_ALL:%$(cc)=$(O_FILE_DIR)/$(notdir %)$(o)) O_FILES_GEN+= $(CC_O_FILES_GEN) ######################################################################### # Java JAVA_FILES_ALL+= $(JAVA_FILES) $(JAVA_FILES_GEN) _JAVA_FILES_ALL=$(notdir $(JAVA_FILES_ALL)) JAVA_CLASS_FILES_GEN+= $(_JAVA_FILES_ALL:%$(java)=$(CLASS_FILE_DIR)/$(notdir %)$(class)) ######################################################################### # Object files O_FILES+= $(O_FILES_GEN) ######################################################################### # Use -include Makefile.use memdebug0.1/src/maks/tool.mak0100644000175200017560000000316307065630434016542 0ustar stephensstephens# $Id: tool.mak,v 1.7 2000/03/21 08:21:48 stephensk Exp $ ###################################################################### # Defaults TOOL_SUFFIX:=$(exe) _TOOL_DIR:=$(TOOL_DIR) ifneq "$(TOOL_TEST)" "" TOOL_DIR:=$(TEST_DIR) endif TOOL:=$(TOOL_DIR)/$(TOOL_NAME)$(TOOL_SUFFIX) TOOL_DIR:=$(_TOOL_DIR) ifeq "$(strip $(TOOL_MAIN))" "" TOOL_MAIN:=$(TOOL_NAME).c endif ifeq "$(strip $(TOOL_O_FILES))" "" TOOL_O_FILES:=$(TOOL_MAIN) endif TOOL_O_FILES_$(TOOL):=$(TOOL_O_FILES) ifeq "$(strip $(TOOL_LIBS))" "" TOOL_LIBS:=$(LIBS) endif TOOL_LIBS_$(TOOL):=$(TOOL_LIBS) ifeq "$(strip $(TOOL_LIB_FLAGS))" "" TOOL_LIB_FLAGS:=$(LIB_FLAGS) endif TOOL_LIB_FLAGS_$(TOOL):=$(TOOL_LIB_FLAGS) ###################################################################### # Target $(TOOL) : $(TOOL_O_FILES_$(TOOL)) $(LOCAL_LIBS) $(CC) $(CFLAGS) $(CPPFLAGS) -o '$@' $(TOOL_O_FILES_$(@)) $(TOOL_LIB_FLAGS_$(@)) $(foreach l,$(TOOL_LIBS_$(@)),-l'$(l)') # $(CP) $@ $(notdir $@) GARBAGE:=$(GARBAGE) $(notdir $(TOOL)) ###################################################################### # Aliases .PHONY : $(TOOL_NAME) $(notdir $(TOOL)) $(TOOL_NAME) $(notdir $(TOOL)) : $(TOOL) ###################################################################### # Export the target TOOL_PRODUCTS:=$(TOOL_PRODUCTS) $(TOOL) PRODUCTS:=$(PRODUCTS) $(TOOL) tools :: $(TOOL_PRODUCTS) @$(MSG) Made $@: $(TOOL_PRODUCTS) .PHONY : tools ###################################################################### # Reset vars TOOL_NAME:= TOOL_MAIN:= TOOL_O_FILES:= TOOL_LIBS:= TOOL_LIB_FLAGS:= TOOL_TEST:= ###################################################################### # EOF memdebug0.1/src/maks/tools.mak0100644000175200017560000000032406765637251016733 0ustar stephensstephens# $Id: tools.mak,v 1.5 1999/09/09 04:59:21 stephensk Exp $ ECHO=echo MSG_PREFIX=+++ MSG=$(ECHO) $(MSG_PREFIX) MKDIR=mkdir MKDIRS=$(MKDIR) -p CP=cp CP_RECURSIVE=$(CP) -rp MV=mv TAR=tar GZIP=gzip -9 GUNZIP=gzip -d memdebug0.1/src/maks/use.mak0100744000175200017560000000075607262415714016370 0ustar stephensstephens# $Id: use.mak,v 1.4 2001/03/21 02:04:14 stephens Exp $ # # Use a package. # # USE:= # include $(MAKS)/use.mak # # A package's Makefile.use contains the names of libraries # and header directories needed to 'USE' the package. # #USE:=$(strip $(shell cd $(USE) && /bin/pwd)) # Canonicalize the name error USE=$(USE) ifeq "$(findstring $(USE),$(USE_ALL))" "" # Include it once USE_ALL:=$(USE_ALL) $(USE) # Keep track of directories we USEd -include $(USE)/Makefile.use endif memdebug0.1/src/maks/opengl/0042755000175200017560000000000007326751162016363 5ustar stephensstephensmemdebug0.1/src/maks/opengl/CVS/0042755000175200017560000000000007336072176017020 5ustar stephensstephensmemdebug0.1/src/maks/opengl/CVS/Root0100664000175200017560000000006107336072176017660 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/maks/opengl/CVS/Repository0100644000175200017560000000003107236675452021114 0ustar stephensstephenshome/ion/src/maks/opengl memdebug0.1/src/maks/opengl/CVS/Entries0100644000175200017560000000013007322242246020331 0ustar stephensstephens/Makefile/1.2/Fri Feb 19 09:26:02 1999// /Makefile.use/1.5/Mon Jul 9 05:44:06 2001// D memdebug0.1/src/maks/opengl/Makefile0100644000175200017560000000011306663227052020010 0ustar stephensstephens# $Id: Makefile,v 1.2 1999/02/19 09:26:02 stephensk Exp $ all : clean : memdebug0.1/src/maks/opengl/Makefile.use0100744000175200017560000000073007322242246020604 0ustar stephensstephens# $Id: Makefile.use,v 1.5 2001/07/07 04:12:11 stephens Exp $ #OPENGL_ROOT:=$(APPS)/dev# OPENGL_LIBDIR:=$(OPENGL_ROOT)# OPENGL_INCL:=$(OPENGL_ROOT)# MAKS_ARCH=$(MAKE_ARCH)# ifneq "$(strip $(findstring WIN,$(MAKS_ARCH)))" "" USE:=$(MAKS)/win32 include $(MAKS)/use.mak OPENGL_LIBS := opengl32 glu32 glut32 m # endif ifneq "$(strip $(findstring Linux,$(MAKS_ARCH)))" "" OPENGL_LIBS := GL GLU glut m # endif INCLS:=$(INCLS) $(OPENGL_INCL)# LIBS:=$(OPENGL_LIBS) $(LIBS)# memdebug0.1/src/maks/os/0042755000175200017560000000000007326751162015520 5ustar stephensstephensmemdebug0.1/src/maks/os/CVS/0042755000175200017560000000000007336072176016155 5ustar stephensstephensmemdebug0.1/src/maks/os/CVS/Root0100664000175200017560000000006107336072176017015 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/maks/os/CVS/Repository0100644000175200017560000000002507236675452020254 0ustar stephensstephenshome/ion/src/maks/os memdebug0.1/src/maks/os/CVS/Entries0100644000175200017560000000021207236675452017504 0ustar stephensstephens/CYGWIN.mak/1.1/Thu Jan 13 11:24:09 2000// /CYGWIN_98-4.10.mak/1.1/Thu Jan 13 11:24:09 2000// /Linux.mak/1.1/Thu Jan 13 11:24:10 2000// D memdebug0.1/src/maks/os/CYGWIN.mak0100644000175200017560000000013007037332731017173 0ustar stephensstephens# $Id: CYGWIN.mak,v 1.1 2000/01/13 11:24:09 stephensk Exp $ # CYGWIN (generic) exe=.exe memdebug0.1/src/maks/os/CYGWIN_98-4.10.mak0100644000175200017560000000016407037332731020102 0ustar stephensstephens# $Id: CYGWIN_98-4.10.mak,v 1.1 2000/01/13 11:24:09 stephensk Exp $ # CYGWIN_98-4.10 include $(MAKS)/os/CYGWIN.mak memdebug0.1/src/maks/os/Linux.mak0100644000175200017560000000011507037332732017276 0ustar stephensstephens# $Id: Linux.mak,v 1.1 2000/01/13 11:24:10 stephensk Exp $ # Linux-specifics memdebug0.1/src/maks/win32/0042755000175200017560000000000007326751162016041 5ustar stephensstephensmemdebug0.1/src/maks/win32/CVS/0042755000175200017560000000000007336072176016476 5ustar stephensstephensmemdebug0.1/src/maks/win32/CVS/Root0100664000175200017560000000006107336072176017336 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/maks/win32/CVS/Repository0100644000175200017560000000003007236675452020571 0ustar stephensstephenshome/ion/src/maks/win32 memdebug0.1/src/maks/win32/CVS/Entries0100644000175200017560000000013007236675452020024 0ustar stephensstephens/Makefile/1.2/Fri Feb 19 09:26:02 1999// /Makefile.use/1.2/Fri Feb 19 09:26:02 1999// D memdebug0.1/src/maks/win32/Makefile0100644000175200017560000000011306663227052017466 0ustar stephensstephens# $Id: Makefile,v 1.2 1999/02/19 09:26:02 stephensk Exp $ all : clean : memdebug0.1/src/maks/win32/Makefile.use0100644000175200017560000000014506663227052020266 0ustar stephensstephens# $Id: Makefile.use,v 1.2 1999/02/19 09:26:02 stephensk Exp $ LIBS := kernel32 user32 gdi32 $(LIBS) memdebug0.1/src/bin/0042755000175200017560000000000007364175364014722 5ustar stephensstephensmemdebug0.1/src/bin/CVS/0042755000175200017560000000000007364175364015355 5ustar stephensstephensmemdebug0.1/src/bin/CVS/Root0100664000175200017560000000006107336072177016212 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/bin/CVS/Repository0100644000175200017560000000002107236675451017443 0ustar stephensstephenshome/ion/src/bin memdebug0.1/src/bin/CVS/Entries0100664000175200017560000000367607364175364016722 0ustar stephensstephens/PKG/1.1.1.1/Wed Feb 17 06:33:07 1999// /addcr/1.5/Wed Feb 17 23:02:18 1999// /addrcsid.pl/1.3/Mon Jun 28 13:55:59 1999// /ccinfo/1.1.1.1/Wed Feb 17 06:33:07 1999// /ccloclibs/1.1.1.1/Wed Feb 17 06:33:07 1999// /ctocnl.c/1.2/Fri Feb 19 09:25:26 1999// /cvschrep.pl/1.3/Sun Jan 14 15:40:02 2001// /cvschroot.pl/1.3/Wed Feb 17 22:29:09 1999// /cvsclean/1.1/Thu Oct 21 00:01:07 1999// /cvsedited/1.1/Wed Oct 13 21:42:43 1999// /cvsfind.pl/1.4/Thu Oct 21 00:01:07 1999// /cvsretag.pl/1.1/Thu Sep 9 06:11:27 1999// /cvsrevhist.pl/1.6/Tue Mar 21 07:13:26 2000// /cwfixlib.pl/1.2/Fri Feb 19 09:25:26 1999// /d2u.pl/1.8/Sun Jan 14 15:40:36 2001// /ecd/1.1.1.1/Wed Feb 17 06:33:07 1999// /fe/1.1.1.1/Wed Feb 17 06:33:08 1999// /findsource/1.1.1.1/Wed Feb 17 06:33:08 1999// /igrep/1.2/Thu Sep 30 18:41:09 1999// /linkdups/1.1.1.1/Wed Feb 17 06:33:07 1999// /locstatic/1.1.1.1/Wed Feb 17 06:33:08 1999// /lsup/1.2/Thu Sep 30 18:49:41 1999// /mergefiles.pl/1.2/Fri Feb 19 09:25:26 1999// /mkindex/1.2/Thu Sep 30 18:41:09 1999// /mvr.pl/1.1/Wed Oct 13 21:42:44 1999// /nmlibs/1.1.1.1/Wed Feb 17 06:33:07 1999// /nmm/1.1.1.1/Wed Feb 17 06:33:07 1999// /objcsyms/1.1.1.1/Wed Feb 17 06:33:08 1999// /sci/1.1.1.1/Wed Feb 17 06:33:08 1999// /scip/1.1.1.1/Wed Feb 17 06:33:08 1999// /si/1.2/Wed Oct 13 17:09:27 1999// /split.c/1.2/Fri Feb 19 09:25:26 1999// /tgz/1.6/Sun Jan 14 15:41:22 2001// /ts/1.2/Tue Mar 21 07:15:07 2000// /whichall/1.1.1.1/Wed Feb 17 06:33:08 1999// /wwwsend/1.1.1.1/Wed Feb 17 06:33:07 1999// D/addcr.t//// D/lib//// /dos2unix.c/1.1/Fri Apr 8 22:48:41 1994// /swig2def.pl/1.1/Tue Apr 3 18:40:06 2001// /uud/1.3/Tue Apr 3 18:51:54 2001// /uudindex/1.3/Tue Apr 3 18:51:55 2001// /ion_open_url/1.3/Fri Jun 15 07:54:32 2001// /cvsadd_r/1.1/Sat Jun 16 07:29:53 2001// /cvsfix.pl/1.2/Mon Jul 9 05:43:56 2001// /which/1.2/Mon Jul 9 05:43:56 2001// /wwwgrab/1.1/Tue Sep 18 02:57:05 2001// /wwwgrab.pl/1.1/Tue Sep 18 02:57:05 2001// /publish.pl/1.12/Sat Oct 20 04:17:56 2001// memdebug0.1/src/bin/addcr.t/0042755000175200017560000000000007326751147016236 5ustar stephensstephensmemdebug0.1/src/bin/addcr.t/CVS/0042755000175200017560000000000007336072177016671 5ustar stephensstephensmemdebug0.1/src/bin/addcr.t/CVS/Root0100664000175200017560000000006107336072177017531 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/bin/addcr.t/CVS/Repository0100644000175200017560000000003107236675451020763 0ustar stephensstephenshome/ion/src/bin/addcr.t memdebug0.1/src/bin/addcr.t/CVS/Entries0100644000175200017560000000006107236675451020220 0ustar stephensstephens/run/1.1/Wed Feb 17 23:02:18 1999// D/backup//// memdebug0.1/src/bin/addcr.t/backup/0042755000175200017560000000000007326751147017503 5ustar stephensstephensmemdebug0.1/src/bin/addcr.t/backup/CVS/0042755000175200017560000000000007336072177020136 5ustar stephensstephensmemdebug0.1/src/bin/addcr.t/backup/CVS/Root0100664000175200017560000000006107336072177020776 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/bin/addcr.t/backup/CVS/Repository0100644000175200017560000000004007236675451022230 0ustar stephensstephenshome/ion/src/bin/addcr.t/backup memdebug0.1/src/bin/addcr.t/backup/CVS/Entries0100644000175200017560000000023307236675451021466 0ustar stephensstephens/t1.c/1.2/Fri Feb 19 09:25:27 1999// /t2/1.1.1.1/Wed Feb 17 06:33:08 1999// /t3/1.1.1.1/Wed Feb 17 06:33:08 1999// /t4/1.2/Wed Feb 17 23:02:19 1999/-kb/ D memdebug0.1/src/bin/addcr.t/backup/t1.c0100644000175200017560000000040406663227007020160 0ustar stephensstephens #ifndef __rcs_id__ #ifndef __rcs_id_backup_t1_c__ #define __rcs_id_backup_t1_c__ static const char __rcs_id_backup_t1_c[] = "$Id: t1.c,v 1.2 1999/02/19 09:25:27 stephensk Exp $"; #endif #endif /* __rcs_id__ */ L1 /* @COPYRIGHT@ Blah ** @COPYRIGHT END@ */ L2 memdebug0.1/src/bin/addcr.t/backup/t20100644000175200017560000000002406662461244017740 0ustar stephensstephens#!/bin/sh #L1 L2 L3 memdebug0.1/src/bin/addcr.t/backup/t30100644000175200017560000000005106662461244017741 0ustar stephensstephens#!/usr/local/bin/scheme ; L1 L2 L3 memdebug0.1/src/bin/addcr.t/backup/t40100644000175200017560000000057306662645173017760 0ustar stephensstephensLèV.textD+Üâ» `.data ,bý|@À.bss€À.stab,% 1:+R.stabstrÆ‹LVRopportobj_writePortbooleanU‰å¡‹P‰ÐÁøƒø~¡‹P‰ÐÁøƒøëèè‰Â‰ÐëÉÃ#f#t‰öU‰åƒìS¡‰Eü‹Eü‹‹J‰ÊÁúJý‹ˉ]ø‹Eü‹Â‹ memdebug0.1/src/bin/addcr.t/run0100644000175200017560000000021706662645172016762 0ustar stephensstephens#!/bin/sh # Test script for addcr # $Id: run,v 1.1 1999/02/17 23:02:18 stephensk Exp $ # set -x rm t[0-9]* cp backup/* . perl ../addcr t[0-9]* memdebug0.1/src/bin/PKG0100644000175200017560000000034606662461243015256 0ustar stephensstephensNAME=bin VERSION=0.1 DESC="A development script library. Tools for: publishing PKG packages, adding COPYRIGHT and RCS version strings to source files, etc." CATEGORY="Development Tools" REQUIRES_PKGS="" REQUIRES_OTHERS="perl sh" memdebug0.1/src/bin/addcr0100644000175200017560000002206706662645172015723 0ustar stephensstephens#!/usr/local/bin/perl # @COPYRIGHT@ # # Copyright (c) 1997-1999 Kurt A. Stephens and ION, Inc., All Rights Reserved. # # http://www.acm.org/~stephensk # # Kurt A. Stephens and Ion, Inc. MAKE NO REPRESENTATIONS OR WARRANTIES # ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING # BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR # A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Kurt A. Stephens or Ion, Inc. # SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF # USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. # # $Id: addcr,v 1.5 1999/02/17 23:02:18 stephensk Exp $ # # @COPYRIGHT END@ ($progname = $0) =~ s@^.*[/\\]@@; $progdir = ($0 =~ m@^(.*)[/\\]@) ? $1 : '.'; #print STDERR "progdir = '$progdir', progname = '$progname'\n"; exit(1); @comments = ( [ '/\.(o|obj|lib|a|exe|com|out|bak)$/i || /,v$/i || /~$/ || -B $filename', 0 ], # Ignore object, backup, RCS, emacs backups, and binary files [ '/$backup_suffix$/i', 0 ], # Ignore our backup files [ '/\.([CchHyYlL]+|java)$/i || firstline_() =~ /^\s*(#\s*include|#\s*if|#\s*define|\/\*|\/\/)/', [ '/*', '**', '*/' ] ], [ '/\.(el|scm|ll|lisp)$/i || firstline_() =~ /^\s*;/', [ ';' ] ], [ '/\.(bat)$/i', [ 'REM ' ] ], # DOS BAT files [ '/Makefile.*|(\.(mak|pl|pm|perl|[ck]?sh))$/i || firstline() =~ /^\s*#/', [ '#' ] ] ); foreach $x ( @comments ) { die "$!: Cannot compile $x->[0]" if ( ! ($x->[2] = eval("sub { $x->[0]; }")) ); $x->[1]->[1] = $x->[1]->[0] if ( ! defined($x->[1]->[1]) ); $x->[1]->[2] = '' if ( ! defined($x->[1]->[2]) ); } ################################## sub firstline { local(*F); if ( $_firstline_filename eq $filename ) { return $_firstline; } $_firstline_filename = $filename; open(F, "<$filename") || warn "$!: Cannot open $filename for reading"; $F = ; close(F); chop $F; $_firstline = $F; $F; } sub firstline_ { # Get first non-blank line, skipping first line if it's "#!" local(*F); if ( $_firstline__filename eq $filename ) { return $_firstline_; } $_firstline__filename = $filename; open(F, "<$filename") || warn "$!: Cannot open $filename for reading"; $F = ; #print STDERR "firstline_ = '$F'\n"; $F = if ( $F =~ /^\#\!/ ); #print STDERR "firstline_ = '$F'\n"; chop $F; while ( $F =~ /^\s*$/ ) { $F = ; chop $F; } close(F); $_firstline_ = $F; #print STDERR "firstline_ = '$F'\n"; $F; } ################################## $replacestr = 'COPYRIGHT'; $replacefile = $replacestr; $filename = '.'; $testing = 0; $debug = 0; $backup_suffix = '.acr'; $rm_backup = 0; $dryrun = 0; $usage = 0; $recursive = 0; sub findfile { my($replacedir); $replacedir = ($filename =~ m@^(.*)[/\\]@) ? $1 : '.'; #print STDERR "replacedir = '$replacedir'\n"; while ( ! -r ($FILE = "$replacedir/$replacefile") ) { $replacedir .= "/.."; if ( $replacedir eq './../../../../../../../../../..' ) { die "Cannot locate $replacefile" if ( ! $usage ); return ""; } } $FILE; } sub insertfile { # Begin replace block print OUT $comments->[0], ' @', $replacestr, '@', "\n"; print OUT $comments->[1], "\n"; # Open comment text file open(FILE, "<$FILE") || die "$!: Cannot open $FILE for reading"; # Insert the comment text while ( $line = ) { print OUT $comments->[1], ' ', $line; } close(FILE); # End replace block print OUT $comments->[1], "\n"; print OUT $comments->[1], ' @', $replacestr, ' END@ ', $comments->[2], "\n"; # Copy rest of IN file if ( defined($firstline) ) { print OUT $firstline; $firstline = undef; } while ( $line = ) { print OUT $line; } close(IN); close(OUT); if ( (! $testing) && $rm_backup ) { system('rm', $IN); } print STDERR "$progname: $filename: found and replaced preexisting $replacestr block\n" if ( $debug ); 1; } sub replacestr { local($comments) = @_; local(*IN,*OUT,*FILE); local($line, $firstline); # Find the replacement text file $FILE = findfile(); if ( $dryrun ) { print "$progname: $filename: $FILE: $comment->[0]: $comment->[1]: $comment->[2]\n"; } $_ = $filename; if ( $testing ) { $OUT = $filename . $backup_suffix; $IN = $filename; } else { # We move the file to $IN $OUT = $filename; $IN = $filename . $backup_suffix; if ( -f $IN ) { print STDERR "$progname: backup file $IN already exists\n"; return 0; } if ( ! (-w && -r && -f) ) { print STDERR "$progname: $filename: file not read/write\n"; return 0; } system('mv', $OUT, $IN) && die "$!: Cannot mv $OUT $IN"; } # Open IN and OUT files open(OUT, ">$OUT") || die "$!: Cannot open $OUT for writing"; open(IN, "<$IN") || die "$!: Cannot open $IN for reading"; # Read first line if ( ($line = ) ) { # If first line contains 'DO NOT MODIFY', don't do anything! if ( $line =~ /DO NOT MODIFY/i ) { print STDERR "$progname: $filename: found 'DO NOT MODIFY'\n" if ( $debug ); close(IN); close(OUT); # Restore original file if ( ! $testing ) { system('mv', $IN, $OUT); } return 0; } } while ( $line ) { # Have we found a preexisting replace string if ( $line !~ /@$replacestr@/ ) { # Simply echo to OUT print OUT $line; } else { print STDERR "$progname: $filename: found '\@$replacestr\@'\n" if ( $debug ); # Skip over input comment block while ( ($line = ) ) { if ( $line =~ /@$replacestr END@/ ) { print STDERR "$progname: $filename: found '\@$replacestr END\@' terminator\n" if ( $debug ); return insertfile(); } } # Did not find END terminator! print STDERR "$progname: $filename: did not find '\@$replacestr END\@' terminator\n"; close(IN); close(OUT); open(OUT, ">$OUT") || die "$!: Cannot open $OUT for writing"; open(IN, "<$IN") || die "$!: Cannot open $IN for reading"; while ( ($line = ) ) { if ( $line =~ /@$replacestr@/ ) { return insertfile(); } else { print OUT $line; } } } $line = ; } # We never found a preexisting comment block; # insert $FILE after #! line. print STDERR "$progname: $filename: did not find preexisting $replacestr block\n" if ( $debug ); close(IN); close(OUT); open(OUT, ">$OUT") || die "$!: Cannot open $OUT for writing"; open(IN, "<$IN") || die "$!: Cannot open $IN for reading"; # Skip over first shell script #! line $firstline = ; if ( $firstline =~ /^#!\// ) { print STDERR "$progname: $filename: skipping first line '$firstline'\n" if ( $debug ); print OUT $firstline; $firstline = undef; } insertfile(); } sub getdir { local(*DIR); $DIR = $_[0]; opendir(DIR, $DIR); @DIR = grep(($_ ne '.' && $_ ne '..'), readdir DIR); closedir(DIR); print STDERR "getdir: $DIR: ", join(", ", @DIR), "\n" if ( $debug > 2 ); @DIR; } sub dofile { $filename = $_[0]; $_ = $filename; s@^.*[/\\]@@; # remove directory path print STDERR "$progname: $filename: dofile\n" if ( $debug > 1 ); if ( -r $filename && -w $filename ) { if ( -d $filename ) { my($fuc) = uc($_); if ( $fuc =~ /^CVS/ || $fuc eq 'RCS' || $fuc eq 'SCCS' ) { print STDERR "$progname: $filename: skipping dir\n" if ( 1 || $debug ); } elsif ( $recursive ) { print STDERR "$progname: $filename: recursing\n" if ( $debug ); my($dirname) = $filename; foreach $_ ( getdir($dirname) ) { dofile("$dirname/$_"); } } else { print STDERR "$progname: $filename: skipping\n"; } } else { X: foreach $x ( @comments ) { print STDERR "$progname: $filename: trying $x->[0]\n" if ( $debug > 1); if ( $x->[2] ) { if ( &{$x->[2]}() ) { print STDERR "$progname: $filename: matched $x->[0]\n" if ( $debug > 1); if ( $x->[1] ) { print STDERR "$progname: $filename: not modified\n" if ( ! replacestr($x->[1]) ); } else { print STDERR "$progname: $filename: skipping\n"; } last X; } } else { die "$progname: no proc for $x->[0]\n"; } } } } else { print STDERR "$progname: $filename: cannot read or write\n"; } } sub usage { $usage = 1; print STDERR qq~ $progname: usage: $progname ... $progname replaces \@$replacestr\@ with contents of the $replacefile file. OPTIONS -dryrun Do a dryrun. -debug Enable debugging. -testing Enable testing. -R If directories are specified, they are traversed recursively. -h, -? This usage message. The current $replacefile file is located at ~ . &findfile() . "\n"; exit(0); } #push(@ARGV, '.') if ( ! @ARGV ); foreach ( @ARGV ) { if ( s/^--?// ) { if ( /^[Hh\?]/ ) { &usage; } elsif ( /^dr/ ) { $dryrun ++; } elsif ( /^d/ ) { $debug ++; } elsif ( /^t/ ) { $testing ++; } elsif ( /^(R|rec)/ ) { $recursive ++; } else { print STDERR "$progname: $_: unrecognized option\n"; } } else { dofile($_); } } 1; memdebug0.1/src/bin/addrcsid.pl0100644000175200017560000000647106735677357017051 0ustar stephensstephens#!/usr/local/bin/perl # $Id: addrcsid.pl,v 1.3 1999/06/28 13:55:59 stephensk Exp $ # # addrcsid.pl ... # # Recursively add $Id: addrcsid.pl,v 1.3 1999/06/28 13:55:59 stephensk Exp $ strings to source files. # Avoids CVS, RCS, and SCCS directories and binary and ',v' files. # # TO DO: # use @comment array from addcr.pl to control comment characters and such # use File::Basename; use File::Find; $progname = basename($0); sub skip_first_lines { $suffix = '.scm' if ( $suffix =~ /^\.(scm|lisp|ll|el)$/i ); # Skip lines until after %{ for yacc files if ( $suffix =~ /^\.[yl]/i ) { LINE: while ( $line = <$in> ) { print $out $line; last LINE if ( $line =~ /^\s*%\{/ ); } } elsif ( $suffix =~ /^\.h/i ) { $line = <$in>; if ( $line =~ /^\s*#\s*if/ ) { print $out $line; $line = <$in>; } } else { $line = <$in>; if ( $line =~ /^\s*\#!/ ) { print $out $line; $line = <$in>; } } $line; } $rcs_id_str = '$Id: addrcsid.pl,v 1.3 1999/06/28 13:55:59 stephensk Exp $'; sub print_rcs_id { if ( $suffix =~ /^\.[ychlm]/i ) { print $out qq~ #ifndef __rcs_id__ #ifndef __rcs_id_${ftoken}__ #define __rcs_id_${ftoken}__ static const char __rcs_id_${ftoken}[] = "$rcs_id_str"; #endif #endif /* __rcs_id__ */ ~; } elsif ( $suffix =~ /^.htm/ ) { print $out qq~ ~; } elsif ( $suffix eq '.java' ) { print $out qq~/* $rcs_id_str */ ~; } else { my($com) = '#'; $com = ';' if ( $suffix =~ /^\.(scm|lisp|ll|el)$/ ); print $out qq~$com $rcs_id_str ~; } } sub do_file { #print STDERR "$progname: do_file($File::Find::dir/$_)\n"; if ( ( -d && /^(CVS|RCS|SCCS)/i ) || /,v$/ ) { $File::Find::prune = 1; } elsif ( -f && -r && ! -B && ( /(\.[a-zA-Z_0-9]+)$/i || /^makefile/i ) ) { local($suffix) = $1; my($found) = 0; local($in, $out); local($line); # In and out files $in = $_; $out = "$_.tmp"; # Generate a C token for the filename local($ftoken) = $File::Find::name; $ftoken = $1 if ( $ftoken =~ m@([^\\/]+[\\/][^\\/]+)$@ ); $ftoken =~ tr/A-Za-z_0-9/_/c; # open files die "$out exists" if ( -e $out ); open($out, ">$out") || die "$out: $!: "; open($in, "<$in") || die "$in: $!: "; skip_first_lines(); while ( $line ) { if ( $line =~ /DO NOT MODIFY/ ) { print STDERR "$progname: DO NOT MODIFY: skipping $File::Find::dir/$_\n"; close($in); close($out); unlink($out); return; } #locate prexisting rcs id block */ if ( $line =~ /^\s*\#\s*ifndef\s+__rcs_id__/ ) { $found = 1; # skip block while ( $line = <$in> && $line !~ m@^\s*\#\s*endif\s*/\*\s*__rcs_id__\s*\*/@ ) { 1; } print_rcs_id(); } print $out $line; $line = <$in>; } close($in); close($out); if ( ! $found ) { open($out, ">$out") || die "$out: $!: "; open($in, "<$in") || die "$in: $!: "; # Skip first lines skip_first_lines(); # Put rcs id print_rcs_id(); # write rest of file while ( $line ) { print $out $line; $line = <$in>; } close($in); close($out); } if ( -w $in ) { unlink($in); rename($out, $in); print STDERR "$progname: $File::Find::dir/$in\n" } else { print STDERR "$progname: $File::Find::dir/$in not writable: result in $File::Find::dir/$out\n"; } } } File::Find::find(\&do_file, @ARGV); 1; memdebug0.1/src/bin/ccinfo0100644000175200017560000001177606662461243016107 0ustar stephensstephens#!/run/thirdParty/perl5/bin/perl eval 'exec /run/thirdParty/perl5/bin/perl $0 ${1+"$@"}' if 0; $cwd = 0; sub cwd { if ( ! $cwd ) { chop($cwd = `/bin/pwd`); $cwd = simplifyPathname($cwd); #print STDERR "cwd = $cwd\n"; } $cwd; } sub simplifyPathname { my($p) = $_[0]; $p =~ s@^/private/@/@; $p =~ s@//@/@g; $p =~ s@/\./@/@g; while ( $p =~ s@/[^/]+/\.\./@/@ ) { } #print STDERR "simplifyPathname $_[0] -> $p\n"; $p; } #for ( @ARGV ) { # print $_, " => ", simplifyPathname($_), "\n"; #} #exit 0; sub absPathname { my($f) = $_[0]; $f = ($f =~ m@^/@) ? $f : simplifyPathname(cwd() . "/" .$f); #print STDERR "absPathname $_[0] -> $f\n"; $f; } sub filePathname { my($f) = $_[0]; $f = ($f =~ m@([^/]+)$@) ? $1 : $f; #print STDERR "filePathname $_[0] -> $f\n"; $f; } sub suffixPathname { my($f) = $_[0]; $f = ($f =~ m@(\.[^/.]*)$@) ? $1 : ''; #print STDERR "suffixPathname $_[0] -> $f\n"; $f; } sub findFile { my($file,$path) = @_; my($f); if ( $file =~ m@^/@ ) { if ( -r $file ) { return $file; } } else { foreach $d ( @$path ) { $f = $d . '/' . $file; if ( -r $f ) { return $f; } } } 0; } sub expandSoftlink { my($f) = @_; my($l,$linkcount); $linkcount = 40; while ( -l $f && ($l = readlink($f)) ) { # print STDERR "softlink $f -> $l\n"; -- $linkcount || die "$0: $f: Too many levels of symbolic links"; if ( $l =~ m@^/@ ) { $f = $l; } else { $f =~ s@/[^/]+/?$@@; $f .= "/" . $l; } } $f; } sub _objCName { if ( s/^\.objc_class_name_// ) { $_ = '@class ' . $_; } elsif ( m/^\.objc_category_name_([^_]+)_([^_]+)/ ) { $_ = '@category ' . $1 . '(' . $2 . ')'; } $_; } sub _nmInfo { my($x) = @_; my($fp, $f, $suf, $floc, $a); $f = $x->[1]; $fp = $x->[2]; $suf = $x->[0]; $floc = $fp; $a = []; open(NM, "/bin/nm $fp|"); while ( ) { chop; if ( s/^\s+U\s+// ) { _objCName(); push(@$a, [ $suf, $f, $floc, 'refs', 'symb', $_, '' ]); } elsif ( s/^([0-9a-fA-f]+)\s+T\s+// || (s/^([0-9a-fA-f]+)\s+t\s+// && m/^[-+]\[/) ) { _objCName(); push(@$a, [ $suf, $f, $floc, 'defs', 'prog', $_, $1 ]); } elsif ( s/^([0-9a-fA-f]+)\s+D\s+// ) { _objCName(); push(@$a, [ $suf, $f, $floc, 'defs', 'data', $_, $1 ]); } elsif ( s/^([0-9a-fA-f]+)\s+A\s+// ) { _objCName(); push(@$a, [ $suf, $f, $floc, 'defs', 'abs', $_, $1 ]); } elsif ( m@^/([^(]+)[(]([^)]+)[)]@ ) { $module = $2; $suf = suffixPathname($module); $f = $module; $floc = $x->[2] . '@' . $module; push(@$a, [ $x->[0], $x->[1], $x->[2], 'has', $suf, $f, '' ]); } } close(NM); $a; } sub nmInfo { my($fp) = @_; #print STDERR "nmInfo $fp->[2] \n"; _nmInfo($fp); } @ldirs = ('.'); @fdirs = ('/LocalLibrary/Frameworks', '/NextLibrary/Frameworks'); @lfiles = (); @ffiles = (); @archs = (); @infiles = (); $outfile = 0; $doInfo = 1; @argv = @ARGV; shift @argv; while ( $a = shift @argv ) { if ( $a =~ m/^-L(.*)$/ ) { push(@ldirs, $1); } elsif ( $a =~ m/^-l(.*)$/ ) { push(@lfiles, [ 'lib', $1, '' ]); } elsif ( $a eq '-o' ) { $outfile = absPathname(shift @argv); } elsif ( $a eq '-arch' ) { push(@archs, shift @argv); } elsif ( $a eq '-framework' ) { $f = shift @argv; push(@ffiles, [ 'framework', $f, '' ]); } elsif ( $a =~ m/^-[cSE]$/ ) { $doInfo = 0; } elsif ( $a eq '-sectcreate' || $a eq '-segprot' ) { shift @argv; shift @argv; shift @argv; } elsif ( $a !~ m@^-@ && $a =~ m/\.\w+$/ ) { if ( $a =~ m/\.a$/ ) { push(@infiles, [ 'lib', filePathname($a), absPathname($a) ] ); } else { push(@infiles, [ suffixPathname($a), filePathname($a), absPathname($a) ] ); } } } if ( $doInfo ) { foreach $x ( @lfiles ) { my($file) = 'lib' . $x->[1] . '.a'; $x->[2] = absPathname(expandSoftlink(findFile($file, \@ldirs))); if ( $x->[2] ) { push(@infiles, $x); } } push(@ffiles, [ 'framework', 'System' ]); foreach $x ( @ffiles ) { my($file) = $x->[1] . '.framework/' . $x->[1]; $x->[2] = absPathname(expandSoftlink(findFile($file, \@fdirs))); if ( $x->[2] ) { push(@infiles, $x); } } if ( ! $outfile ) { $outfile = 'a.out'; } @info = (); # type name location relation type name location # 0 1 2 3 4 5 6 %defs = (); $datafile="$outfile.ccinfo"; open(FILE,">$datafile") || print STDERR "$0: cannot open $datafile for writing: $!"; for $x ( @infiles ) { print FILE join("\t", 'exe', filePathname($outfile), $outfile, 'links', $x->[0], $x->[1], $x->[2]), "\n"; if ( $x->[2] && ($x->[0] eq 'lib' || $x->[0] eq 'framework' || $x->[0] eq '.o') ) { for $i ( @{nmInfo($x)} ) { push(@info, $i); if ( $i->[3] eq 'defs' ) { $defs{$i->[5]} = $i; } } } } for $i ( @info ) { if ( $i->[3] eq 'refs' ) { if ( $j = $defs{$i->[5]} ) { $i->[4] = $j->[4]; $i->[6] = ''; # $j->[2] . '@' . $j->[6]; } } print FILE join("\t", @{$i}), "\n"; } close(FILE); } exec(@ARGV); memdebug0.1/src/bin/ccloclibs0100644000175200017560000000576306662461243016602 0ustar stephensstephens#!/run/thirdParty/perl5/bin/perl eval 'exec /run/thirdParty/perl5/bin/perl $0 ${1+"$@"}' if 0; # # This program interprets cc -L and -l linker command lines # a attempts to locate the libraries (lib*.a) in the -L paths specified # for each library file found. a "dir " entry is written # to a "gdbinit" file. # # It also creates a dependency in Makefile.dependencies for the executable # on the libraries. # # Libs files found that are softlinks are resolved. This will # allow you to find source for a library if you install your libraries # in directory a directory by using softlinks instead of copies. # # The last step is to exec the linker command # you can use this in your Makefile by calling 'make "CC=ccloclibs cc"' # sub findFile { my($file,$path) = @_; my($f); if ( $file =~ m@^/@ ) { if ( -r $file ) { return $file; } } else { foreach $d ( @$path ) { $f = $d . '/' . $file; if ( -r $f ) { return $f; } } } 0; } sub expandSoftlink { my($f) = @_; my($l,$linkcount); $linkcount = 40; while ( -l $f && ($l = readlink($f)) ) { # print STDERR "softlink $f -> $l\n"; -- $linkcount || die "$0: $f: Too many levels of symbolic links"; if ( $l =~ m@^/@ ) { $f = $l; } else { $f =~ s@/[^/]+/?$@@; $f .= "/" . $l; } } $f; } sub simplifyPathname { my($p) = $_[0]; $p =~ s@^/private/@/@; $p =~ s@//@/@g; $p =~ s@/\./@/@g; while ( $p =~ s@/[^/]+/\.\./@/@ ) { } #print STDERR "simplifyPathname $_[0] -> $p\n"; $p; } #print @ARGV, "\n"; @ldirs = ('.'); @lfiles = (); $outfile = 'a.out'; $gotLibs = 0; @argv = @ARGV; shift @argv; while ( $a = shift @argv ) { if ( $a =~ m/^-L(.*)$/ ) { push(@ldirs, $1); } elsif ( $a =~ m/^-l(.*)$/ ) { push(@lfiles, $1); $gotLibs ++; } elsif ( $a eq '-o' ) { $outfile = shift @argv; } } if ( $gotLibs ) { %dirs = (); $libs = "LIBS"; $deps = "Makefile.dependencies"; open(LIBS, ">$libs") || print STDERR "$0: cannot open $libs for writing: $!"; open(DEPS, ">$deps") || print STDERR "$0: cannot open $deps for writing: $!"; print DEPS "$outfile : "; foreach $lfile ( @lfiles ) { my($f); $f = simplifyPathname(expandSoftlink(findFile("lib" . $lfile . ".a", \@ldirs))); if ( ! $f ) { $f = simplifyPathname(expandSoftlink(findFile("lib" . $lfile . ".dylib", \@ldirs))); } if ( $f ) { print STDERR "lib $lfile $f\n"; print LIBS "lib $lfile $f\n"; print DEPS "\\\n $f "; $f =~ s@/[^/]*$@@; while ( $f =~ s@/NeXT_[^/]*obj$@@ ) { } $dirs{$f} ++; } else { print STDERR "$0: $lfile: not found\n"; } } print DEPS "\n\n"; close(LIBS); close(DEPS); $gdbinit = "gdbinit"; open(GDBINIT, ">$gdbinit") || print STDERR "$0: cannot open $gdbinit for writing: $!"; foreach $f ( keys(%dirs) ) { print GDBINIT "dir $f\n"; print STDERR "dir $f\n"; } close(GDBINIT); } #print STDERR "$0: ", join(" ", @ARGV), "\n"; exec(@ARGV); memdebug0.1/src/bin/ctocnl.c0100644000175200017560000000056406663227006016340 0ustar stephensstephens #ifndef __rcs_id__ #ifndef __rcs_id_bin_ctocnl_c__ #define __rcs_id_bin_ctocnl_c__ static const char __rcs_id_bin_ctocnl_c[] = "$Id: ctocnl.c,v 1.2 1999/02/19 09:25:26 stephensk Exp $"; #endif #endif /* __rcs_id__ */ #include int main() { int c; while ( (c = getchar()) != EOF ) { putchar(c); if ( c == ';' ) putchar('\n'); } return 0; } memdebug0.1/src/bin/cvschrep.pl0100744000175200017560000000234707230344122017054 0ustar stephensstephens#!/usr/local/bin/perl # $Id: cvschrep.pl,v 1.3 2001/01/14 15:40:02 stephens Exp $ # use File::Find; $debug = 1; $testing = 0; $keep_backup = 0; $filename = 'Repository'; $from = undef; $to = $undef; while ( @ARGV ) { $_ = shift; if ( /^--?r/ ) { $filename = 'Root'; } elsif ( /^--?d/ ) { ++ $debug; } elsif ( /^--?t/ ) { ++ $testing; } elsif ( ! defined $from ) { $from = $_; } elsif ( ! defined $to ) { $to = $_; last; } } sub wanted { my($file) = $File::Find::name; if ( $File::Find::name =~ m@/CVS/$filename$@o && -f ) { my($in, $out) = ( "$_.tmp", $_ ); my($line); print STDERR "wanted: '$File::Find::name'\n" if ( $testing || $debug ); if ( $testing ) { $in = $out; } else { die "$in exists" if ( -e $in ); system('mv', $out, $in); } open($in, "<$in") || die "$in: $!"; if ( ! $testing ) { open($out, ">$out") || die "$out: $!"; } while ( $line = <$in> ) { $line =~ s/\r//sg; if ( $line =~ s@$from@$to@i ) { print STDERR "$File::Find::name: $line"; } if ( ! $testing ) { print $out $line; } } close($in); if ( ! $testing ) { close($out); unlink($in) if ( ! $keep_backup ); } } } find(\&wanted, @ARGV); 1; memdebug0.1/src/bin/cvschroot.pl0100644000175200017560000000204606662641265017264 0ustar stephensstephens#!/bin/perl # $Id: cvschroot.pl,v 1.3 1999/02/17 22:29:09 stephensk Exp $ # use File::Find; $debug = 1; $keep_backup = 0; $testing = 0; $delete = 1; #$from = shift; #$to = shift; sub wanted { my($file) = $File::Find::name; if ( $File::Find::name =~ m@/CVS/Root$@ && -f ) { my($in, $out) = ( "$_.tmp", $_ ); my($line); print STDERR "$0: '$File::Find::name'\n" if ( $testing || $debug ); if ( $testing ) { $in = $out; } else { die "$in exists" if ( -e $in ); system('mv', $out, $in); } if ( $delete ) { unlink($out) if ( ! $testing ); unlink($in) if ( ! $keep_backup ); } else { open($in, "<$in") || die "$in: $!"; if ( ! $testing ) { open($out, ">$out") || die "$out: $!"; } # while ( $line = <$in> ) { # if ( $line =~ s@^$from@$to@i ) { # print STDERR "$File::Find::name: $line"; # } # if ( ! $testing ) { # print $out $line; # } # } close($in); if ( ! $testing ) { close($out); unlink($in) if ( ! $keep_backup ); } } } } find(\&wanted, @ARGV); 1; memdebug0.1/src/bin/cvsclean0100644000175200017560000000054007003453703016417 0ustar stephensstephens#!/bin/sh #$Id: cvsclean,v 1.1 1999/10/21 00:01:07 stephensk Exp $ #cvs() { # echo "cvs $@" #} files="" OIFS="$IFS" IFS="/" while read type file version date sticky do if [ -n "$file" ] then case "$type" in *) if [ ! -f "$file" ] then files="$files$file " fi ;; esac fi done < CVS/Entries IFS="$OIFS" cvs rm $files memdebug0.1/src/bin/cvsedited0100644000175200017560000000051307001176323016571 0ustar stephensstephens#!/bin/sh # $Id: cvsedited,v 1.1 1999/10/13 21:42:43 stephensk Exp $ tmp=/tmp/$$.tmp set -x find \( -name 'CVS' -prune \) -o \( -type f -print \) "$@" | #> "$tmp" while read f do status="$(cvs status $f | egrep -e '^File: .*Status:')" case "$status" in *Locally*) echo "$f $status" ;; esac done rm -f "$tmp" memdebug0.1/src/bin/cvsfind.pl0100644000175200017560000000253507003453703016675 0ustar stephensstephens#!/usr/local/bin/perl # $Id: cvsfind.pl,v 1.4 1999/10/21 00:01:07 stephensk Exp $ use File::Basename; use Cwd 'fast_abs_path'; $progdir = fast_abs_path(dirname($0)); push(@INC, $progdir, "$progdir/lib/perl"); print STDERR "@INC\n"; eval 'use ion::_cvs::find;'; ################################################################### $debug = 0; $testing = 0; $sep = "\t"; @print_entries = (); OPT: while ( ($_ = $ARGV[0]) && /^-/ ) { shift; s/^--?//; if ( $_ eq '' ) { last OPT; } elsif ( /^sep/ ) { $sep = shift; } else { FLAG: while ( $_ ne '' ) { if ( /^A/ ) { @print_entries = ( 0 .. $#ion::_cvs::entry::map ); last FLAG; } elsif ( s/^([a-zA-Z]+)$// ) { my $i = $ion::_cvs::entry::map{$1}; die "$1: unknown field: must be one of '@ion::_cvs::entry::map'" if ( ! defined $i ); push(@print_entries, $i); } elsif ( s/^([0-9]+)$// ) { push(@print_entries, $1); } else { last FLAG; } } } } @print_entries = ( 0 .. $#ion::_cvs::entry::map ) if ( ! @print_entries ); ########################################################### @entries = (); ion::_cvs::find(sub { push(@{$_[1]}, $_[0]) }, \@entries, @ARGV); @entries = sort { ($a->fullpath) cmp ($b->fullpath); } @entries; foreach $e ( @entries ) { print join($sep, map($e->[$_], @print_entries)), "\n"; } 1; memdebug0.1/src/bin/cvsretag.pl0100644000175200017560000000225106765647617017101 0ustar stephensstephens#!/usr/local/bin/perl # $Id: cvsretag.pl,v 1.1 1999/09/09 06:11:27 stephensk Exp $ #use Carp; use File::Basename; use Cwd 'fast_abs_path'; $progdir = fast_abs_path(dirname($0)); push(@INC, $progdir, "$progdir/lib/perl"); eval 'use ion::_cvs::find;'; #eval 'use ion::_cvs::rlog;' || die "$!"; $opts = { }; while ( $_ = $ARGV[0], s/^--?// ) { shift; if ( s/^f([^=]*=)?// ) { $opts->{filter} = $1 ? $_ : shift; } elsif ( s/^s([^=]*=)?// ) { $opts->{show_rev_info} = $1 ? $_ : 1; } } my(@entries); ion::_cvs::find(sub {push(@{$_[1]}, $_[0]); }, \@entries, @ARGV); @entries = sort { $a->fullpath() cmp $b->fullpath() } @entries; my($OUTPUT); $OUTPUT = 'STDOUT'; $opts = {filter => '-h'}; $opts = {}; my($e); foreach $e ( @entries ) { if ( $e->isFile ) { print $e->repository, "\n"; my($rlog) = $e->rlog({}); use Data::Dumper; $Data::Dumper::Purity = 1; $Data::Dumper::Quotekeys = 1; print Dumper($rlog), "\n"; my($sym_name); foreach $sym_name ( @{$rlog->{symbolic_names}} ) { my($rev) = $rlog->{sym_name_to_rev}->{$sym_name}; if ( $rev && $sym_name =~ /^PUBLISH:/ ) { echo $e->repository, " $sym_name => $rev\n"; } } } } 1; memdebug0.1/src/bin/cvsrevhist.pl0100644000175200017560000000676307065620426017456 0ustar stephensstephens#!/usr/local/bin/perl # $Id: cvsrevhist.pl,v 1.6 2000/03/21 07:13:26 stephensk Exp $ #use Carp; BEGIN { use File::Basename; use Cwd 'fast_abs_path'; $progdir = fast_abs_path(dirname($0)); push(@INC, $progdir, "$progdir/lib/perl"); } use ion::_cvs::find; #eval 'use ion::_cvs::rlog;' || die "$!"; $opts = { }; $errors = 0; $opts->{collapse_comments} = 1; while ( $_ = $ARGV[0], s/^([-+])\1?// ) { my($pos) = $1 eq '-'; shift; if ( s/^f([^=]*=)?// ) { $opts->{filter} = $1 ? $_ : shift; } elsif ( s/^e([^=]*=)?// ) { $opts->{show_empty_entries} = $1 ? $_ : $pos; } elsif ( s/^c([^=]*=)?// ) { $opts->{collapse_comments} = $1 ? $_ : $pos; } elsif ( s/^x([^=]*=)?// ) { $opts->{auto_extend_rev_ranges} = $1 ? $_ : $pos; } elsif ( s/^s([^=]*=)?// ) { $opts->{show_rev_info} = $1 ? $_ : $pos; } } my(@entries); ion::_cvs::find(sub {push(@{$_[1]}, $_[0]); }, \@entries, @ARGV); @entries = sort { $a->fullpath() cmp $b->fullpath() } @entries; my($OUTPUT); $OUTPUT = 'STDOUT'; my($e); my($last_comments); ENTRY: foreach $e ( @entries ) { if ( $e->isFile ) { my($path) = $e->fullpath; $path =~ s@^\./@@; my($filter) = $opts->{filter}; if ( ! defined $filter ) { $filter = "-r:+"; } my($e_rev) = $e->revision; $filter =~ s/\+/$e_rev/g; my($rlog); # If a rev in a rev range does not exists, replace it with '' if ( $opts->{auto_extend_rev_ranges} ) { $rlog = $e->rlog(); if ( ! $rlog ) { $errors ++; next ENTRY; } if ( $filter =~ /-r(\S+)/ ) { my($b,$a) = ($`, $'); my($revs) = $1; if ( $revs =~ /^([^:]*):(.*)$/ ) { my($from, $to) = ($1, $2); if ( ! ($rlog->{revision}->{$from} || $rlog->{sym_name_to_rev}->{$from}) ) { #print STDERR "$path: no from rev '$from'\n"; $from = ''; } if ( ! ($rlog->{revision}->{$to} || $rlog->{sym_name_to_rev}->{$to}) ) { #print STDERR "$path: no to rev '$to'\n"; $to = ''; } $revs = $from . ':' . $to; my ($new_filter); $new_filter = $b . '-r' . $revs . $a; if ( $filter ne $new_filter ) { print STDERR "$path: filter = '$filter', new filter = '$new_filter'\n"; $filter = $new_filter; } } } # Redo log $e->clear_rlog(); } $rlog = $e->rlog({filter => $filter}); if ( ! rlog ) { $errors ++; next ENTRY; } if ( @{$rlog->{revisions}} || $opts->{show_empty_entries} ) { my($rev); if ( $opts->{show_rev_info} ) { print $OUTPUT "$path:\n"; foreach $rev ( @{$rlog->{revisions}} ) { my($r) = $rlog->{revision}->{$rev}; my($r_comments) = " " . join("\n ", split(/\n+/, $r->{comment})) . "\n"; print $OUTPUT " ", join(" ", map($r->{$_}, revision, date, author, state, lines), @{$r->{symbolic_names}}); print $OUTPUT ":\n"; print $OUTPUT $r_comments; } } else { my($comments) = ''; foreach $rev ( @{$rlog->{revisions}} ) { my($r) = $rlog->{revision}->{$rev}; my($r_comments) = " " . join("\n ", split(/\n+/, $r->{comment})) . "\n"; $comments .= $r_comments; } if ( $opts->{collapse_comments} ) { if ( $last_comments ne $comments ) { print $OUTPUT $last_comments, "\n" if ( defined $last_comments ); $last_comments = $comments; } print $OUTPUT $path, ":\n"; } else { print $OUTPUT $path, ":\n"; print $OUTPUT $comments, "\n"; } } } } } if ( $opts->{collapse_comments} ) { print $OUTPUT $last_comments, "\n" if ( defined $last_comments ); } exit($errors); 1; memdebug0.1/src/bin/cwfixlib.pl0100644000175200017560000000166106663227006017055 0ustar stephensstephens#!/usr/local/bin/perl # $Id: cwfixlib.pl,v 1.2 1999/02/19 09:25:26 stephensk Exp $ sub run { print join(" ", @_), "\n"; system(@_) && die "$!: Could not run " . join(" ", @_); } $lib = shift @ARGV; print "lib = '$lib'\n"; $LIB = $ENV{'LIB'}; $LIB = 'f:/apps/dev/msvc20/bin/lib.exe' if ( ! defined($LIB) ); open(NM, "nm $lib|"); @members = (); @exports = (); while ( ) { chop; if ( /^(.*\.obj):$/ ) { push(@members, $1); } elsif ( /^([0-9]+)\s+T\s+_([a-zA-Z0-9_]+)/ ) { push(@exports, $2); } } close(NM); print "members = ", join(" ", @members), "\n"; print "exports = ", join(" ", @exports), "\n"; $def = $lib; $def =~ m@^([^\\/]+)\.lib$@; $def = "$1.def"; print "def = '$def'\n"; open(DEF, ">$def"); print DEF "EXPORTS\n"; foreach ( @exports ) { print DEF "$_\n"; } close(DEF); &run($LIB, '/LIST', $lib); foreach ( @members ) { s@.*[\\/]@@; &run( $LIB, $lib, "/extract:$_"); } exit(0); 1; memdebug0.1/src/bin/d2u.pl0100744000175200017560000000570207230344164015735 0ustar stephensstephens#!/usr/bin/perl # $Id: d2u.pl,v 1.8 2001/01/14 15:40:36 stephens Exp $ use File::Find; $save_bak = 0; $dos2unix = 1; $force = 0; $recursive = 1; $try_pattern = '(^Makefile)|(\.([chlym][a-zA-Z]?|make?|gdb|[ck]?sh|p[lm]|ll|scm|def|tcl)$)'; $ignore_pattern = '\.(o|a|obj|lib|exe|com)$'; @files = (); ARG: while ( defined ($_ = shift @ARGV) ) { if ( s/^--?// ) { if ( /^[h?]/ ) { print STDERR qq~ Version: ~ . '$Id: d2u.pl,v 1.8 2001/01/14 15:40:36 stephens Exp $' . qq~ Options: -d[os2unix] Convert dos to unix. Default. -u[nix2dos] Convert unix to dos. -p The file matching pattern. Default: '$try_pattern'. -i The file ingore pattern. Default: '$ignore_pattern'. -r Process recursively. Default. -s Save a backup file. -f Force a conversion. -- End processing options. ~; exit(0); } elsif ( /^d(os2unix)?/ ) { $dos2unix = 1; next ARG; } elsif ( /^u(nix2dos)?/ ) { $dos2unix = 0; next ARG; } elsif ( /^p/ ) { $try_pattern = shift @ARGV; next ARG; } elsif ( /^i/ ) { $ignore_pattern = shift @ARGV; next ARG; } elsif ( /^s/ ) { $save_bak ++; next ARG; } elsif ( /^f/ ) { $force ++; next ARG; } elsif ( /^$/ ) { last ARG; } } # must be a file name push(@files, $_); } push(@files, @ARGV); sub translate { my($dir, $in) = @_; my($out, $mode, $t); if ( ! ( -f $in && -r && -w && -T) ) { return 1; } if ( $in =~ /^(RCS|SCCS|CVS)/i ) { return 1; } $out = "$in.bak"; print STDERR "translate $dir/$in\n"; die "$dir/$out already exists: $!" if ( -e $out ); rename($in, $out) || die "Cannot rename $dir/$in to $dir/$out: $!"; $t = $in; $in = $out; $out = $t; # Rename all dotted cap name to all lowercase if ( $out =~ m@^[A-Z0-9_/.]+\.[A-Z0-9_]+$@ ) { $out =~ y/A-Z/a-z/; } $mode = (stat($in))[2]; open(IN, "<$in") || die "Cannot read $dir/$in: $!"; binmode(IN); open(OUT, ">$out") || die "Cannot write $dir/$out: $!"; binmode(OUT); if ( $dos2unix ) { while ( defined ($t = ) ) { chomp $t; $t =~s/\r$//; print OUT $t, "\n"; } } else { while ( defined ($t = ) ) { chomp $t; $t =~s/\r$//; print OUT $t, "\r\n"; } } close(IN); close(OUT); print STDERR " $dir/$in -> $dir/$out\n"; chmod($out, $mode); unlink($in) if ( ! $save_bak ); 0; } sub wanted { #print STDERR "$0 $File::Find::dir/$_\n"; if ( /^(RCS|SCCS|CVS)/i || ! $recursive ) { $File::Find::prune = 1; return 0; } return 0 if ( -d $_ ); if ( $force || (($try_pattern eq '' || /$try_pattern/oi) && ! ($ignore_pattern ne '' && /$ignore_pattern/oi)) ) { translate($File::Find::dir, $_); } else { print STDERR "ignoring $File::Find::dir/$_\n"; } 0; } push(@files, '.') if ( ! @files ); find(\&wanted, @files); 1; memdebug0.1/src/bin/ecd0100644000175200017560000000130506662461243015364 0ustar stephensstephens#!/bin/sh #set -x exe="$1" if [ -z "$MAKE" ] then MAKE="${DEV_ROOT}/src/maks/bin/mak" fi prompt=" $exe: Command: " help=" 'return' to compile and debug '$exe' 'q' to quit 'c' to 'make clean' 'r' to complie and run 'd' to delete '!' to run a command 'h' for help " echo -n "$prompt" while read x do read y echo "" case "$x" in h*) echo "$help" ;; c*) $MAKE clean ;; q*|x*) exit 0 ;; d*) rm "$exe.exe" ;; r*) $MAKE && "$exe.exe" ;; !*) echo -n "shell cmd: " read x read y eval $x ;; *) $MAKE && gdb "$exe.exe" -x "$exe.gdb" ;; esac echo "" echo -n "$prompt" done memdebug0.1/src/bin/fe0100644000175200017560000000027606662461244015232 0ustar stephensstephens#!/bin/sh out="$1" shift filter="$1" shift for f in $* do cmd="$out '$f' | $filter | awk '/^[^:]+:/ { pre = "'$1'"; } { print "'"'$f':"'", pre, "'$0'"; }'" #echo "$cmd" eval $cmd done memdebug0.1/src/bin/findsource0100644000175200017560000000014706662461244016776 0ustar stephensstephens#!/bin/sh find $* \( \( -name '*.rtf*' -o -name '*.nib' \) -prune -print \) -o \( \! -type d -print \) memdebug0.1/src/bin/igrep0100644000175200017560000001464606774727305015763 0ustar stephensstephens#!/run/pd/prod/bin/perl # stephensk@acm.org sub usage { print STDERR 'igrep [-nlirwvtuh] ', "\n"; print STDERR ' Version 1.1', "\n"; print STDERR ' options:', "\n"; print STDERR ' -n print line numbers', "\n"; print STDERR ' -l print each filename once', "\n"; print STDERR ' -i case insensitive', "\n"; print STDERR ' -r match pattern as a regexpr, not as a word', "\n"; print STDERR ' -w match pattern as a word, not a regexpr (default)', "\n"; print STDERR ' -v verbose output', "\n"; print STDERR ' -t check if index is up to date', "\n"; print STDERR " -u use index file (default '$indexname')", "\n"; print STDERR " -h this help message", "\n"; exit 1; } &usage if ( @ARGV < 1 ); $indexname = ".mkindex"; $verbose = 0; $matchwords = 1; $regexp = 0; $linenumbers = 0; $listonly = 0; $caseinsensitive = ''; $timecheck = 0; $countlines = 0; while ( @ARGV ) { $arg = shift; $verbose ++ if ( $arg =~ /^-.*v/i ); $matchwords = 0 if ( $arg =~ /^-.*r/i ); $regexp = 1 if ( $arg =~ /^-.*w/i ); $linenumbers = 1 if ( $arg =~ /^-.*n/i ); $listonly = 1 if ( $arg =~ /^-.*l/i ); $caseinsensitive = '(?i)' if ( $arg =~ /^-.*i/i ); $timecheck = 1 if ( $arg =~ /^-.*t/i ); $indexfile = shift if ( $arg =~ /^-.*u/i ); $countlines = 1 if ( $arg =~ /^-.*c/i ); if ( $arg =~ m/^-(\?|h)/i ) { &usage; } else { $pattern = $arg; } } ##################################################################### # Create key and line regexps @subpatterns = grep(length($_), split(/[^_a-zA-Z]+/, $pattern)); $patternIsOneWord = $matchwords && (scalar @subpatterns) == 1 && $caseinsensitive eq '' && ! $regexp; if ( $matchwords ) { if ( ! (scalar @subpatterns) == 1 ) { $pattern =~ s@([_a-zA-Z][_a-zA-Z0-9]*)@(\\B$1\\B)@g; } if ( ! $regexp ) { $pattern =~ s@([.*+()|\\\[\]])@\\$1@g; } $keypattern = '(^' . join('$)|(^', @subpatterns) . '$)'; } else { $keypattern = join('|', @subpatterns); } $pattern = $caseinsensitive . $pattern; $keypattern = $caseinsensitive . $keypattern; print STDERR "patternIsOneWord = '$patternIsOneWord'\n" if ( $verbose ); print STDERR "pattern = '$pattern'\n" if ( $verbose ); print STDERR "keypattern = '$keypattern'\n" if ( $verbose ); ##################################################################### # locate and open index file $index = $indexname; while ( ! -r $index ) { $index = "../$index"; if ( length($index) > 64 ) { die "Cannot find $indexname"; } } print STDERR "index = '$index'\n" if ( $verbose ); open(INDEX, "<$index") || die "Cannot open $index for reading: $!"; $indexM = -M $index; # get the modification time ##################################################################### # Read version string $_ = ; chop; die "expected 'mkindex', found '$_'" if ( $_ !~ /^mkindex /); $version = (split(/ /, $_, 2))[1]; ##################################################################### # Read timestamp $_ = ; chop; die "expected 'timestamp', found '$_'" if ( $_ !~ /^timestamp / ); $timestamp = (split(/ /, $_, 2))[1]; ##################################################################### # Read file table $_ = ; chop; die "expected 'files', found '$_'" if ( $_ !~ /^files / ); $n = (split(/ /, $_, 2))[1]; $files[$n] = undef; # preextend @files = (); print STDERR "nfiles: $n " if ( $verbose ); while ( $n -- ) { $_ = ; chop; print STDERR "$0: warning: $_ is newer than $index\n" if ( $timecheck && -r && -M $_ < $indexM ); push(@files,$_); print STDERR "." if ( $verbose > 1 ); } print STDERR "\n" if ( $verbose ); $_ = ; chop; die "expected blank line" if ( $_ ne ''); print STDERR "files: ", join("\n", @files), "\n" if ( $verbose > 2 ); ##################################################################### # Read index and remember any locations for keys that match the pattern $_ = ; chop; die "expected 'keys', found '$_'" if ( $_ !~ /^keys /); $n = (split(/ /, $_, 2))[1]; print STDERR "nkeys: $n " if ( $verbose ); @keys_matched = (); %filesmatched = (); while ( $n -- ) { $_ = ; chop; ($key, $locs) = split(/ /, $_, 2); if ( $key =~ m/$keypattern/o ) { push(@keys_matched, $key); $lastlineno = -1; foreach $loc ( split(/ /, $locs) ) { ($fileno, $lineno, $pos) = split(/:/, $loc); if ( $lastlineno != $lineno ) { $filesmatched{$fileno} .= "$lineno:$pos "; print STDERR $files[$fileno], ":", $lineno, "\n" if ( $verbose > 2 ); } $lastlineno = $lineno; } print STDERR "*" if ( $verbose > 1 ); last if ( $patternIsOneWord ); } else { print STDERR "." if ( $verbose > 1 ); } } print STDERR " ", scalar @keys_matched, " keys matched\n" if ( $verbose ); print STDERR "keys matched: '", join("', '", @keys_matched), "'\n" if ( keys_matched && $verbose > 1); if ( ! $patternIsOneWord ) { $_ = ; chop; die "expected blank line" if ( $_ ne ''); } #print STDERR "keys: ", join("\n", sort(keys(%index))), "\n" if ( $verbose > 2 ); close(INDEX); ##################################################################### # %getline_cannotopen = (); $getline_FILE_file = ''; sub getline { # file, pos my ($file, $pos) = @_; my ($line); if ( $getline_FILE_file ne $file ) { $getline_FILE_file = $file; close(FILE); if ( ! open(FILE, "<$file") ) { print STDERR "$0: cannot open $file: $!\n" if ( ! $getline_cannotopen{$file} ++ ); return; } } while ( 1 ) { seek(FILE, $pos, 0); read(FILE, $line, 1); last if ( $line eq "\n" ); if ( -- $pos < 0 ) { seek(FILE, 0, 0); last; } } $line = ; chop $line; $line; } # Print each line no that matches sub numerically { $a <=> $b } $linematches = 0; FILE: foreach $fileno ( sort(keys(%filesmatched)) ) { $file = $files[$fileno]; $lastlineno = -1; %locs = (); foreach $loc ( split(/ /, $filesmatched{$fileno}) ) { ($lineno, $pos) = split(/:/, $loc); if ( $lastlineno != $lineno ) { $locs{$lineno} = $pos; } $lastlineno = $lineno; } foreach $lineno ( sort numerically (keys(%locs)) ) { if ( defined($line = &getline($file, $locs{$lineno})) ) { if ( $line =~ m/$pattern/o ) { $linematches ++; if ( $countlines ) { next FILE; } if ( $listonly ) { print $file, "\n"; next FILE; } print $file, ":"; print $lineno, ":" if ( $linenumbers ); print $line, "\n"; } } } } print $linematches, "\n" if ( $countlines ); exit(! $linematches); 0; memdebug0.1/src/bin/linkdups0100644000175200017560000000120706662461243016463 0ustar stephensstephens#!/bin/sh find . -type f -print | sed 's!\./!!g' > /tmp/$$.names #cat /tmp/$$.names EXEC=echo EXEC= while read f1 do while read f2 do # `/bin/expr length "$f1"` -lt `/bin/expr length "$f2"` if [ "$f1" != "$f2" -a ! \( -h "$f1" -o -h "$f2" \) ] then if /bin/cmp -s "$f1" "$f2" then r2=`expr "$f2" : '\(.*/\).*' '|' "$f2"` r2=`echo "$r2" | sed 's@[^/]*/@../@g'` f1r="$r2$f1" #echo "f1=$f1 f2=$f2 f1r=$f1r" if [ "$f1r" != "$f2" ] then echo "$f2 -> $f1r" /bin/rm -f "$f2" /bin/ln -s "$f1r" "$f2" fi fi fi done < /tmp/$$.names done < /tmp/$$.names memdebug0.1/src/bin/locstatic0100644000175200017560000000253106662461244016621 0ustar stephensstephens#!/bin/sh -- # -*- perl -*- eval 'exec /run/thirdParty/perl5/bin/perl $0 ${1+"$@"}' if 0; # print "$0: ", join(" ", @ARGV), "\n"; $pat = '\W(static\s+(id|\w+\s*\*)\s[^;(){}]*;)'; #$pat = '(static)'; sub scanFileForStatic { my($file) = @_; my($lineno,$s); #select(STDERR); $| = 1; select(STDOUT); #print STDERR "$file \r"; open(FILE,"<$file") || print STDERR "$0: cannot open $file for reading: $!\n"; $lineno = 0; while ( $lineno ++, $_ = ) { $s .= $_; while ( $s =~ s@$pat@@m ) { $s = $'; print "$file: $lineno: $1\n"; } } while ( $s =~ s@$pat@@m ) { $s = $'; print "$file: $lineno: $1\n"; } close(FILE); 0; } sub readDir { my($dirname) = @_; my(@dirlist); opendir(DIR,"$dirname") || print STDERR "$0: cannot open $dirname for reading: $!\n"; @dirlist = readdir(DIR); closedir(DIR); @dirlist = grep(!($_ eq '.' || $_ eq '..' || $_ eq 'SCCS' || $_ eq 'RCS'), @dirlist); # print STDERR "$0: ", join(" ", @dirlist), "\n"; @dirlist; } sub scanFiles { my(@files) = @_; my($f,$ff); foreach $f ( @files ) { if ( -d $f ) { foreach $ff ( readDir($f) ) { scanFiles("$f/$ff"); } } else { scanFileForStatic($f) if $f =~ m/\.[hmc]$/; } } 0; } # print "$0: ", join(" ", @ARGV), "\n"; scanFiles(@ARGV); 0; memdebug0.1/src/bin/lsup0100644000175200017560000000040306774730305015614 0ustar stephensstephens#!/bin/sh # $Id: lsup,v 1.2 1999/09/30 18:49:41 stephensk Exp $ # stephensk@acm.org # if [ $# -eq 0 ] then set `pwd` fi while [ $# -gt 0 ] do f="$1" while [ -n "$f" ] do /bin/ls -lagd "$f" f=`/bin/expr "$f" : '\(.*\)/.*'` done shift done memdebug0.1/src/bin/mergefiles.pl0100644000175200017560000001452506663227006017373 0ustar stephensstephens#!/usr/local/bin/perl # $Id: mergefiles.pl,v 1.2 1999/02/19 09:25:26 stephensk Exp $ # Creates a shell script to merge two directories # based on file modification time and size. # Also generates diffs for files that do not have the same mod time and size # sub ignore_files { grep(! (/\.(o|obj|a|lib|dll|exe|core)$/ || /^\.saves/ || /^CYGWIN/ || /^pilot$/ || /~$/ ), @_); } sub cmd { print "@_\n"; } sub mkdir_p_ { my($dstp) = @_; $dstp =~ s@/[^/]+$@@; cmd("mkdir -p $dstp"); } sub rm_rf { cmd("rm -rf $_[0]"); } sub cp_rp { mkdir_p_($_[1]); cmd("cp -rp @_"); } sub _cp_rp { cmd("#cp -rp @_"); } sub date_str { my($s,$m,$h,$D,$M,$Y,$W,$YD,$dst) = gmtime($_[0]); $s = '0' . $s if ( $s < 10 ); $m = '0' . $m if ( $m < 10 ); $h = '0' . $h if ( $h < 10 ); $Y += 1900; $M ++; $M = '0' . $M if ( $M < 10 ); "$Y/$M/$D-$h:$m:$s"; } sub M_str { my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_[0]); date_str($mtime); } sub get_dir { my(@dir); opendir(DIR, $_[0]) || return ( 0, $! ); @dir = grep($_ ne '.' && $_ ne '..', readdir(DIR)); closedir(DIR); (1, @dir); } sub merge_paths { my(@p) = @_; my(@e) = map(-e $_, @p); my(@f) = map(-f $_, @p); my(@d) = map(-d $_, @p); my(@s) = map(-s $_, @p); my(@M) = map(-M $_, @p); my(@pd) = map((s@/[^/]+@@, $_), @_); my(@pM) = map(-M $_, @pd); my(@d0, @d1); my($delete, $choose) = ( 0, -1 ); #print STDERR "p = ", "@p", "\n"; #print STDERR "e = ", "@e", "\n"; #print STDERR "f = ", "@f", "\n"; #print STDERR "d = ", "@d", "\n"; #print STDERR "s = ", "@s", "\n"; #print STDERR "M = ", "@M", "\n"; if ( ! $e[0] && ! $e[1] ) { # Both do not exist return; } elsif ( $e[0] && ! $e[1] ) { # d0/f0 exists and d1/f1 does not exists # if d0 is older than d1 if ( $pM[0] < $pM[1] ) { cmd("# $p[1] does not exist and $pd[0] is newer than $pd[1]"); $choose = 2; $delete = 1; } else { cmd("# $p[1] does not exist"); $choose = 1; } } elsif ( ! $e[0] && $e[1] ) { if ( $pM[1] < $pM[0] ) { cmd("# $p[0] does not exist and $pd[1] is newer than $pd[0]"); $choose = 1; $delete = 1; } else { cmd("# $p[0] does not exist"); $choose = 2; } } elsif ( $f[0] && $f[1] ) { if ( $M[0] < $M[1] ) { cmd("# $p[0] is newer than $p[1]"); $choose = 1; } elsif ( $M[0] > $M[1] ) { cmd("# $p[1] is newer than $p[0]"); $choose = 2; } elsif ( $s[0] == $s[1] ) { cmd("# $p[0] is the same time and size as $p[1]"); return; } } elsif ( $d[0] && $d[1] ) { my(@d0, @d1); my($f, $f_last); @d0 = get_dir($p[0]); shift @d0; #print STDERR "d0 = @d0\n"; @d1 = get_dir($p[1]); shift @d1; #print STDERR "d1 = @d1\n"; push(@d0, @d1); @d0 = ignore_files(sort(@d0)); F: foreach $f ( @d0 ) { next F if ( $f_last eq $f ); $f_last = $f; merge_paths($p[0] . "/" . $f, $p[1] . "/" . $f); } return; } else { cmd("#!!!! $p[0] is a " . $d[0] ? "dir" : "file" . ", $p[1] is a " . $d[1] ? "dir" : "file"); } my $get_cmd = $choose == -1; while ( $get_cmd ) { print STDERR join("\t", "1[", $p[0], $s[0], M_str($p[0]), "]"), "\n"; print STDERR join("\t", "2[", $p[1], $s[1], M_str($p[1]), "] :", $choose), " > "; $_ = ; chop; $choose = $1 if ( /([0-9]+)/ ); $delete = /d/; if ( $choose == 3 ) { system("diff -r $p[0] $p[1]"); } else { $get_cmd = 0 if ( $choose != -1 ); } } if ( $choose == 0 ) { $get_cmd = 0; } else { $choose --; if ( $delete ) { rm_rf($p[$delete - 1]); } else { cp_rp($p[$choose], $p[1 - $choose]); } } } sub merge_paths3 { # p0, p1, mp my(@p) = @_; my(@e) = map(-e $_, @p); my(@f) = map(-f $_, @p); my(@d) = map(-d $_, @p); my(@s) = map(-s $_, @p); my(@M) = map(-M $_, @p); my(@pd) = map((s@/[^/]+@@, $_), @_); my(@pM) = map(-M $_, @pd); my(@d0, @d1); my($delete, $choose) = ( 0, -1 ); #print STDERR "p = ", "@p", "\n"; #print STDERR "e = ", "@e", "\n"; #print STDERR "f = ", "@f", "\n"; #print STDERR "d = ", "@d", "\n"; #print STDERR "s = ", "@s", "\n"; #print STDERR "M = ", "@M", "\n"; if ( ! $e[0] && ! $e[1] ) { # Both do not exist } elsif ( $e[0] && ! $e[1] ) { # d0/f0 exists and d1/f1 does not exists # if d0 is older than d1 cmd(""); if ( $pM[0] < $pM[1] ) { cmd("# $p[1] does not exist and $pd[0] is newer than $pd[1]"); } else { cmd("# $p[1] does not exist"); } cp_rp($p[0], $p[2]); } elsif ( ! $e[0] && $e[1] ) { cmd(""); if ( $pM[1] < $pM[0] ) { cmd("# $p[0] does not exist and $pd[1] is newer than $pd[0]"); } else { cmd("# $p[0] does not exist"); } cp_rp($p[1], $p[2]); } elsif ( $f[0] && $f[1] ) { cmd(""); if ( $M[0] < $M[1] ) { cmd("# $p[0] is newer than $p[1]"); $choose = 0; } elsif ( $M[0] > $M[1] ) { cmd("# $p[1] is newer than $p[0]"); $choose = 1; } elsif ( $s[0] == $s[1] ) { cmd("# $p[0] is the same time and size as $p[1]"); $choose = 0; cp_rp($p[$choose], $p[2]); return; } cp_rp($p[$choose], $p[2]); _cp_rp($p[1 - $choose], $p[2]); # Do a diff $tmp = "$$.diff"; $cmd = "diff -cd \"$p[1 - $choose]\" \"$p[$choose]\""; system("$cmd > \"$tmp\""); $choose = 0; open(F, "<$tmp"); while ( $_ = ) { chop; if ( ! $choose ) { cmd("# $cmd "); $choose = 1; } cmd("# $_"); } close(F); cmd("##############################################") if ( $choose ); unlink($tmp); } elsif ( $d[0] && $d[1] ) { my(@d0, @d1); my($f, $f_last); my($errors) = 0; @d0 = get_dir($p[0]); if ( ! shift @d0 ) { print STDERR "$p[0]: ", @d0; $errors ++; } else { shift @d0; } @d1 = get_dir($p[1]); if ( ! shift @d1 ) { print STDERR "$p[1]: ", @d1; $errors ++; } if ( $errors ) { return; } push(@d0, @d1); @d0 = ignore_files(sort(@d0)); F: foreach $f ( @d0 ) { next F if ( $f_last eq $f ); $f_last = $f; merge_paths3($p[0] . "/" . $f, $p[1] . "/" . $f, $p[2] . "/" . $f); } } else { cmd(""); cmd("#!!!! $p[0] is a " . $d[0] ? "dir" : "file" . ", $p[1] is a " . $d[1] ? "dir" : "file"); } } cmd("#!/bin/sh"); cmd("# $0 " . join(" ", @ARGV)); cmd("set -x"); #if ( $#ARGV == 3 ) { merge_paths3(@ARGV); #} else { # merge_paths(@ARGV); #} 1; memdebug0.1/src/bin/mkindex0100644000175200017560000000365506774727305016312 0ustar stephensstephens#!/run/pd/prod/bin/perl # stephensk@acm.org $version = 1.1; $indexname = $index = ".mkindex"; $verbose = 0; while ( @ARGV ) { $arg = shift; $verbose ++ if ( $arg =~ /^-.*v/ ); } # open the index file open(INDEX, ">$index") || die "Cannot open $index for writing: $!"; $INDEX = "INDEX"; # get a list of files from stdin @files = (); while ( <> ) { chop; s@^\./@@; push(@files,$_) if ( -r && -T && ! m@(^|/)$indexname$@o ); } %index = (); print STDERR "$0: indexing ", (scalar @files), " files: " if ( $verbose ); $nentries = 0; $fileindex = -1; foreach ( @files ) { $fileindex ++; $lineno = 0; $pos = 0; open(FILE, "<$_") || next; $nkeys = 0; while ( $line = ) { print STDERR "$line\n" if ( $verbose > 1 ); $lineno ++; while ( $line =~ m/([_a-zA-Z][_a-zA-Z0-9]*)/g ) { $linepos = $pos + (pos $line) - length($1); $index{$1} .= "$fileindex:$lineno:$linepos "; print STDERR "$fileindex:$lineno:$linepos " if ( $verbose > 2 ); $nkeys ++; $nentries ++; } $pos += length($line); } close(FILE); print STDERR "$nkeys " if ( $verbose > 1 ); print STDERR "." if ( $verbose ); } print STDERR "\n" if ( $verbose ); ##################################################################### # Create a unique list of keys @keys = sort(keys(%index)); print STDERR "$0: ", scalar @keys, " unique keys, $nentries citations\n" if ( $verbose ); ##################################################################### # Write version string print $INDEX "mkindex $version\n"; # Write timestamp print $INDEX "timestamp ", time, "\n"; # Write file table print $INDEX "files ", scalar @files, "\n"; print $INDEX join("\n", @files); print $INDEX "\n\n"; # Write index print $INDEX "keys ", scalar @keys, "\n"; foreach ( sort(keys(%index)) ) { print $INDEX "$_ $index{$_}\n"; } print $INDEX "\n\n"; close(INDEX); ##################################################################### 0; memdebug0.1/src/bin/mvr.pl0100644000175200017560000000331307001176324016037 0ustar stephensstephens#!/usr/bin/perl use File::Find; package mvr; sub wanted { my($dir) = $File::Find::dir; my($old, $new); $old = $new = $_; print STDERR "$dir/$old\n" if ( $mvr::verbose > 1 ); if ( &mvr::match($new) ) { if ( $mvr::interactive ) { print STDERR "mv $dir/$old $dir/$new? [y] "; my($line); $line = ; return 0 if ( $line !~ /y/i ); } print STDERR "mv $dir/$old $dir/$new\n" if ( $mvr::verbose || $mvr::debug ); if ( ! $mvr::debug ) { my($tmp) = "$new.$$"; die "$dir/$tmp exists" if ( -e $tmp ); rename($old, $tmp) || die "mv $dir/$old $dir/$tmp failed: $!"; rename($tmp, $new) || print STDERR "mv $dir/$old $dir/$new: $!\n"; } } 0; } sub mvr { $mvr::debug = 0; $mvr::verbose = 1; $mvr::interactive = 0; while ( defined ($_ = shift @_) ) { if ( s/^--?// ) { while ( s/i(nteractive)?// ) { $mvr::interactive ++; } while ( s/d(ebug)?// ) { $mvr::debug ++; } while ( s/v(erbose)?// ){ $mvr::verbose ++; } if ( s/[h?]// ) { print STDERR qq~ $0 [-dvi] FROM TO Rename all files that match regexpr FROM to TO under the current directory. Options: -d[ebug] Enable debugging, does not actually rename. -i[interactive] Interactive; prompts on stderr for confirmation. -v[erbose] Enable verbose messages. -?|-h[elp] This help message. ~; return 1; } } else { $o = $_; $n = shift @_; if ( defined $n ) { print STDERR "mvr $o $n\n" if ( $verbose ); eval 'sub mvr::match { $_[0] =~ s/^' . $o . '$/' . $n . '/; }'; File::Find::find(\&wanted, '.'); } } } 0; } #print STDERR "$0\n"; if ( $0 =~ m@/mvr.pl$@ ) { mvr(@ARGV); } 1; memdebug0.1/src/bin/nmlibs0100644000175200017560000000042706662461243016121 0ustar stephensstephens#!/bin/sh if [ -z "$LIBDIRS" ] then LIBDIRS="/lib /usr/lib" fi LIBDIRS="$* $LIBDIRS" for d in $LIBDIRS do (cd $d for f in lib*.a *.o do nm -gp "$f" | awk ' BEGIN { name = "'$d/$f'"; } /^.*:/ { name = "'$d'/" $1; } { print name, $0, "\n"; }' done ) done memdebug0.1/src/bin/nmm0100755000175200017560000000010006662461243015413 0ustar stephensstephens#!/bin/sh for f do nm "$f" | awk '{ print "'$f'", $0; }' done memdebug0.1/src/bin/objcsyms0100644000175200017560000000457306662461244016475 0ustar stephensstephens#!perl $tmp || ($tmp = $ENV{'TEMP'}); $tmp || ($tmp = $ENV{'TMP'}); $tmp || ($tmp = '/tmp/'); $symbols = (); $nm = '/bin/nm'; $dumpbin = 'dumpbin'; if ( -e $nm ) { # NeXT eval q@ $libprefix = 'lib'; $libsuffix = '.a'; $frameworksuffix = ''; sub refsym { $v && print STDERR "$0: refsym: $_[0]\n"; print C 'asm(".reference ', $_[0], '");', "\n"; } sub do_ObjC_symbols { open(F,"$nm -gp $_ |") || die "$!: cannot read $_"; while ( ) { if ( /\s+[ATDB]\s+(.objc_(class|category)_name_[a-zA-Z0-9_]+)/ ) { &refsym($1); } } close(F); } @; } else { # WinNT eval q@ $libprefix = ''; $libsuffix = '.lib'; $frameworksuffix = '.lib'; sub refsym { $v && print STDERR "$0: refsym: $_[0]\n"; print C 'asm(".global ', $_[0], '");', "\n"; } sub do_ObjC_symbols { open(F,"$dumpbin /symbols /exports $_ |") || die "$!: cannot read $_"; while ( ) { if ( /\s+External\s+(.objc_(class|category)_name_[a-zA-Z0-9_]+)/ ) { &refsym($1); } } close(F); } @; } @libs = (); @libpaths = ("/usr/lib", "/lib"); @frameworkpaths = ("$NEXT_ROOT/LocalLibrary/Frameworks", "$NEXT_ROOT/NextLibrary/Frameworks"); sub findinpath { $f = shift @_; while ( $_ = shift @_ ) { $ft = $_ . '/' . $f; $v && print "$0: try: $ft\n"; if ( -e $ft ) { $v && print "$0: found: $ft\n"; return $ft; } } 0; } $ObjC = 0; $v = 0; $cf = "$tmp$$.c"; while ( $_ = shift @ARGV ) { push(@args, $_); if ( /^-(o|b|V|include|imacros|idirafter|iprefix|iwithprefix)$/ ) { shift @ARGV; } elsif ( /^-ObjC(++)?$/ ) { $ObjC ++; push(@args, $cf); } elsif ( /^-v$/ ) { $v ++; } elsif ( /^-L(.+)$/ ) { push(@libpaths, $1); } elsif ( /^-l(.+)$/ ) { if ( $ft = &findinpath("$libprefix$1$libsuffix", @libpaths) ) { push(@libs, $ft); } } elsif ( /^-F(.+)$/ ) { push(@frameworkpaths, $1); } elsif ( /^-framework$/ ) { push(@args, $_ = shift @ARGV); if ( $ft = &findinpath("$_.framework/$_$frameworksuffix", @frameworkpaths) ) { push(@libs, $ft); } } } if ( $ObjC ) { open(C,">$cf") || die "$!: cannot create $cf"; &refsym('_main'); # force linking foreach ( @libs ) { &do_ObjC_symbols(); } close(C) || die "$!: cannot close $cf"; push(@args, $cf); } else { $cf = 0; } $v && print STDERR join(" ", @args), "\n"; $errors = system(@args) / 256; $cf && unlink($cf); exit $errors; 1; #PERLEND memdebug0.1/src/bin/publish.pl0100644000175200017560000004404607364175364016730 0ustar stephensstephens#!/usr/local/bin/perl # $Id: publish.pl,v 1.12 2001/10/20 04:17:56 stephens Exp $ # TO DO # * Fix problems with non "../" REQUIRES_PKGS # ############################################################################## use Carp; use File::Basename; use Cwd; # fastgetcwd use Cwd 'fast_abs_path'; $progdir = fast_abs_path(dirname($0)); push(@INC, $progdir, "$progdir/lib/perl"); eval 'use ion::_cvs::revhist;'; ############################################################################## $time = time(); { my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($time); $sec = '0' . $sec if ( $sec < 10 ); $min = '0' . $min if ( $min < 10 ); $hour = '0' . $hour if ( $hour < 10 ); $mon ++; $mon = '0' . $mon if ( $mon < 10 ); $mday = '0' . $mday if ( $mday < 10 ); $year += 1900; $timestr = "$year/$mon/$mday $hour:$min:$sec"; } ############################################################################## $tmp_root = "/usr/tmp"; $tmp_root = fast_abs_path($tmp_root); $tmp = "$tmp_root/t" . abs($$); mkdir($tmp, 0777) || die "$!: $tmp"; sub END { #print STDERR "in END\n"; system("rm", "-rf", $tmp) if ( $tmp ); } ############################################################################## $sep = '=' x 78; sub basename { my($x) = @_; $x =~ s@^.*[/\\]@@; $x; } sub dirname { my($x) = @_; #print STDERR "dirname('$x') = "; if ( $x !~ s@[/\\][^/\\]+$@@ ) { $x = '.'; } #print STDERR "'$x'\n"; $x; } sub absname { my($x) = @_; #print STDERR "absname('$x') = "; if ( $x !~ m@^([a-zA-Z]:)?[/\\]@ ) { $x = fastgetcwd() . '/' . $x; } #print STDERR "'$x'\n"; $x; } sub unix_path { my($x) = @_; #print STDERR "unix_path('$x') = "; $x =~ y@\\@/@; $x !~ s@^([a-zA-Z]):@//$1@; #print STDERR "'$x'\n"; $x; } sub mkdirs { my($p, $m) = @_; if ( ! defined($m) ) { $m = 0777; } if ( -d $p ) { 1; } else { my($pdir) = dirname($p); if ( ! -d $pdir ) { mkdirs($pdir, $m); } mkdir($p, $m); } } sub appendFileToHandle { my($in,$OUT) = @_; open(__F, "<$in"); while ( $in = <__F> ) { print $OUT $in; } close(__F); } sub readFile { my($r, $l); open(__F, "<$_[0]") || return; $r = ''; while ( $l = <__F> ) { $r .= $l; } close(__F); $r; } sub copyFile { my($src, $dst) = @_; my($l); open($src, "< $src") || die "$src: $!:"; open($dst, "> $dst") || die "$dst: $!:"; while ( $l = <$src> ) { print $dst $l; } close($src); close($dst); } sub copyDir { my ($src, $dst) = @_; my $src = unix_path($src); my $dst = unix_path($dst); mkdirs($dst, 0777); system("sh -c '$tar -C $src -cf - . | $tar -C $dst -x${tar_verbose}f -'") && die "tar: $!"; } sub readVars { my($file, $vars, $stopAtEmptyLine) = @_; $vars = {} if ( ! $vars ); open(F, "<$file") || return; LINE: while ( $_ = ) { chop; s/^\s+//; s/\s+$//; if ( /^\s*#/ ) { next LINE; } if ( $_ eq '' && $stopAtEmptyLine ) { last LINE; } my($key, $value) = (undef, undef); # KEY if ( s/^\s*([A-Za-z_0-9]+)// ) { $key = $1; # ='VALUE' if ( m/^\s*=\s*'([^']*)'\s*$/ ) { #' $value = $1; # ="VALUE" } elsif ( m/^\s*=\s*"([^"]*)"\s*$/ ) { #" $value = $1; # =VALUE } elsif ( m/^\s*=(.*)$/ ) { $value = $1; # [ ]VALUE } elsif ( m/^\s?(.*)$/ ) { $value = $1; } else { print STDERR "$0: unparsed line in $file: $key $_\n"; } } if ( defined($key) && defined($value) ) { $value =~ s/^\s+//; $value =~ s/\s+$//; $vars->{$key} = $value; } } close(F); $vars; } sub readPKG { my($pkg); $pkg = {}; $pkg->{src} = $_[0]; $pkg->{src_abs} = fast_abs_path($pkg->{src}); $pkg->{src_name} = basename($pkg->{src_abs}); $pkg->{src_dir} = dirname($pkg->{src_abs}); # Defaults $pkg->{NAME} = $pkg->{src_name}; $pkg->{README} = "README"; $pkg->{VERSION} = readFile("$pkg->{src}/VERSION"); $pkg->{VERSION} =~ y/\n/ /; $pkg->{VERSION} =~ s/^\s+//; $pkg->{VERSION} =~ s/\s+$//; $pkg->{CVSLOG} = 'CVSLOG'; $pkg->{DESC} = ''; $pkg->{CATEGORY} = ''; $pkg->{REQUIRES_PKGS} = ''; $pkg->{REQUIRES_OTHERS} = ''; $pkg->{MAKE} = 'make'; $pkg->{MAKE_CLEAN} = 'clean veryclean'; $pkg->{subpkgs} = []; $pkg->{parent} = $pkg; $pkg->{root} = $pkg; readVars("$pkg->{src}/PKG", $pkg); die "Package $pkg->{src} has no NAME" if ( $pkg->{NAME} eq '' ); print STDERR " WARNING: $pkg->{src_abs} has no VERSION\n" if ( $pkg->{VERSION} eq '' ); print STDERR " WARNING: $pkg->{src_abs} has no CATEGORY\n" if ( $pkg->{CATEGORY} eq '' ); print STDERR " WARNING: $pkg->{src_abs} has no DESC\n" if ( $pkg->{DESC} eq '' ); $pkg; } sub parsePkg { my($pkg, @more) = @_; my($pcwd); # Determine the copy dst $pkg->{dst} = $pkg->{root}->{dst_root} . "/" . $pkg->{src_name}; # Attempt to cd into package $pcwd = getcwd(); chdir($pkg->{src}) || die "chdir: $!: $pkg->{src}"; # Don't visit a package more than once if ( $pkg->{root}->{parsed}->{$pkg->{src_abs}} ) { return; } $pkg->{root}->{parsed}->{$pkg->{src_abs}} ++; # Add package to parent and root push(@{$pkg->{parent}->{subpkgs}}, $pkg); push(@{$pkg->{root}->{subpkgs_flat}}, $pkg); # Collect the other pkgs #print STDERR "REQUIRES_OTHERS='$pkg->{REQUIRES_OTHERS}'\n"; @others = split(/\s+/, $pkg->{REQUIRES_OTHERS}); $pkg->{others} = [ @others ]; # Add others to root foreach $r ( @others ) { $pkg->{root}->{others_map}->{$r} ++; } @{$pkg->{root}->{others_flat}} = sort(keys(%{$pkg->{root}->{others_map}})); # Collect subpkgs foreach $r ( split(/\s+/, $pkg->{REQUIRES_PKGS}), @more ) { my($subpkg) = readPKG($r); $subpkg->{parent} = $pkg; $subpkg->{root} = $pkg->{root}; parsePkg($subpkg); } # chdir($pcwd) || die "chdir: $!: $pcwd"; } sub copyPkg { my($rpkg) = @_; my($pkg); foreach $pkg ( @{$rpkg->{subpkgs_flat}} ) { # Copy the package into the dst area print STDERR " Copying $pkg->{src_abs} $pkg->{dst}\n"; copyDir($pkg->{src_abs}, $pkg->{dst}); print STDERR " Copying $pkg->{src_abs} $pkg->{dst}: DONE\n\n"; } } sub cleanPkg { my($rpkg) = @_; my($pkg); foreach $pkg ( @{$rpkg->{subpkgs_flat}} ) { # Clean up the dst area if ( -r "$pkg->{dst}/Makefile" ) { print STDERR " Cleaning $pkg->{dst}\n"; $dst = unix_path($pkg->{dst}); system("sh -c 'cd $dst && eval $pkg->{MAKE} __DISABLE_DEPS__=YES $pkg->{MAKE_CLEAN}'"); print STDERR " Cleaning $pkg->{dst}: DONE\n\n"; } } } sub commitPkg { my($rpkg) = @_; my($pkg); if ( defined($CVSROOT) ) { foreach $pkg ( @{$rpkg->{subpkgs_flat}} ) { # Clean up the dst area if ( -d "$pkg->{dst}/CVS" ) { my($msg, $cmd); # Commit print STDERR " Committing $pkg->{dst}\n"; $msg = "PUBLISH_$rpkg->{NAME}$rpkg->{VERSION}"; $cmd = "$CVS commit -m \"$msg\" $pkg->{dst}"; print STDERR " $cmd\n"; system($cmd) && die "$cmd"; print STDERR " Committing $pkg->{dst}: DONE\n\n"; # Tag $msg = "PUBLISH_$rpkg->{NAME}$rpkg->{VERSION}"; $msg =~ tr/A-Za-z0-9_/_/c; print STDERR " Tagging $pkg->{dst} as $msg\n"; $cmd = "$CVS tag "; $cmd .= "-F " if ( $force ); $cmd .= "-c $msg $pkg->{dst}"; print STDERR " $cmd\n"; system($cmd) && die "$cmd"; print STDERR " Tagging $pkg->{dst} as $msg: DONE\n\n"; # Log #print STDERR " Logging CVS versions $pkg->{dst}\n"; #$cmd = "$CVS log -h -N -r$msg $pkg->{dst} > $pkg->{dst}/$pkg->{CVSLOG}"; #print STDERR " $cmd\n"; #system($cmd) && die "$cmd"; #print STDERR " Logging CVS versions $pkg->{dst}: DONE\n\n"; } } } } sub createPkgFiles { my($rootpkg) = @_; foreach $pkg ( @{$rootpkg->{subpkgs_flat}} ) { # Append README $file = "$pkg->{dst}/$pkg->{README}"; if ( $pkg->{README} ne '' && -r $file ) { print dst_README "$pkg->{NAME} $pkg->{VERSION} README\n"; print dst_README "$sep\n"; appendFileToHandle($file, 'dst_README'); } # Append PUB { my(%x); %x = %$pkg; $x{SRC_DIR} = $x{src_abs}; foreach $k ( NAME, VERSION, CATEGORY, DESC, SRC_DIR ) { print PUB $k, " ", $x{$k}, "\n"; delete $x{$k}; } foreach $k ( sort(grep(/^[A-Z_0-9]+$/, keys(%x))) ) { print PUB $k, " ", $x{$k}, "\n"; } print PUB "\n"; } } foreach $r ( @{$rootpkg->{others_flat}} ) { print PUB "OTHER $r\n\n"; } } sub createPkg { my $pkg; $pkg = readPKG($_[0]); print STDERR "Publishing $_[0]\n"; $dst_name = "$pkg->{src_name}$pkg->{VERSION}"; $dst_dir = "$tmp/$dst_name"; $dst_root = "$dst_dir/src"; mkdirs($dst_root, 0777) || die "$dst_root: $!"; $pkg->{dst_root} = $dst_root; $pkg->{parsed} = {}; $pkg->{others_map} = {}; $pkg->{subpkgs_flat} = []; $pkg->{others_flat} = []; ######################################################################### # Recursively parse packages parsePkg($pkg); ######################################################################### # Copy the entire package copyPkg($pkg); ######################################################################### # Clean the entire package cleanPkg($pkg); ######################################################################### # CVS commit the entire package commitPkg($pkg); ######################################################################### # The files we are going to publish $filev = $pkg->{src_name} . $pkg->{VERSION}; $txt = "$PUBLISH_DIR/$filev.txt"; $archive = "$PUBLISH_DIR/$filev.tgz"; $pub = "$PUBLISH_DIR/$filev.pub"; ######################################################################### # Init PUB file die "$pub already exists, try -force option" if ( -f $pub && ! $force ); open(PUB, ">$pub") || die "$pub: $!"; print PUB "NAME $pkg->{NAME}\n"; print PUB "VERSION $pkg->{VERSION}\n"; print PUB "CATEGORY $pkg->{CATEGORY}\n"; print PUB "DESC $pkg->{DESC}\n"; @subpkg_names = map($_->{NAME}, @{$pkg->{subpkgs_flat}}); print PUB "CONTAINS_PKGS ", join(' ', @subpkg_names), "\n"; print PUB "REQUIRES_OTHERS ", join(' ', @{$pkg->{others_flat}}), "\n"; print PUB "DATE $timestr\n"; #print PUB "MD5 $\n"; print PUB "README $txt\n"; print PUB "ARCHIVE $archive\n"; print PUB "\n"; ################################################################## # Init README, TOC files $dst_README = "$dst_dir/README"; open(dst_README, ">$dst_README") || die "$dst_README: $!"; print dst_README "$pkg->{NAME} $pkg->{VERSION} README\n"; print dst_README "$sep\n\n"; ################################################################## # Add GUM_BUILD_ROOT $GUM_BUILD_ROOT = "$pkg->{src_abs}/../GUM_BUILD_ROOT"; if ( -r $GUM_BUILD_ROOT ) { copyFile($GUM_BUILD_ROOT, "$dst_dir/src/GUM_BUILD_ROOT"); } ################################################################## # Add CVS #$ROOT_CVS = "$pkg->{src_abs}/../CVS"; #if ( -r $ROOT_CVS ) { #copyDir($ROOT_CVS, "$dst_dir/src/CVS"); #} ################################################################## # Add copyright $COPYRIGHT = "$pkg->{src_abs}/../COPYRIGHT"; if ( -r $COPYRIGHT ) { copyFile($COPYRIGHT, "$dst_dir/COPYRIGHT"); } appendFileToHandle($COPYRIGHT, dst_README); print dst_README "\n$sep\n\n"; ################################################################## # Add license $LICENSE = "$pkg->{src_abs}/../LICENSE"; if ( -r $LICENSE ) { copyFile($LICENSE, "$dst_dir/LICENSE"); appendFileToHandle($LICENSE, dst_README); print dst_README "\n$sep\n\n"; } ################################################################## # Create CHANGES $dst_CHANGES = "$dst_dir/CHANGES"; print STDERR " Creating CHANGES $dst_CHANGES\n"; open(dst_CHANGES, ">$dst_CHANGES") || die "$dst_CHANGES: $!"; print dst_CHANGES "$pkg->{NAME} $pkg->{VERSION} CHANGES\n"; print dst_CHANGES "$sep\n\n"; close(dst_CHANGES); my($save_cwd) = getcwd; chdir($dst_dir) || die "$dst_dir: $!"; if ( $pkg->{CHANGES_RELEASES} ) { my(@rels) = split(/\s+/, $pkg->{CHANGES_RELEASES}); @rels = map( "PUBLISH_" . $pkg->{NAME} . $_, @rels); @rels = grep( (tr/a-zA-Z0-9_/_/c, 1), @rels); push(@rels, ''); #print STDERR "rels = '", join("' '", @rels), "'\n"; #exit -1; my($r1, $r2); $r2 = shift(@rels); while ( $r1 = $r2, defined($r2 = shift(@rels)) ) { open(dst_CHANGES, ">>$dst_CHANGES") || die "$dst_CHANGES: $!"; print dst_CHANGES "\n$sep\nChanges from release '$r2' to '$r1'\n"; print dst_CHANGES "$sep\n\n"; close(dst_CHANGES); print STDERR " Changes from release '$r2' to '$r1'\n"; $cmd = "perl $progdir/cvsrevhist.pl -f=-r$r2:$r1 . >> $dst_CHANGES"; print STDERR "$cmd\n"; system("sh -c '$cmd'") && die "$cmd: $!"; } } else { $cmd = "perl $progdir/cvsrevhist.pl . >> $dst_CHANGES"; system("sh -c '$cmd'") && die "$cmd: $!"; } chdir($save_cwd) || die "$save_cwd: $!"; print STDERR " Created CHANGES $dst_CHANGES: DONE\n\n"; ################################################################## # Create TOC $dst_TOC = "$dst_dir/TOC"; print STDERR " Creating TOC $dst_TOC\n"; open(dst_TOC, ">$dst_TOC") || die "$dst_TOC: $!"; print dst_TOC "$pkg->{NAME} $pkg->{VERSION} Table of Contents\n"; print dst_TOC "$sep\n"; close(dst_TOC); # Use ls -lagR system("sh -c 'cd $tmp && ls -lagR $dst_name >> $dst_TOC'"); # Fill in the pkg files createPkgFiles($pkg); # Close output files close(PUB); close(dst_README); print STDERR " Created TOC $dst_TOC: DONE.\n\n"; ######################################################################## # Create the external readme print STDERR " Creating README $txt\n"; open(TXT, ">$txt"); appendFileToHandle($dst_README, TXT); print TXT "$sep\n\n"; print dst_TOC "$pkg->{NAME} $pkg->{VERSION} Package Info\n"; print TXT "$sep\n\n"; appendFileToHandle($pub, TXT); print TXT "$sep\n\n"; appendFileToHandle($dst_CHANGES, TXT); print TXT "$sep\n\n"; appendFileToHandle($dst_TOC, TXT); print TXT "$sep\n\n"; close(TXT); print STDERR " Created README $txt: DONE.\n\n"; ######################################################################## # Create archive and finish TOC print STDERR " Creating $pkg->{NAME} archive $archive\n"; system("sh -c '$tar -C $tmp -c${tar_verbose}f - $dst_name | $gzip -9 > $archive'"); print STDERR " Created $pkg->{NAME} archive $archive: DONE.\n\n"; ######################################################################## # Remove the temp directory system("rm", "-rf", $dst_dir); print STDERR "Publishing $_[0]: DONE\n\n"; } ############################################################################## # tar, gzip $tar = 'tar'; $tar_verbose = 'v'; $tar_verbose = ''; $gzip = 'gzip'; # cvs $CVSROOT = $ENV{CVSROOT}; $CVS = $ENV{CVS}; $CVS = 'cvs.exe' if ( ! defined($CVS) ); $PUBLISH_DIR = $ENV{PUBLISH_DIR}; $PUBLISH_DIR = 'd:/data/ion/www/research/pub' if ( ! $PUBLISH_DIR ); ############################################################################## # Parse arguments @pkgs = (); $index = 0; $reldir = ""; $force = 0; while ( $_ = shift @ARGV ) { if ( /^-?-i/ ) { $index = shift; } elsif ( /^-?-f/ ) { $force ++; } elsif ( /^-?-p/ ) { $PUBLISH_DIR = shift; } elsif ( /^-?-r/ ) { $reldir = shift; } else { push(@pkgs, $_); } } ############################################################################## # Create each package foreach $pkg ( @pkgs ) { createPkg($pkg); } ############################################################################## # Create package index sub size_str { "(" . (-s $_[0]) . " bytes)"; } if ( $index ) { #Pkgs by CATEGORY %c = (); if ( $reldir ne '' && $reldir !~ m@[/\\]$@ ) { $reldir .= '/'; } # Read each published pkg's data file foreach $pub ( glob("$PUBLISH_DIR/*.pub") ) { my($pkg) = readVars($pub, undef, 1); # Arrange by CATEGORY $pkg->{CATEGORY} = "UNKNOWN-CATEGORY" if ( $pkg->{CATEGORY} eq '' ); $pkg->{DESC} = "No Description Available. See README." if ( ! $pkg->{DESC} ); $pkg->{pub} = $pub; $pkg->{pub_file} = basename($pub); if ( ! defined($c{$pkg->{CATEGORY}}) ) { $c{$pkg->{CATEGORY}} = [ ]; } push(@{$c{$pkg->{CATEGORY}}}, $pkg); } @cats = sort(keys(%c)); # Open the index file open(INDEX, ">$index") || die "$index: $!"; # List the cats print INDEX "

Package Categories

\n"; print INDEX "
    \n"; $ci = 0; foreach $cat ( @cats ) { $ci ++; print INDEX qq@
  • $cat\n@; } print INDEX "
\n"; # Print each cat $ci = 0; foreach $cat ( @cats ) { $ci ++; print INDEX qq@

$cat

\n@; print INDEX "
\n"; foreach $pkg ( sort { $a->{NAME} cmp $b->{NAME} || $b->{VERSION} <=> $a->{VERSION} } @{$c{$cat}} ) { my($NAME) = uc($pkg->{NAME}); my($VERSION) = $pkg->{VERSION}; my($DESC) = $pkg->{DESC}; my($ARCHIVE) = basename($pkg->{ARCHIVE}); my($README) = basename($pkg->{README}); print INDEX qq@
$NAME $VERSION
$DESC\n@; print INDEX qq@
Date: $pkg->{DATE}\n@; print INDEX qq@
Requires: $pkg->{REQUIRES_OTHERS}\n@ if ( $pkg->{REQUIRES_OTHERS} ne '' ); print INDEX qq@
View README @ . &size_str($pkg->{README}) . "\n"; print INDEX qq@
View package info @ . &size_str($pkg->{pub}) . "\n"; print INDEX qq@
Download $ARCHIVE @ . &size_str($pkg->{ARCHIVE}) . "\n"; print INDEX qq@
\n@; } print INDEX "
\n"; } print INDEX "
\n"; # Close the index file close(INDEX); print STDERR "Created index $index\n"; } 1; memdebug0.1/src/bin/sci0100644000175200017560000000561506662461244015420 0ustar stephensstephens#!/bin/sh #set -x #exec=/bin/echo exec= force= y='Checkpoint' fs= tarfs= cmd="$1" opts="" shift while /bin/test $# -gt 0 do f="$1" shift case "$f" in -TEST) exec=/bin/echo opts="$opts $f" ;; -f) force=1 opts="$opts $f" ;; -y) y="$1" shift ;; SCCS) ;; .) /bin/ls SCCS | /bin/sed -e '/^s\./!d' -e 's@^s\.@@' | /usr/bin/xargs -n1024 $0 "$cmd" $opts -y "$y" ;; */*) (cd `/bin/expr "$f" : '\(.*\)/.*'` && $0 "$cmd" $opts -y "$y" `/bin/expr "$f" : '.*/\(.*\)'`) ;; *) if /bin/test -d "$f" then if /bin/test -f "SCCS/s.$f.tar" then f="$f.tar" fs="$fs $f" else /bin/ls "$f" | (cd "$f" && /usr/bin/xargs -n1024 $0 "$cmd" $opts -y "$y") fi else fs="$fs $f" fi ;; esac done case "$cmd" in get|ci|edit|editopen|update) _fs="$fs"; fs="" for f in $_fs do if /bin/test -f "SCCS/s.$f" then fs="$fs $f" if /bin/test -n "$force" then /bin/chmod -w "$f" fi else echo "$f: no SCCS/s.$f" fi done ;; esac case "$cmd" in create|ci|edit|editopen|update) _fs="$fs"; fs="" for f in $_fs do if /bin/test -f "SCCS/p.$f" then echo "$f: SCCS/p.$f exists:" `cat SCCS/p.$f` else fs="$fs $f" fi done ;; esac for f in $fs do case "$f" in *.tar) tarfs="$tarfs $f" ;; esac done case "$cmd" in ci|delget|delta|create) for f in $tarfs do d=`/usr/bin/basename $f .tar` $exec /bin/rm -f "$f" $exec /bin/chmod -Rf ugo+wr "$d" $exec tar -cvf - "$d" > "$f" done ;; esac case "$cmd" in ci|create) _fs="$fs"; fs="" for f in $_fs do if /bin/test -r "$f" then fs="$fs $f" else echo "$f: not readable" fi done ;; esac if /bin/test -n "$fs" then case "$cmd" in update) set +x for f in $fs do sf="SCCS/s.$f" /usr/bin/find "$sf" -newer "$f" -print done | /bin/sed -e 's@^SCCS/s\.@@' | /usr/bin/xargs -n1024 $0 get $opts ;; ci|cie) for f in $fs do $exec /bin/mv "$f" "$f.sci.$$" done $exec scc edit $fs for f in $fs do $exec /bin/mv "$f.sci.$$" "$f" done $exec /bin/chmod +w $fs if /bin/test "$cmd" = "cie" then $exec scc deledit "-y$y" $fs else $exec scc delget "-y$y" $fs fi $exec /bin/date > 'CheckpointDate' ;; create|delget|deledit) $exec scc $cmd "-y$y" $fs ;; get|unedit|prs|diffs) $exec scc $cmd $fs ;; co|edit|editopen) $exec scc edit $fs ;; *) /bin/echo "$0: $cmd: bad command" ;; esac case "$cmd" in get|co|edit|create) for f in $tarfs do d=`/usr/bin/basename $f .tar` $exec /bin/rm -rf "$d" $exec tar -xvf "$f" $exec /bin/chmod -Rf ugo+wr "$d" done ;; esac case "$cmd" in editopen) $exec open -a Edit $fs ;; esac fi exit 0 memdebug0.1/src/bin/scip0100644000175200017560000000640006662461244015571 0ustar stephensstephens#!/run/thirdParty/perl5/bin/perl eval 'exec /run/thirdParty/perl5/bin/perl $0 ${1+"$@"}' if 0; $exec = 0; $y = 'Checkpoint'; @fs = (); @tarfs = (); sub _exec { if ( $exec ) { system(@_); } else { print STDERR @_, "\n"; } } sub warning { print STDERR "$0: ", @_, "\n"; } sub getdir { my($dir) = $_[0]; my(@filenames); opendir(DIR,$dir) || (warning "Can't open $dir: $!\n", return); @filenames = readdir(DIR); closedir(DIR); grep(($_ ne '.' && $_ ne '..'), @filenames); } sub sfile { ( $_[0] =~ m/^(.*/)([^/]+)$/ ) ? "$1SCCS/$_[1].$2" : "SCCS/$_[1].$_[0]"; } sub dofile { if ( -d ) { if ( -f &sfile("$_.tar", 's') ) { $_ .= '.tar'; push(@fs, $_); } else { } } else { push(@fs, $_); } } $cmd = shift; while ( shift ) { if ( $_ eq '-TEST' ) { $exec = 0; } elsif ( $_ eq '-y' ) { $y = shift; } elsif ( $_ eq 'SCCS' || $_ eq 'RCS' ) { } elsif ( $_ eq '.' ) { my(@x) = &getdir('SCCS'); grep((s/^s.//, 1), @x); push(@ARGV, @x); } elsif ( m@/@ ) { } else { if ( -d ) { if ( -f &sfile_("$_.tar", 's') ) { $_ .= '.tar'; push(@fs, $_); } else { $d = $_; for ( &getdir($d) ) { &dofile("$d/$_"); } } } else { push(@fs, $_); } } } if ( $cmd =~ m/^(get|ci|edit|editopen|update)$/ ) { @_fs = @fs; @fs = (); for ( @_fs ) { $sf = &sfile($_, 's'); if ( -f $sf ) { push(@fs, $_); } else { &warning("$_: no $sf"); } } } if ( $cmd =~ m/^(create|ci|edit|editopen|update)$/ ) { @_fs = @fs; @fs = (); for ( @_fs ) { if ( -f &sfile($_, 'p') ) { &warning("$_: is under edit"); } else { push(@fs, $_); } } } @tarfs = (); for ( @fs ) { if ( m/\.tar$/ ) { push(@tarfs, $_); } } if ( $cmd =~ m/^(ci|delget|delta|create)$/ ) { for ( @tarfs ) { m@^(.*)\.tar$@; $d = $1; &_exec('/bin/rm', '-f', $_); &_exec('/bin/chmod', '-Rf', 'ugo+wr', $d); &_exec("tar -cvf - $d > $_"); } } if ( $cmd =~ m/^(ci|create)$/ ) { @_fs = @fs; @fs = (); for ( @_fs ) { if ( -r $_ ) { push(@fs, $_); } else { &warning("$_: not readable"); } } } if ( @fs ) { if ( $cmd eq 'update' ) { for ( @fs ) { $sf = &sfile($_, 's'); if ( (-M $sf) > (-M $_) ) { &warning("$_: is out of date with $sf"); } } } elsif ( $cmd =~ m/^(ci|cie)$/ ) { for ( @fs ) { &_exec('/bin/mv', $_, "$f.sci.$$"); } &_exec('scc', 'edit', @fs); for ( @fs ) { &_exec('/bin/mv', "$f.sci.$$", $_); } &_exec('/bin/chmod', '+w', @fs); &_exec('scc', ( $cmd eq 'cie' ? 'deledit' : 'delget' ), "-y$y", @fs); #$exec /bin/date > 'CheckpointDate' } elsif ( $cmd =~ m/^(create|delget|deledit)$/ ) { &_exec('scc', $cmd, "-y$y", @fs); } elsif ( $cmd =~ m/^(get|unedit)$/ ) { &_exec('scc', $cmd, @fs); } elsif ( $cmd =~ m/^(co|edit|editopen)$/ ) { &_exec('scc', 'edit', @fs); } else { &warning("$cmd: bad command"); } if ( $cmd =~ m/^(get|co|edit|create)$/ ) { for ( @tarfs ) { m@^(.*)\.tar$@; $d = $1; &_exec('/bin/rm', '-rf', $d); &_exec("tar", '-xvf', $_); &_exec('/bin/chmod', '-Rf', 'ugo+wr', $d); } } } 1; memdebug0.1/src/bin/si0100644000175200017560000000013407001136307015227 0ustar stephensstephens#!/bin/sh #set -x echo '#include "'"$1"'"' | gcc -E - | awk 'NF' | egrep -v -e '^#' | less memdebug0.1/src/bin/split.c0100644000175200017560000000450606663227006016211 0ustar stephensstephens #ifndef __rcs_id__ #ifndef __rcs_id_bin_split_c__ #define __rcs_id_bin_split_c__ static const char __rcs_id_bin_split_c[] = "$Id: split.c,v 1.2 1999/02/19 09:25:26 stephensk Exp $"; #endif #endif /* __rcs_id__ */ #include #include /* malloc(), free() */ #include /* strlen(), strcpy(), strcat(), strcmp() */ static char *progname; #ifdef BC #include /* O_BINARY */ #include #endif static int dofile(unsigned long fsize, FILE *in, const char *name) { char *fname; int fn; int rtnval = 0; fname = malloc(sizeof(fname[0]) * (strlen(name) + 5)); fn = 0; do { FILE *out; unsigned long bytes_left; { char buf[5]; sprintf(buf, ".%03d", (int) fn ++); strcpy(fname, name); strcat(fname, buf); if ( (out = fopen(fname, "wb")) == 0 ) { fprintf(stderr, "%s: cannot open \"%s\" for writing\n", progname, fname); rtnval = -1; goto rtn; } } bytes_left = fsize; while ( bytes_left ) { int c; if ( (c = getc(in)) == EOF ) { fclose(out); rtnval = 0; goto rtn; } else { putc(c, out); bytes_left --; } } fclose(out); } while ( 1 ); rtn: free(fname); return rtnval; } int main(int argc, char **argv) { int i; char *outname = 0; unsigned long fsize = 1440000UL; int rtnval = 0; progname = argv[0]; #ifdef BC _fmode = O_BINARY; #endif for ( i = 1; i < argc; i ++ ) { if ( argv[i][0] == '-' ) { switch ( argv[i][1] ) { case 's': fsize = atol(argv[i][2] ? argv[i] + 2 : argv[++ i]); break; case 'o': outname = argv[i][2] ? argv[i] + 2 : argv[++ i]; break; default: fprintf(stderr, "%s: bad option \"%s\"\n", progname, argv[i]); break; } } else { FILE *in; char *inname = argv[i]; if ( strcmp(inname, "-") == 0 ) { in = stdin; } else if ( (in = fopen(inname, "rb")) == 0 ) { fprintf(stderr, "%s: cannot open \"%s\" for reading\n", progname, inname); rtnval ++; } if ( outname == 0 ) { char *p; outname = malloc(sizeof(outname[0]) * (strlen(inname) + 2)); strcpy(outname, inname); if ( (p = strrchr(outname, '.')) ) { *p = '\0'; } else { strcat(outname, "."); } } rtnval += dofile(fsize, in, outname); if ( in != stdin ) fclose(in); } } return rtnval; } memdebug0.1/src/bin/tgz0100744000175200017560000000445607230344242015437 0ustar stephensstephens#!/bin/sh # $Id: tgz,v 1.6 2001/01/14 15:41:22 stephens Exp $ #set -x if [ -z "$TAR" ] then TAR=tar fi if [ -z "$GZIP" ] then GZIP=gzip fi if [ -z "$BZIP" ] then BZIP=bzip2 fi if [ -z "$BUNZIP" ] then BUNZIP=bunzip2 fi if [ -z "$GUNZIP" ] then GUNZIP="$GZIP -d" fi if [ -z "$COMPRESS" ] then COMPRESS=compress fi c= C=. o= tv= s=.tgz x=x #set -x while [ $# -gt 0 ] do case "$1" in -c) c=1 ;; -o) o="$2" shift ;; -s) s="$2" shift ;; -C) C="$2" shift ;; -*) case "$1" in -*t*) tv="${tv}t" x= ;; esac case "$1" in -*v*) tv="${tv}v" ;; esac ;; *) if [ -d "$1" -o -n "$c" ] then d=`expr "$1" : '\(.*\)/[^/]*' '|' '.'` f=`expr "$1" : '.*/\([^/]*\)' '|' "$1"` if [ -z "$o" ] then o="$f$s" fi case "$o" in *.tb2|*.TB2|*.tar.bz2|*_tar.bz2|*_TAR.BZ2) cmd="(cd $d && $TAR -c${tv}f - '$f' ) | (cd '$C' && $BZIP -9 > '$o')" ;; *.tgz|*.TGZ|*.tar.gz|*_TAR.GZ) cmd="(cd $d && $TAR -c${tv}f - '$f' ) | (cd '$C' && $GZIP -9 > '$o')" ;; *.tar|*.TAR|*.gtar|*.GTAR) cmd="(cd $d && $TAR -c${tv}f - '$f' ) | (cd '$C' && cat - > '$o')" ;; *.gz|*.GZ|*.gzip|*.GZIP) cmd="(cd $d && $GZIP -9 -c '$f' ) | (cd '$C' && cat - > '$o')" ;; *.bz|*.BZ|*.bz2|*.BZ2) cmd="(cd $d && $BZIP -9 -c '$f' ) | (cd '$C' && cat - > '$o')" ;; esac echo $cmd eval $cmd o= elif [ -f "$1" ] then if [ -z "$o" ] then o="." fi if [ ! -d "$o" ] then mkdir "$o" fi case "$1" in *.tgz|*.tar.gz|*.TGZ|*.tz|*.TZ) cmd="$GUNZIP < '$1' | (cd '$o' && $TAR -$x${tv}f -)" ;; *.tbz|*.TBZ|*.tar.b2|*.tb2|*.TB2|*_tar.bz2|*_TAR.BZ2) cmd="$BUNZIP -d -c -k '$1' | (cd '$o' && $TAR -$x${tv}f -)" ;; *.bz|*.BZ) cmd="$BUNZIP -d -k '$1'" ;; *.gz|*.GZ) cmd="$GUNZIP -d -c < '$1'" ;; *.tar|*.TAR|*.gtar|*.GTAR) cmd="(cd '$o' && $TAR -$x${tv}f -) < '$1'" ;; *) echo "$0: $1: unknown suffix" 1>&2 cmd="" ;; esac if [ -n "$cmd" ] then echo $cmd eval $cmd fi o= x=x else : fi ;; esac shift done memdebug0.1/src/bin/ts0100644000175200017560000000316707065620573015270 0ustar stephensstephens#!/bin/sh set -x action="$1" shift [ -z "$GDB" ] && GDB='gdb' target=gdb files='' while [ $# -gt 0 ] do case "$1" in -t) target="$2" shift; ;; *=*) eval "$1" ;; *) files="$files $1" ;; esac shift done for f in $files do pre='cat -' post='' gdbx='' run_in_db() { _app="$1"; shift gdbx="/tmp/gdbx" echo "#Created by $0: DO NOT MODIFY" > $gdbx echo "break main" >> $gdbx echo "run $*" >> $gdbx $GDB $_app -x $gdbx rm $gdbx } case "$target" in *gdb*) _APP="${APP}" gdbx="/tmp/gdbx" echo "#Created by $0: DO NOT MODIFY" > $gdbx do_line() { case "$line" in \#*) echo "$line" >> $gdbx ;; run*) echo "shell echo '$line'" >> $gdbx echo "$line" >> $gdbx echo 'shell echo Hit return' >> $gdbx echo 'shell read line' >> $gdbx ;; *=*) eval "$line" ;; *) echo "shell echo '$line'" >> $gdbx eval echo "shell '$line'" >> $gdbx ;; esac } post='$target $APP -x $gdbx' ;; *time*) do_line() { echo "$line" case "$line" in \#*) ;; *=*) eval "$line" ;; *) eval "$line" ;; esac } run() { eval time $APP "$@" code=$? echo "=== $APP $@: terminated with $code" if [ $code -ne 0 ] then run_in_db $APP "$@" fi } ;; *) echo "$0: unknown target '$target'" 1>&2 ;; esac eval $pre < "$f" | while read line do do_line done [ -n "$gdbx" -a -r "$gdbx" ] && cat $gdbx eval $post donememdebug0.1/src/bin/uud0100744000175200017560000000417207262415712015431 0ustar stephensstephens#!/bin/perl # # scans files for a uuencoded items in files and decodes them to $dir # and adds a line to $db based on the Subject: lines found # $count = 0; $subject = ''; $dir = shift || die("Specify an output directory"); $db = "$dir/images.txt"; @files = (); %subjects = (); %files = (); $again = 0; while ( $again || defined($_ = <>) ) { $again = 0; chop; if ( s/^Subject:\s+// ) { $subject = $_; } elsif ( /^begin\s+(\S+)\s+(\S+)/ ) { $mode = $1; $file = $2; print STDERR "File: $file, Subject: $subject\n"; if ( $file ne '' ) { $str = ''; $nlines = 0; while ( defined($_ = <>) ) { $nlines ++; if ( $nlines % 100 ) { print STDERR "$nlines lines...\r"; } last if /^end/; if ( /^Subject:\s+/ || /^begin\s+(\S+)\s+(\S+)/ ) { print STDERR "WARNING: found $_"; $again ++; last; } next if /[a-z]/; next unless int((((ord() - 32) & 077) + 2) / 3) == int(length() / 4); $str .= unpack('u', $_); } # Remove dir from $file name $file =~ s@^.*/@@; # Add .jpg suffix if needed $file .= "_" . ($count ++) . ".jpg" if ( $file !~ /\.jpg$/ ); # Give it an orignal name if ( 0 ) { while ( -f "$dir/$file" ) { $file =~ s/_([0-9]+)(\.[^\.]+)$//; $suffix = $1; $file .= ($count ++) . $suffix; } } # If the file doesn't already exist if ( ! -f "$dir/$file" ) { # Add an entry to the index push(@files, $file); while ( defined($files{$subject}) ) { $subject =~ s/_([0-9]+)$//; $subject .= '_' . ($1 + 1); } $subjects{$file} = $subject; $files{$subject} = $file; # print "file = $file, mode = $mode, subject = $subject\n"; # Write the file open(F, ">$dir/$file"); binmode(F); print F $str; close(F); #exit(0); } } } } #Append to db $exists = -r $db; open(INDEX, ">>$db"); binmode(INDEX); print INDEX "Filename\tSubject\n" if ( ! $exists ); foreach $file ( sort(@files) ) { $subject = $subjects{$file}; print INDEX "$file\t$subject\n"; } close(INDEX); ########################################################################## 1; memdebug0.1/src/bin/uudindex0100744000175200017560000000711507262415713016462 0ustar stephensstephens#!/bin/perl # Creates a html index for stuff in $dir listed by $db # Run this after uud. # $dir = shift || "images"; $db = "$dir.txt"; $_html = '.html'; ########################################################################## @fieldnames = (); @fields = (); @records = (); @files = (); %subjects = (); %files = (); #Read db open(INDEX, "<$db"); binmode(INDEX); # First record is the field names $_ = ; chop; @fieldnames = split("\t", $_); $fieldindex = 0; foreach $fieldname ( @fieldnames ) { $fieldindex{$fieldname} = $fieldindex ++; } while ( ) { chop; @fields = split("\t", $_); push(@records, [ @fields ]); } close(INDEX); #Create index.html $menu = "menu_" . $fieldnames[0] . $_html; open(INDEX, ">$dir/index$_html"); binmode(INDEX); print INDEX qq@ None <BODY> <CENTER> This frameset document contains: <UL> <LI> <A HREF="$menu">Menu</A></LI> </UL> </BODY> @; close(INDEX); #Create blank.html open(INDEX, ">$dir/blank$_html"); binmode(INDEX); print INDEX q@ None @; close(INDEX); sub add_suffix { my($x,$s) = @_; $x =~ s/\.[^.]+$//; $x .= $s; $x; } #Create menus $fieldindex = -1; foreach $fieldname ( @fieldnames ) { $fieldindex ++; $menu = "menu_$fieldname$_html"; open(INDEX, ">$dir/$menu"); binmode(INDEX); print INDEX qq~ None ~; # Put a record to select a different column sorting print INDEX qq~~; foreach $fname ( @fieldnames ) { print INDEX qq~~; foreach $field ( @$record ) { print INDEX qq~
$fname~; } print INDEX "\n"; # Sort by Filename and create htmls for each file $fieldindex = $fieldindex{'Filename'}; @records = sort { $a->[$fieldindex] cmp $b->[$fieldindex] } @records; foreach $ri ( 0..$#records ) { $record = $records[$ri]; $image = $record->[0]; $HREF = add_suffix($record->[0], $_html); $prev = $ri > 0 ? add_suffix($records[$ri - 1]->[0], $_html) : undef; $next = $ri <= $#records ? add_suffix($records[$ri + 1]->[0], $_html) : undef; print STDERR "HREF='$HREF', image='$image', prev='$prev', next='$next'\n"; exit(1); if ( $HREF ) { open(HREF,">$HREF") || die "Cannot write '$HREF'"; print HREF qq~ None
$record->[1]

~; if ( $prev ) { print HREF qq~PREV $prev\n~; } if ( $next ) { print HREF qq~NEXT $next\n~; } print HREF qq~


$image\n~; print HREF qq~
~; close(HREF); } } # Sort by current field @records = sort { $a->[$fieldindex] cmp $b->[$fieldindex] } @records; foreach $ri ( 0..$#records ) { $record = $records[$ri]; $HREF = add_suffix($record->[0]. $_html); print INDEX qq~
$field~; } print INDEX "\n"; } print INDEX qq~

~; close(INDEX); } 1; memdebug0.1/src/bin/which0100744000175200017560000000121207322242234015720 0ustar stephensstephens#!/bin/sh #set -x pathchar=':' if expr index "$PATH" ';' > /dev/null then pathchar=';' fi oIFS="$IFS" for f in ${1+"$@"} do IFS="$pathchar" for d in ${PATH} do IFS="$oIFS" b="$d/$f" t="$b" if [ -x "$t" -a -f "$t" ] then echo "$f: $t" continue 2 fi t="$b.bat" if [ -x "$t" -a -f "$t" ] then echo "$f: $t" continue 2 fi t="$b.com" if [ -x "$t" -a -f "$t" ] then echo "$f: $t" continue 2 fi t="$b.exe" if [ -x "$t" -a -f "$t" ] then echo "$f: $t" continue 2 fi done echo "$f: not found" done IFS="$oIFS" memdebug0.1/src/bin/whichall0100644000175200017560000000014306662461244016424 0ustar stephensstephens#!/bin/sh for d in `echo $PATH|tr ':' ' '` do if [ -x $d/$1 ] then echo "$d/$1" fi done memdebug0.1/src/bin/wwwsend0100644000175200017560000000336106662461243016333 0ustar stephensstephens#!/bin/sh # Copyright 1998-1999 Kurt A. Stephens http://www.acm.org/~stephensk # # This script sends an entire directory tree via ftp # It only sends the files that have changed since the last send # by keeping a timestamp file around (wwwsend.ts) # #set -x dat=./wwwsend.dat ldir=www dryrun= override= timestamp= findopts= while [ $# -gt 0 ] do case "$1" in -dryrun) dryrun=1 ;; *=*) override="$override$1;" ;; *) dat="$1" ;; esac shift done echo "$0: Reading $dat" [ -n "$override" ] && eval $override cwd="`pwd`" . $dat || exit 1 [ -n "$override" ] && eval $override cwd="`pwd`" #ldir=$(cd $ldir && pwd) #echo "ldir=$ldir" #exit # Run make if it has a Makefile if [ -f $ldir/Makefile ] then echo "$0: Making $ldir ..." (cd $ldir && make) echo "$0: done."; fi # ftp script: open, login and set binary script=$$.tmp echo "$0: Creating ftp script $script"; cat >$script <>$script # ftp script: copy files [ -z "$timestamp" ] && timestamp="$cwd/wwwsend.ts" [ -f "$timestamp" ] && findopts="-newer '$timestamp' $findopts" (set -x; cd $ldir && eval find . -type f $findopts -print) | while read f do d=`dirname $f` echo "cd $rdir/$d" echo "put $f" done >>$script # ftp script: close and quit cat >>$script <> $timestamp # Cleanup rm $script echo "$0: done." memdebug0.1/src/bin/lib/0042755000175200017560000000000007326751147015465 5ustar stephensstephensmemdebug0.1/src/bin/lib/CVS/0042755000175200017560000000000007336072177016120 5ustar stephensstephensmemdebug0.1/src/bin/lib/CVS/Root0100664000175200017560000000006107336072177016760 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/bin/lib/CVS/Repository0100644000175200017560000000002507236675451020215 0ustar stephensstephenshome/ion/src/bin/lib memdebug0.1/src/bin/lib/CVS/Entries0100644000175200017560000000001307236675451017444 0ustar stephensstephensD/perl//// memdebug0.1/src/bin/lib/perl/0042755000175200017560000000000007326751147016427 5ustar stephensstephensmemdebug0.1/src/bin/lib/perl/CVS/0042755000175200017560000000000007336072177017062 5ustar stephensstephensmemdebug0.1/src/bin/lib/perl/CVS/Root0100664000175200017560000000006107336072177017722 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/bin/lib/perl/CVS/Repository0100644000175200017560000000003207236675451021155 0ustar stephensstephenshome/ion/src/bin/lib/perl memdebug0.1/src/bin/lib/perl/CVS/Entries0100644000175200017560000000001207236675451020405 0ustar stephensstephensD/ion//// memdebug0.1/src/bin/lib/perl/ion/0042755000175200017560000000000007326751147017214 5ustar stephensstephensmemdebug0.1/src/bin/lib/perl/ion/CVS/0042755000175200017560000000000007336072177017647 5ustar stephensstephensmemdebug0.1/src/bin/lib/perl/ion/CVS/Root0100664000175200017560000000006107336072177020507 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/bin/lib/perl/ion/CVS/Repository0100644000175200017560000000003607236675451021746 0ustar stephensstephenshome/ion/src/bin/lib/perl/ion memdebug0.1/src/bin/lib/perl/ion/CVS/Entries0100644000175200017560000000001307236675451021173 0ustar stephensstephensD/_cvs//// memdebug0.1/src/bin/lib/perl/ion/_cvs/0042755000175200017560000000000007364175364020151 5ustar stephensstephensmemdebug0.1/src/bin/lib/perl/ion/_cvs/CVS/0042755000175200017560000000000007364175365020605 5ustar stephensstephensmemdebug0.1/src/bin/lib/perl/ion/_cvs/CVS/Root0100664000175200017560000000006107336072177021441 0ustar stephensstephens:ext:stephens@cvs.ionink.com:/cvs/ioncvs/cvsroot memdebug0.1/src/bin/lib/perl/ion/_cvs/CVS/Repository0100644000175200017560000000004307236675451022676 0ustar stephensstephenshome/ion/src/bin/lib/perl/ion/_cvs memdebug0.1/src/bin/lib/perl/ion/_cvs/CVS/Entries0100664000175200017560000000017307364175365022137 0ustar stephensstephens/find.pm/1.9/Sat Jun 2 10:09:00 2001// /entry.pm/1.5/Sat Oct 20 04:17:56 2001// /rlog.pm/1.3/Sat Oct 20 04:17:56 2001// D memdebug0.1/src/bin/lib/perl/ion/_cvs/entry.pm0100644000175200017560000000210307364175364021637 0ustar stephensstephens#!/usr/local/bin/perl # $Id: entry.pm,v 1.5 2001/10/20 04:17:56 stephens Exp $ package ion::_cvs::entry; #print STDERR "ion::_cvs::entry\n"; @map = ( 'type', 'file', 'revision', 'date', 'extra', 'sticky', 'path', 'Repository', 'Filepath' ); %map = (); foreach $_ ( 0 .. $#map ) { my($s) = $map[$_]; my($c) = substr($s, 0, 1); die "Check @map" if ( $map{$c} ); $map{$c} = $_; $map{$s} = $_; } sub type { $_[0]->[0]; } sub isFile { $_[0]->type() ne 'D'; } sub isDirectory { $_[0]->type() eq 'D'; } sub name { $_[0]->[1]; } sub version { $_[0]->[2]; } sub revision { # alias $_[0]->[2]; } sub date { $_[0]->[3]; } sub other { $_[0]->[4]; } sub sticky { $_[0]->[5]; } sub path { $_[0]->[6]; } sub repository { $_[0]->[7]; } sub fullpath { $_[0]->[8]; } sub rlog { if ( ! defined $_[0]->[9] ) { eval 'use ion::_cvs::rlog;'; $_[0]->[9] = ion::_cvs::rlog($_[0]->fullpath, ($_[1] ? $_[1] : $ion::_cvs::rlog::options)); } } sub clear_rlog { $_[0]->[9] = undef; } sub make { my($x) = @_; bless $x; } 1; memdebug0.1/src/bin/lib/perl/ion/_cvs/find.pm0100644000175200017560000000634007306135474021417 0ustar stephensstephens#!/usr/local/bin/perl # $Id: find.pm,v 1.9 2001/06/02 10:09:00 stephens Exp $ use ion::_cvs::entry; ######################################################### package ion::_cvs; #print STDERR "ion::_cvs::find\n"; use Cwd; use File::Find; use File::Basename; $debug = 0; $testing = 0; $find::show_funny_entries = 0; $find::all_files = 0; sub read_CVS_Entries { my($dir) = @_; my($in); my($Repository); $in = "$dir/CVS/Repository"; if ( -f $in ) { open($in, "<$in") || die "$in: $!"; $Repository = <$in>; chop $Repository; close($in); } $in = "$dir/CVS/Entries"; if ( -f $in ) { my(@entries); my($line); my($lineno) = 0; open($in, "<$in") || die "$in: $!"; while ( $line = <$in> ) { chomp $line; $lineno ++; my($rec); $rec = [ split('/', $line) ]; if ( $#{$rec} > 0 ) { $rec->[6] = $dir; $rec->[7] = $rec->[0] eq 'D' ? "$Repository/$rec->[1]" : "$Repository/$rec->[1],v"; $rec->[8] = $rec->[6] . '/' . $rec->[1]; #print join('+', $#{$rec}, @{$rec}), "\n"; ion::_cvs::entry::make($rec); #print join('-', $#{$rec}, @{$rec}), "\n"; #die "$in:$lineno:$line" if ( $#{$rec} <= 0 ); push(@entries, $rec); } else { warn "$in:$lineno: funny entry: '$line'\n" if ( $ion::_cvs::find::show_funny_entries ); } } close($in); @entries; } else { 0; } } sub do_entry { my($entry, $proc, $data) = @_; #print join('|', $#{$rec}, @{$rec}), "\n"; &{$proc}($entry, $data); if ( $entry->[0] eq 'D' ) { my($se); foreach $se ( read_CVS_Entries($entry->[8]) ) { &{$proc}($se, $data); do_entry($se, $proc, $data); } } } ######################################################### sub wanted { print STDERR "wanted: $File::Find::name\n" if ( $debug ); if ( $_ eq 'CVS' ) { $File::Find::prune = 1; } else { if ( -d && (-f "$_/CVS/Entries" || -f "../CVS/Entries") ) { #print STDERR "Found dir $File::Find::name\n"; push(@found_files, $File::Find::name); $File::Find::prune = 1; } elsif ( -f ) { #print STDERR "Found file $File::Find::name\n"; push(@found_files, $File::Find::name); } } } sub find { my($proc, $data, @files) = @_; # Collect files under CVS control @found_files = (); my($save_cwd) = getcwd; File::Find::find(\&wanted, @files); chdir($save_cwd) || die "$save_cwd: $!"; ######################################################### #print STDERR "files = (", join("\n\t", @files), ")\n"; my($path); foreach $path ( @found_files ) { my($dir, $file); my($entry); $dir = dirname($path); $file = basename($path); print STDERR "$path:$dir:$file\n" if ( $debug ); if ( -d $path && -f "$path/CVS/Entries" ) { print STDERR "$path is a dir\n" if ( $debug ); foreach $entry ( read_CVS_Entries($path) ) { do_entry($entry, $proc, $data); } } elsif ( $file ne '.' && -f "$dir/CVS/Entries" ) { #print STDERR "Search for $file in $dir/CVS\n"; ENTRY: foreach $entry ( read_CVS_Entries($dir) ) { #print STDERR "Entry name $entry->[1]\n"; if ( $file eq $entry->[1] ) { print STDERR "Found entry for $file in $dir/CVS\n" if ( $debug); do_entry($entry, $proc, $data); last ENTRY; } } } } } 1; memdebug0.1/src/bin/lib/perl/ion/_cvs/rlog.pm0100644000175200017560000001222407364175364021446 0ustar stephensstephens#!/usr/local/bin/perl # $Id: rlog.pm,v 1.3 2001/10/20 04:17:56 stephens Exp $ package ion::_cvs; ######################################################## $debug = 0; $testing = 0; ######################################################## $RLOG = $ENV{RLOG} if ( ! defined $RLOG ); $RLOG = 'cvs log' if ( ! defined $RLOG ); sub END { unlink($tmp) if ( defined $tmp ); } sub rlog { my($vfile, $opts) = @_; my $vdir = '.'; my($obj) = {}; #my($debug) = 3; $opts = {} if ( ! defined $opts ); $opts->{RLOG} = $RLOG if ( ! defined $opts->{RLOG} ); if ( $opts->{RLOG} =~ /cvs/i ) { $vfile =~ s/,v$//s; ($vdir, $vfile) = ($vfile =~ m@^(.*)/([^/]+)@); } $obj->{vfile} = $vfile; $obj->{revisions} = []; $obj->{revision} = {}; $obj->{symbolic_names} = []; $obj->{sym_name_to_rev} = {}; $obj->{rev_to_sym_names} = {}; $obj->{filter} = $opts->{filter}; ############################################ # Run rlog into temp file my($in) = "rlog" . abs($$) . ".tmp"; $tmp = $in; my($cmd) = qq((cd '$vdir' && $opts->{RLOG} $obj->{filter} '$obj->{vfile}') > $in); #print STDERR "in " . getcwd . ": $cmd\n" if ( 1 || $debug > 0 ); #die "STOP"; if ( system($cmd) ) { unlink($in); return undef; } ############################################ # Slurp in the whole file open($in, "<$in") || die "$cmd: $in: $!"; my(@lines); my($line); my($lineno) = 0; while ( defined ($line = <$in>) ) { chomp $line; print "$vfile: $line\n" if ( $debug > 2 ); push(@lines, $line); } close($in); unlink($tmp); undef $tmp; exit if ( $debug > 3 ); ############################################ # Begin scan $lineno = 0; if ( defined($line = shift @lines) ) { $lineno ++; } ############################################ # Scan header while ( defined $line && ($line !~ /^(-+|=+)$/) ) { if ( $line =~ /^([^:]+):\s*(.*)$/ ) { my($key, $value) = ($1, $2); if ( $key eq 'symbolic names' ) { ############################################ # Scan symbolic names print STDERR "Found symbolic names: $lineno:$line\n" if ( $debug > 1 ); if ( defined($line = shift @lines) ) { $lineno ++; } while ( defined $line && ($line =~ /^\s/) ) { print STDERR "Try sym_name: $lineno:$line\n" if ( $debug > 2 ); if ( $line =~ /^\s+([^\s:]+)\s*:\s*([\.0-9]+)/ ) { print STDERR "Matched sym_name '$1' '$2': $lineno:$line\n" if ( $debug > 1 ); push(@{$obj->{symbolic_names}}, $1); $obj->{sym_name_to_rev}->{$1} = $2; my($a); $a = $obj->{rev_to_sym_names}->{$2}; $a = $obj->{rev_to_sym_names}->{$2} = [] if ( ! defined $a ); push(@{$a}, $1); } if ( defined($line = shift @lines) ) { $lineno ++; } } } else { $key =~ tr/a-zA-Z0-9_/_/c; $value =~ s/\s+$//; print STDERR "Found key='$key' value='$value': $lineno:$line\n" if ( $debug > 2 ); $value = [ split(/\s+/, $value) ]; $obj->{$key} = $value; if ( defined($line = shift @lines) ) { $lineno ++; } } } else { if ( defined($line = shift @lines) ) { $lineno ++; } } } if ( defined($line = shift @lines) ) { $lineno ++; } while ( defined $line && $line !~ /^=+$/ ) { my($v) = {}; ############################################ # Scan 'revision:' print STDERR "Try revision: $lineno:$line\n" if ( $debug > 2); if ( $line =~ s/^revision[ :]// ) { $line =~ s/\s+;?\s*$//; $v->{revision} = $line; push(@{$obj->{revisions}}, $line); $obj->{revision}->{$line} = $v; $v->{symbolic_names} = $obj->{rev_to_sym_names}->{$line} || []; if ( defined($line = shift @lines) ) { $lineno ++; } print STDERR "Matched revision '$v->{revision}': $lineno:$line\n" if ( $debug > 1 ); } print STDERR "After revision '$v->{revision}': $lineno:$line\n" if ( $debug > 1 ); while ( $line =~ /^\s*$/ ) { print STDERR "Eat blank line: $lineno:$line\n" if ( $debug > 1 ); if ( defined($line = shift @lines) ) { $lineno ++; } } ############################################ # Scan ': ;' KEY1: while ( defined $line && $line ne '' ) { $line =~ s/^\s+//; if ( $line =~ s/^([a-zA-Z_]+)\s*:\s*([^;]+)(;|$)// ) { print STDERR "Matched key '$1' '$2': $lineno:$line\n" if ( $debug > 1 ); $v->{$1} = $2; } else { last KEY1; } } if ( defined($line = shift @lines) ) { $lineno ++; } ############################################ # Scan 'branches: ' if ( $line =~ s/^branches:\s*// ) { $line =~ s/\s+$//; $v->{branches} = [ split(/\s/, $line) ]; print STDERR "Matched branches: '$1': $lineno:$line\n" if ( $debug > 1 ); if ( defined($line = shift @lines) ) { $lineno ++; } } ############################################ # Scan comment $v->{comment} = ''; while ( defined $line && ($line !~ /^(-+|=+)$/) ) { $line =~ s/^\s+//; $line =~ s/\s+$//; if ( $line ne '' && $line !~ m@^\s*\*\*\* empty log message \*\*\*\s*$@ ) { $v->{comment} .= $line . "\n"; print STDERR "Comment: $line\n" if ( $debug > 1 ); } if ( defined($line = shift @lines) ) { $lineno ++; } } if ( defined($line = shift @lines) ) { $lineno ++; } } $obj; } 1; memdebug0.1/src/bin/wwwgrab.pl0100775000175200017560000000304207351534001016715 0ustar stephensstephens#!/usr/bin/perl # $Id: wwwgrab.pl,v 1.1 2001/09/18 02:57:05 stephens Exp $ sub wwwgrab { $_=@_[0]; $savefilename=@_[1] || '&STDOUT'; if (!$_) { print "Usage: $0 http://www.any.site/location [outputfilename]\n"; print " Where [outputfilename] is the optional filename to create.\n"; print " (ommitting this means that it will mean that the data will be\n"; die " sent to STDOUT. If this file exists, it will be overwritten)\n"; } /http:\/\/([^\/]*)\/*([^ ]*)/; $site = $1; $file = "/".$2; if (!$site) { die "$0: Fatal Error. You appear to have munged your URL address.\nIt must be in the form of http://www.any.site/location\n"; } $_ = $site; /^([^:]*):*([^ ]*)/; $site = $1; $port = $2; $port = 80 unless $port; $hostname = $site; ($sockaddr,$there,$response,$tries) = ("Snc4x8"); $there = pack($sockaddr,2,$port, &getaddress($hostname)); $proto = (getprotobyname ('tcp'))[2]; if (!socket(S,AF_INET,SOCK_STREAM,$proto)) { die "$0: Fatal Error. $!\n"; } if (!connect(S,$there)) { die "$0: Fatal Error. $!\n"; } select(S); $|=1; select(STDOUT); print S "GET $file HTTP/1.0\r\n"; print S "\n"; open(OUT,">".$savefilename) || die "$0: Fatal error. Cannot create $savefilename.\n"; while($line = ) { print OUT $line; } close(S); close(OUT); } sub getaddress { local($host) = @_; local(@ary); @ary = gethostbyname($host); return(unpack("C4",$ary[4])); } while ( @ARGV ) { my $url = shift @ARGV; my $out = shift @ARGV; wwwgrab($url, $out); } 1; memdebug0.1/src/bin/dos2unix.c0100644000175200017560000000047005551357511016625 0ustar stephensstephens#include int main() { int c; while ( (c = getchar()) != EOF ) { if ( c == '\r' ) { if ( (c = getchar()) == '\n' ) { putchar('\n'); } else { putchar('\r'); if ( c != EOF ) putchar(c); } } else { putchar(c); } } return 0; } memdebug0.1/src/bin/swig2def.pl0100744000175200017560000000066407262414406016761 0ustar stephensstephens#!/usr/bin/perl use English; $RS = ';'; my $id = 1; print "EXPORTS\n"; while ( <> ) { if ( s/^\s*[a-z_]*extern[a-z_]*\s+((const\s*)?\w+\s*\**\s*\**)//si ) { my $type = $1; print STDERR "line '$_'\n"; $type =~ s/\s+//sg; while ( s/(\w+)//s ) { my $symbol = $1; my $data = (s/[(][^\]]*[)]//s ? '' : 'DATA '); if ( ! $data ) { print "\t$symbol @ $id $data;\n"; ++ $id; } } } } 1; memdebug0.1/src/bin/.#uud.1.20100744000175200017560000000417207245406670016055 0ustar stephensstephens#!/bin/perl # # scans files for a uuencoded items in files and decodes them to $dir # and adds a line to $db based on the Subject: lines found # $count = 0; $subject = ''; $dir = shift || die("Specify an output directory"); $db = "$dir/images.txt"; @files = (); %subjects = (); %files = (); $again = 0; while ( $again || defined($_ = <>) ) { $again = 0; chop; if ( s/^Subject:\s+// ) { $subject = $_; } elsif ( /^begin\s+(\S+)\s+(\S+)/ ) { $mode = $1; $file = $2; print STDERR "File: $file, Subject: $subject\n"; if ( $file ne '' ) { $str = ''; $nlines = 0; while ( defined($_ = <>) ) { $nlines ++; if ( $nlines % 100 ) { print STDERR "$nlines lines...\r"; } last if /^end/; if ( /^Subject:\s+/ || /^begin\s+(\S+)\s+(\S+)/ ) { print STDERR "WARNING: found $_"; $again ++; last; } next if /[a-z]/; next unless int((((ord() - 32) & 077) + 2) / 3) == int(length() / 4); $str .= unpack('u', $_); } # Remove dir from $file name $file =~ s@^.*/@@; # Add .jpg suffix if needed $file .= "_" . ($count ++) . ".jpg" if ( $file !~ /\.jpg$/ ); # Give it an orignal name if ( 0 ) { while ( -f "$dir/$file" ) { $file =~ s/_([0-9]+)(\.[^\.]+)$//; $suffix = $1; $file .= ($count ++) . $suffix; } } # If the file doesn't already exist if ( ! -f "$dir/$file" ) { # Add an entry to the index push(@files, $file); while ( defined($files{$subject}) ) { $subject =~ s/_([0-9]+)$//; $subject .= '_' . ($1 + 1); } $subjects{$file} = $subject; $files{$subject} = $file; # print "file = $file, mode = $mode, subject = $subject\n"; # Write the file open(F, ">$dir/$file"); binmode(F); print F $str; close(F); #exit(0); } } } } #Append to db $exists = -r $db; open(INDEX, ">>$db"); binmode(INDEX); print INDEX "Filename\tSubject\n" if ( ! $exists ); foreach $file ( sort(@files) ) { $subject = $subjects{$file}; print INDEX "$file\t$subject\n"; } close(INDEX); ########################################################################## 1; memdebug0.1/src/bin/.#uudindex.1.20100744000175200017560000000711507245406752017106 0ustar stephensstephens#!/bin/perl # Creates a html index for stuff in $dir listed by $db # Run this after uud. # $dir = shift || "images"; $db = "$dir.txt"; $_html = '.html'; ########################################################################## @fieldnames = (); @fields = (); @records = (); @files = (); %subjects = (); %files = (); #Read db open(INDEX, "<$db"); binmode(INDEX); # First record is the field names $_ = ; chop; @fieldnames = split("\t", $_); $fieldindex = 0; foreach $fieldname ( @fieldnames ) { $fieldindex{$fieldname} = $fieldindex ++; } while ( ) { chop; @fields = split("\t", $_); push(@records, [ @fields ]); } close(INDEX); #Create index.html $menu = "menu_" . $fieldnames[0] . $_html; open(INDEX, ">$dir/index$_html"); binmode(INDEX); print INDEX qq@ None <BODY> <CENTER> This frameset document contains: <UL> <LI> <A HREF="$menu">Menu</A></LI> </UL> </BODY> @; close(INDEX); #Create blank.html open(INDEX, ">$dir/blank$_html"); binmode(INDEX); print INDEX q@ None @; close(INDEX); sub add_suffix { my($x,$s) = @_; $x =~ s/\.[^.]+$//; $x .= $s; $x; } #Create menus $fieldindex = -1; foreach $fieldname ( @fieldnames ) { $fieldindex ++; $menu = "menu_$fieldname$_html"; open(INDEX, ">$dir/$menu"); binmode(INDEX); print INDEX qq~ None ~; # Put a record to select a different column sorting print INDEX qq~~; foreach $fname ( @fieldnames ) { print INDEX qq~~; foreach $field ( @$record ) { print INDEX qq~
$fname~; } print INDEX "\n"; # Sort by Filename and create htmls for each file $fieldindex = $fieldindex{'Filename'}; @records = sort { $a->[$fieldindex] cmp $b->[$fieldindex] } @records; foreach $ri ( 0..$#records ) { $record = $records[$ri]; $image = $record->[0]; $HREF = add_suffix($record->[0], $_html); $prev = $ri > 0 ? add_suffix($records[$ri - 1]->[0], $_html) : undef; $next = $ri <= $#records ? add_suffix($records[$ri + 1]->[0], $_html) : undef; print STDERR "HREF='$HREF', image='$image', prev='$prev', next='$next'\n"; exit(1); if ( $HREF ) { open(HREF,">$HREF") || die "Cannot write '$HREF'"; print HREF qq~ None
$record->[1]

~; if ( $prev ) { print HREF qq~PREV $prev\n~; } if ( $next ) { print HREF qq~NEXT $next\n~; } print HREF qq~


$image\n~; print HREF qq~
~; close(HREF); } } # Sort by current field @records = sort { $a->[$fieldindex] cmp $b->[$fieldindex] } @records; foreach $ri ( 0..$#records ) { $record = $records[$ri]; $HREF = add_suffix($record->[0]. $_html); print INDEX qq~
$field~; } print INDEX "\n"; } print INDEX qq~

~; close(INDEX); } 1; memdebug0.1/src/bin/cvsfix.pl0100644000175200017560000000253407322242234016541 0ustar stephensstephens#!/usr/local/bin/perl # $Id: cvsfix.pl,v 1.2 2001/07/06 07:04:28 stephens Exp $ # use File::Find; $debug = 9; $testing = 0; $keep_backup = 1; $filename = '(Entries|Root|Repository)'; while ( @ARGV ) { $_ = shift @ARGV; if ( /^--?f/ ) { $filename = shift @ARGV; } elsif ( /^--?d/ ) { ++ $debug; } elsif ( /^--?t/ ) { ++ $testing; } elsif ( /^--?[h?]/ ) { print "Removes CRs from CVS files.\n"; } else { push(@ARGV, $_); last; } } sub wanted { my ($file) = $File::Find::name; #print STDERR "$file\n"; if ( $file =~ m@/cvs$@s && -d $_ ) { print STDERR "Directory named: $file\n" if ( $debug > 1 ); if ( ! $testing ) { rename($_, "$_.CVS"); rename("$_.CVS", "CVS"); } } elsif ( $file =~ m@/(CVS|cvs)/(Entries|Root|Repository)$@s ) { my($in, $out) = ( $_, "$_.tmp" ); my($line); print STDERR "Checking: $file\n" if ( $debug > 1 ); open($in, "<$in") || die "$in: $!"; binmode($in); $line = join('', <$in>); close($in); #print STDERR "$line"; if ( $line =~ s/\r//sg ) { print "Had CR: $file\n"; if ( ! $testing ) { rename($in, $out) || die "rename $in $out: $!"; open($in, ">$in") || die "$in: $!"; binmode($in); print $in $line; close($in); #unlink($out) if ( ! $keep_backup ); } } } } find(\&wanted, @ARGV); 1; memdebug0.1/src/bin/cvsadd_r0100755000175200017560000000030007312605361016405 0ustar stephensstephens#!/bin/sh # $Id: cvsadd_r,v 1.1 2001/06/16 07:29:53 stephens Exp $ # Recursively add files to cvs find "$@" -type d | xargs cvs add find "$@" -type f -o \( -name CVS -prune \) | xargs cvs add memdebug0.1/src/bin/ion_open_url0100755000175200017560000000026407312337470017324 0ustar stephensstephens#!/usr/bin/perl while ( <> ) { chomp; if ( /^(\w+)URL=(.*)\r?$/ ) { print STDERR "open '$2'\n"; exec('gnome-moz-remote', '--newwin', $2); exit(1); } }memdebug0.1/src/bin/wwwgrab0100775000175200017560000000013707351534001016305 0ustar stephensstephens#!/bin/sh # $Id: wwwgrab,v 1.1 2001/09/18 02:57:05 stephens Exp $ exec ${PERL:-perl} $0.pl $@ memdebug0.1/src/GUM_BUILD_ROOT0100664000175200017560000000064107364177103016276 0ustar stephensstephens# $Id: GUM_BUILD_ROOT,v 1.4 2001/08/06 11:02:09 stephens Exp $ # Build options DEBUG=YES #OPTIMIZE=NO # output root is ../gumo GUM_GENERATED_ROOT:=$(shell cd $(GUM_BUILD_ROOT)/../gumo && /bin/pwd)# # Quick install. GUM_GENERATED_LIB_DIR=$(INSTALL_DIR_LIB)# # Pick up /iimp stuff PATH:=/iimp/app/prod/bin:$(PATH) INCLUDE_DIRS_GLOBAL:=$(GUM_BUILD_ROOT) /iimp/app/prod/include# LIB_DIRS_GLOBAL:=/iimp/app/prod/lib# memdebug0.1/README0100664000175200017560000000141607364177103014233 0ustar stephensstephensmemdebug 0.1 README ============================================================================== Copyright (c) 1997-2001 Kurt A. Stephens and Ion, Inc., All Rights Reserved. http://www.acm.org/~stephensk Kurt A. Stephens and Ion, Inc. MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Kurt A. Stephens and Ion, Inc. SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. $Id: COPYRIGHT,v 1.3 2001/04/03 18:37:16 stephens Exp $ ============================================================================== memdebug0.1/COPYRIGHT0100664000175200017560000000113107364177103014640 0ustar stephensstephensCopyright (c) 1997-2001 Kurt A. Stephens and Ion, Inc., All Rights Reserved. http://www.acm.org/~stephensk Kurt A. Stephens and Ion, Inc. MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Kurt A. Stephens and Ion, Inc. SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. $Id: COPYRIGHT,v 1.3 2001/04/03 18:37:16 stephens Exp $ memdebug0.1/CHANGES0100664000175200017560000002040407364177153014351 0ustar stephensstephensmemdebug 0.1 CHANGES ============================================================================== ============================================================================== Changes from release '' to 'PUBLISH_memdebug0_1' ============================================================================== src/bin/PKG: Initial revision Initial check in of D:\data\ion\src src/bin/addcr: Removed addcr.t stuff. Added addcr.t/run. Case insensitive filename suffix matching. Ignore .bak files REM for .bat files Added #! check point Initial revision Initial check in of D:\data\ion\src src/bin/addcr.t/backup/t1.c: Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/bin/addcr.t/backup/t2: src/bin/addcr.t/backup/t3: Initial revision Initial check in of D:\data\ion\src src/bin/addcr.t/backup/t4: Removed addcr.t stuff. Added addcr.t/run. Initial revision Initial check in of D:\data\ion\src src/bin/addcr.t/run: Removed addcr.t stuff. Added addcr.t/run. src/bin/addrcsid.pl: Added java support. no message Added addrcsid.pl. src/bin/ccinfo: src/bin/ccloclibs: Initial revision Initial check in of D:\data\ion\src src/bin/ctocnl.c: Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/bin/cvsadd_r: Initial. src/bin/cvschrep.pl: Added -r option Added rcs ids. New files src/bin/cvschroot.pl: check point check point New files src/bin/cvsclean: Added cvsclean. src/bin/cvsedited: src/bin/cvsfind.pl: Added cvsclean. Fixed unknown field error msg. Changed field names. simply grow the array by assignment New cvsfind.pl and cvsrevhist.pl src/bin/cvsfix.pl: Added cvs to CVS directory renaming. Added. src/bin/cvsretag.pl: Added cvsretag.pl src/bin/cvsrevhist.pl: PUBLISH_bin0.1 Added show_empty_entries, auto_extend_rev_ranges and collapse_comments options. New ion::_cvs::entry.pm ion::_cvs::rlog Fixed handling of -s(how-rev-info) flag. Added CHANGES file support. New cvsfind.pl and cvsrevhist.pl src/bin/cwfixlib.pl: Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/bin/d2u.pl: use chomp instead of chop Change case of dotted names only. Added -help, -r options, ll, scm suffixes. Merged u2d.pl. Added cc and tcl support. Recognize .def files Added option handling. Added all caps renaming. Proper default ignore_pattern. Added d2u.pl. src/bin/dos2unix.c: initial src/bin/ecd: src/bin/fe: src/bin/findsource: Initial revision Initial check in of D:\data\ion\src src/bin/igrep: V1.1 Initial revision Initial check in of D:\data\ion\src src/bin/ion_open_url: minor changes. minor changes. Added ion_open_url. src/bin/lib/perl/ion/_cvs/entry.pm: Hackish fix for remove cvs. Fixed // comment. Added cvsclean. Added clear_rlog method. New ion::_cvs::entry.pm ion::_cvs::rlog src/bin/lib/perl/ion/_cvs/find.pm: Fixed publish.pl. Fix INC path. Added cvsclean. New $ion::_cvs::find::show_funny_entries option. New ion::_cvs::entry.pm ion::_cvs::rlog Fixed unknown field error msg. Changed field names. simply grow the array by assignment Added CHANGES file support. New cvsfind.pl and cvsrevhist.pl src/bin/lib/perl/ion/_cvs/rlog.pm: Hackish fix for remove cvs. Unlink input file and return undef if error running rlog. Force $v->{symbolic_names} to be a list. New ion::_cvs::entry.pm ion::_cvs::rlog src/bin/linkdups: src/bin/locstatic: Initial revision Initial check in of D:\data\ion\src src/bin/lsup: Use . by default. Initial revision Initial check in of D:\data\ion\src src/bin/mergefiles.pl: Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/bin/mkindex: V1.1 Initial revision Initial check in of D:\data\ion\src src/bin/mvr.pl: src/bin/nmlibs: src/bin/nmm: src/bin/objcsyms: Initial revision Initial check in of D:\data\ion\src src/bin/publish.pl: Hackish fix for remove cvs. Minor changes. Fixed publish.pl. Added CHANGES_RELEASE logging support. Added CHANGES file support. New cvsfind.pl and cvsrevhist.pl Force cvs tag only if -force option is supplied. Print file sizes. Prepend '0' to day of month if single digit. PUBLISH:bin0.1 Fixed edit collision. PUBLISH: bin0.1 Initial revision Initial check in of D:\data\ion\src src/bin/sci: src/bin/scip: Initial revision Initial check in of D:\data\ion\src src/bin/si: Filter out blank and include lines. Initial revision Initial check in of D:\data\ion\src src/bin/split.c: Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/bin/swig2def.pl: Added src/bin/tgz: added more suffix patterns. tgz files use gzip not bzip. New bzip2 support. Use input redir for GUNZIP. Now supports .tar files. Initial revision Initial check in of D:\data\ion\src src/bin/ts: Added ts. src/bin/uud: src/bin/uudindex: Added directory options. Gen .html for each image. Initial revision Initial check in of D:\data\ion\src src/bin/which: Must be a file, too. Initial revision Initial check in of D:\data\ion\src src/bin/whichall: Initial revision Initial check in of D:\data\ion\src src/bin/wwwgrab: src/bin/wwwgrab.pl: Added wwwgrab. src/bin/wwwsend: Initial revision Initial check in of D:\data\ion\src src/maks/PKG: Added swig2def dll support. Initial revision Initial check in of D:\data\ion\src src/maks/basic.mak: Port to RH7.0. More swig support. Added swig support. MSG, vm, proper products. Unknown edits. Added rcs ids. Minor non-functional changes, and comments. Initial revision Initial check in of D:\data\ion\src src/maks/bin/mak: Unknown edits. Initial revision Initial check in of D:\data\ion\src src/maks/bin/mak.bat: Unknown edits. Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/maks/fixpound.pl: Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/maks/lib.mak: Added swig2def dll support. MSG, vm, proper products. Unknown edits. Added rcs ids. Minor non-functional changes, and comments. Initial revision Initial check in of D:\data\ion\src src/maks/opengl/Makefile: Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/maks/opengl/Makefile.use: Checkpoint. Port to RH7.0. Unknown edits. Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/maks/os/CYGWIN.mak: src/maks/os/CYGWIN_98-4.10.mak: src/maks/os/Linux.mak: Added new os support. Fixed tool.mak. src/maks/pre.mak: More swig support. Added swig support. Added new os support. Fixed tool.mak. Added BUILD_TARGET to BUILD_VARS. Added BUILD_VARS support. MSG, vm, proper products. Unknown edits. Added rcs ids. Minor non-functional changes, and comments. Initial revision Initial check in of D:\data\ion\src src/maks/tool.mak: Added new os support. Fixed tool.mak. MSG, vm, proper products. Unknown edits. Added rcs ids. Minor non-functional changes, and comments. Initial revision Initial check in of D:\data\ion\src src/maks/tools.mak: MSG, vm, proper products. Unknown edits. Added rcs ids. Minor non-functional changes, and comments. Initial revision Initial check in of D:\data\ion\src src/maks/use.mak: USE dir Unknown edits. Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/maks/win32/Makefile: src/maks/win32/Makefile.use: Added rcs ids. Initial revision Initial check in of D:\data\ion\src src/memdebug/Makefile: Port to cygwin. Initial. src/memdebug/Makefile.use: Added other Makefile.use, Makefile.UBS. src/memdebug/PKG: Added PKG. src/memdebug/getpagesize.h: Port to cygwin. src/memdebug/gmalloc.c: src/memdebug/memcpp.cc: Initial. src/memdebug/memdebug.c: Port to cygwin. Initial. src/memdebug/memdebug.h: Initial. memdebug0.1/TOC0100664000175200017560000003365007364177153013735 0ustar stephensstephensmemdebug 0.1 Table of Contents ============================================================================== memdebug0.1: total 64 drwxrwxr-x 3 stephens stephens 4096 Oct 19 23:32 . drwxrwxr-x 3 stephens stephens 4096 Oct 19 23:32 .. -rw-rw-r-- 1 stephens stephens 8452 Oct 19 23:32 CHANGES -rw-rw-r-- 1 stephens stephens 601 Oct 19 23:32 COPYRIGHT -rw-rw-r-- 1 stephens stephens 782 Oct 19 23:32 README drwxrwxr-x 5 stephens stephens 4096 Oct 19 23:32 src -rw-rw-r-- 1 stephens stephens 110 Oct 19 23:32 TOC memdebug0.1/src: total 24 drwxrwxr-x 5 stephens stephens 4096 Oct 19 23:32 . drwxrwxr-x 3 stephens stephens 4096 Oct 19 23:32 .. drwxr-sr-x 5 stephens stephens 4096 Oct 19 23:17 bin -rw-rw-r-- 1 stephens stephens 417 Oct 19 23:32 GUM_BUILD_ROOT drwxr-sr-x 7 stephens stephens 4096 Jul 23 02:29 maks drwxr-sr-x 3 stephens stephens 4096 Oct 19 21:58 memdebug memdebug0.1/src/bin: total 252 drwxr-sr-x 5 stephens stephens 4096 Oct 19 23:17 . drwxrwxr-x 5 stephens stephens 4096 Oct 19 23:32 .. -rw-r--r-- 1 stephens stephens 9271 Feb 17 1999 addcr drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 addcr.t -rw-r--r-- 1 stephens stephens 3385 Jun 28 1999 addrcsid.pl -rw-r--r-- 1 stephens stephens 5118 Feb 17 1999 ccinfo -rw-r--r-- 1 stephens stephens 3059 Feb 17 1999 ccloclibs -rw-r--r-- 1 stephens stephens 372 Feb 19 1999 ctocnl.c drwxr-sr-x 2 stephens stephens 4096 Oct 19 23:17 CVS -rwxr-xr-x 1 stephens stephens 192 Jun 16 02:29 cvsadd_r -rwxr--r-- 1 stephens stephens 1255 Jan 14 2001 cvschrep.pl -rw-r--r-- 1 stephens stephens 1062 Feb 17 1999 cvschroot.pl -rw-r--r-- 1 stephens stephens 352 Oct 20 1999 cvsclean -rw-r--r-- 1 stephens stephens 331 Oct 13 1999 cvsedited -rw-r--r-- 1 stephens stephens 1373 Oct 20 1999 cvsfind.pl -rw-r--r-- 1 stephens stephens 1372 Jul 9 00:43 cvsfix.pl -rw-r--r-- 1 stephens stephens 1193 Sep 9 1999 cvsretag.pl -rw-r--r-- 1 stephens stephens 3571 Mar 21 2000 cvsrevhist.pl -rw-r--r-- 1 stephens stephens 945 Feb 19 1999 cwfixlib.pl -rwxr--r-- 1 stephens stephens 3010 Jan 14 2001 d2u.pl -rw-r--r-- 1 stephens stephens 312 Apr 8 1994 dos2unix.c -rw-r--r-- 1 stephens stephens 709 Feb 17 1999 ecd -rw-r--r-- 1 stephens stephens 190 Feb 17 1999 fe -rw-r--r-- 1 stephens stephens 103 Feb 17 1999 findsource -rw-r--r-- 1 stephens stephens 6566 Sep 30 1999 igrep -rwxr-xr-x 1 stephens stephens 180 Jun 15 02:54 ion_open_url drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 lib -rw-r--r-- 1 stephens stephens 647 Feb 17 1999 linkdups -rw-r--r-- 1 stephens stephens 1369 Feb 17 1999 locstatic -rw-r--r-- 1 stephens stephens 259 Sep 30 1999 lsup -rw-r--r-- 1 stephens stephens 6485 Feb 19 1999 mergefiles.pl -rw-r--r-- 1 stephens stephens 1965 Sep 30 1999 mkindex -rw-r--r-- 1 stephens stephens 1739 Oct 13 1999 mvr.pl -rw-r--r-- 1 stephens stephens 279 Feb 17 1999 nmlibs -rwxr-xr-x 1 stephens stephens 64 Feb 17 1999 nmm -rw-r--r-- 1 stephens stephens 2427 Feb 17 1999 objcsyms -rw-r--r-- 1 stephens stephens 230 Feb 17 1999 PKG -rw-r--r-- 1 stephens stephens 18470 Oct 19 23:17 publish.pl -rw-r--r-- 1 stephens stephens 2957 Feb 17 1999 sci -rw-r--r-- 1 stephens stephens 3328 Feb 17 1999 scip -rw-r--r-- 1 stephens stephens 92 Oct 13 1999 si -rw-r--r-- 1 stephens stephens 2374 Feb 19 1999 split.c -rwxr--r-- 1 stephens stephens 436 Apr 3 2001 swig2def.pl -rwxr--r-- 1 stephens stephens 2350 Jan 14 2001 tgz -rw-r--r-- 1 stephens stephens 1655 Mar 21 2000 ts -rwxr--r-- 1 stephens stephens 2170 Apr 3 2001 uud -rwxr--r-- 1 stephens stephens 2170 Feb 23 2001 .#uud.1.2 -rwxr--r-- 1 stephens stephens 3661 Apr 3 2001 uudindex -rwxr--r-- 1 stephens stephens 3661 Feb 23 2001 .#uudindex.1.2 -rwxr--r-- 1 stephens stephens 650 Jul 9 00:43 which -rw-r--r-- 1 stephens stephens 99 Feb 17 1999 whichall -rwxrwxr-x 1 stephens stephens 95 Sep 17 21:57 wwwgrab -rwxrwxr-x 1 stephens stephens 1570 Sep 17 21:57 wwwgrab.pl -rw-r--r-- 1 stephens stephens 1777 Feb 17 1999 wwwsend memdebug0.1/src/bin/addcr.t: total 20 drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 5 stephens stephens 4096 Oct 19 23:17 .. drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 backup drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS -rw-r--r-- 1 stephens stephens 143 Feb 17 1999 run memdebug0.1/src/bin/addcr.t/backup: total 28 drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 .. drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS -rw-r--r-- 1 stephens stephens 260 Feb 19 1999 t1.c -rw-r--r-- 1 stephens stephens 20 Feb 17 1999 t2 -rw-r--r-- 1 stephens stephens 41 Feb 17 1999 t3 -rw-r--r-- 1 stephens stephens 379 Feb 17 1999 t4 memdebug0.1/src/bin/addcr.t/backup/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 155 Feb 2 2001 Entries -rw-r--r-- 1 stephens stephens 32 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/bin/addcr.t/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 49 Feb 2 2001 Entries -rw-r--r-- 1 stephens stephens 25 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/bin/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Oct 19 23:17 . drwxr-sr-x 5 stephens stephens 4096 Oct 19 23:17 .. -rw-rw-r-- 1 stephens stephens 1982 Oct 19 23:17 Entries -rw-r--r-- 1 stephens stephens 17 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/bin/lib: total 16 drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 5 stephens stephens 4096 Oct 19 23:17 .. drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 perl memdebug0.1/src/bin/lib/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 11 Feb 2 2001 Entries -rw-r--r-- 1 stephens stephens 21 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/bin/lib/perl: total 16 drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 .. drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 ion memdebug0.1/src/bin/lib/perl/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 10 Feb 2 2001 Entries -rw-r--r-- 1 stephens stephens 26 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/bin/lib/perl/ion: total 16 drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 .. drwxr-sr-x 3 stephens stephens 4096 Oct 19 23:17 _cvs drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS memdebug0.1/src/bin/lib/perl/ion/_cvs: total 28 drwxr-sr-x 3 stephens stephens 4096 Oct 19 23:17 . drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 .. drwxr-sr-x 2 stephens stephens 4096 Oct 19 23:17 CVS -rw-r--r-- 1 stephens stephens 1091 Oct 19 23:17 entry.pm -rw-r--r-- 1 stephens stephens 3296 Jun 2 05:09 find.pm -rw-r--r-- 1 stephens stephens 5268 Oct 19 23:17 rlog.pm memdebug0.1/src/bin/lib/perl/ion/_cvs/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Oct 19 23:17 . drwxr-sr-x 3 stephens stephens 4096 Oct 19 23:17 .. -rw-rw-r-- 1 stephens stephens 123 Oct 19 23:17 Entries -rw-r--r-- 1 stephens stephens 35 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/bin/lib/perl/ion/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 4 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 11 Feb 2 2001 Entries -rw-r--r-- 1 stephens stephens 30 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/maks: total 68 drwxr-sr-x 7 stephens stephens 4096 Jul 23 02:29 . drwxrwxr-x 5 stephens stephens 4096 Oct 19 23:32 .. -rwxr--r-- 1 stephens stephens 4407 Apr 4 2001 basic.mak drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 bin drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS -rw-r--r-- 1 stephens stephens 172 Feb 19 1999 fixpound.pl -rwxr--r-- 1 stephens stephens 2246 Apr 3 2001 lib.mak drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 opengl drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 os -rwxr--r-- 1 stephens stephens 206 Apr 3 2001 PKG -rwxr--r-- 1 stephens stephens 6667 Apr 3 2001 pre.mak -rw-r--r-- 1 stephens stephens 1651 Mar 21 2000 tool.mak -rw-r--r-- 1 stephens stephens 212 Sep 8 1999 tools.mak -rwxr--r-- 1 stephens stephens 494 Apr 3 2001 use.mak drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 win32 memdebug0.1/src/maks/bin: total 20 drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 7 stephens stephens 4096 Jul 23 02:29 .. drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS -rw-r--r-- 1 stephens stephens 418 Jun 28 1999 mak -rw-r--r-- 1 stephens stephens 106 Jun 28 1999 mak.bat memdebug0.1/src/maks/bin/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 78 Feb 2 2001 Entries -rw-r--r-- 1 stephens stephens 22 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/maks/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 7 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 370 Apr 4 2001 Entries -rw-r--r-- 1 stephens stephens 18 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/maks/opengl: total 20 drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 7 stephens stephens 4096 Jul 23 02:29 .. drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS -rw-r--r-- 1 stephens stephens 75 Feb 19 1999 Makefile -rwxr--r-- 1 stephens stephens 472 Jul 9 00:44 Makefile.use memdebug0.1/src/maks/opengl/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 88 Jul 9 00:44 Entries -rw-r--r-- 1 stephens stephens 25 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/maks/os: total 24 drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 7 stephens stephens 4096 Jul 23 02:29 .. drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS -rw-r--r-- 1 stephens stephens 116 Jan 13 2000 CYGWIN_98-4.10.mak -rw-r--r-- 1 stephens stephens 88 Jan 13 2000 CYGWIN.mak -rw-r--r-- 1 stephens stephens 77 Jan 13 2000 Linux.mak memdebug0.1/src/maks/os/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 138 Feb 2 2001 Entries -rw-r--r-- 1 stephens stephens 21 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/maks/win32: total 20 drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 . drwxr-sr-x 7 stephens stephens 4096 Jul 23 02:29 .. drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 CVS -rw-r--r-- 1 stephens stephens 75 Feb 19 1999 Makefile -rw-r--r-- 1 stephens stephens 101 Feb 19 1999 Makefile.use memdebug0.1/src/maks/win32/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Aug 13 19:44 . drwxr-sr-x 3 stephens stephens 4096 Jul 23 02:29 .. -rw-r--r-- 1 stephens stephens 88 Feb 2 2001 Entries -rw-r--r-- 1 stephens stephens 24 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root memdebug0.1/src/memdebug: total 108 drwxr-sr-x 3 stephens stephens 4096 Oct 19 21:58 . drwxrwxr-x 5 stephens stephens 4096 Oct 19 23:32 .. drwxr-sr-x 2 stephens stephens 4096 Oct 19 21:58 CVS -rw-r--r-- 1 stephens stephens 0 Jan 4 2000 getpagesize.h -rw-r--r-- 1 stephens stephens 50882 Jan 3 2000 gmalloc.c -rw-r--r-- 1 stephens stephens 598 Jan 4 2000 Makefile -rw-r--r-- 1 stephens stephens 90 Jan 4 2000 Makefile.use -rw-r--r-- 1 stephens stephens 367 Jan 3 2000 memcpp.cc -rw-r--r-- 1 stephens stephens 17659 Jan 4 2000 memdebug.c -rw-r--r-- 1 stephens stephens 2754 Jan 3 2000 memdebug.h -rw-rw-r-- 1 stephens stephens 224 Oct 19 21:36 PKG memdebug0.1/src/memdebug/CVS: total 20 drwxr-sr-x 2 stephens stephens 4096 Oct 19 21:58 . drwxr-sr-x 3 stephens stephens 4096 Oct 19 21:58 .. -rw-rw-r-- 1 stephens stephens 340 Oct 19 21:58 Entries -rw-r--r-- 1 stephens stephens 22 Feb 2 2001 Repository -rw-rw-r-- 1 stephens stephens 49 Aug 13 19:44 Root