17#define WORD_LENGTH_INC 7
18#define WORD_MASK 0xfffffffffffffff8
21#define BLOCK_SIZE 65536
42#if (!defined(NO_FAST_ALLOC)) && (!defined(X11TEXMACS))
44#ifdef OLD_GNU_COMPILER
46operator new (
size_t s,
void*
loc) {
50operator new[] (
size_t s,
void*
loc) {
65template <
typename C,
typename A1>
73template <
typename C,
typename A1,
typename A2>
81template <
typename C,
typename A1,
typename A2>
89template <
typename C,
typename A1,
typename A2>
97template <
typename C,
typename A1,
typename A2>
105template <
typename C,
typename A1,
typename A2,
typename A3>
113template <
typename C,
typename A1,
typename A2,
typename A3>
121template <
typename C,
typename A1,
typename A2,
typename A3>
129template <
typename C,
typename A1,
typename A2,
typename A3>
137template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4>
145template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4>
153template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
162template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
171template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
180template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
181 typename A5,
typename A6>
190template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
191 typename A5,
typename A6>
199template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
200 typename A5,
typename A6,
typename A7>
209template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
210 typename A5,
typename A6,
typename A7>
219template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
220 typename A5,
typename A6,
typename A7,
typename A8>
229template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
230 typename A5,
typename A6,
typename A7,
typename A8>
238template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
239 typename A5,
typename A6,
typename A7,
typename A8,
typename A9>
248template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
249 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
260template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
261 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
262 typename A10,
typename A11>
268 (
void)
new (
ptr)
C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11);
272template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
273 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
274 typename A10,
typename A11,
typename A12>
280 (
void)
new (
ptr)
C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12);
284template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
285 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
292 (
void)
new (
ptr)
C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13);
296template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
297 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
305 C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14);
309template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
310 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
320 C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14,
a15);
324template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
325 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
327 typename A15,
typename A16,
typename A17>
334 (
void)
new (
ptr)
C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
339template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
340 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
343 typename A20,
typename A21>
351 (
void)
new (
ptr)
C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
375 for (
int i= 0; i < n; i++,
ctr++)
376 (
void)
new ((
void*)
ctr)
C ();
377 *((
int*)
ctr)= 0x55AA;
388 int n1 = *((
int*)
ptr);
390 int n = *((
int*)
ptr);
392 printf (
"tm_delete_array size mismatch: %d:%d vs %d:%d\n", n, n +
comp,
n1,
397 if (*((
int*)
ctr) != 0x55AA) {
398 printf (
"tm_delete_array buffer overflow\n");
401 for (
int i= 0; i < n; i++,
ctr--)
413 for (
int i= 0; i < n; i++,
ctr++)
414 (
void)
new ((
void*)
ctr)
C ();
429 (
void)
new ((
void*)
ctr)
C ();
438 int n = *((
int*)
ptr);
440 for (
int i= 0; i < n; i++,
ctr--)
452#if defined(NO_FAST_ALLOC) || defined(X11TEXMACS)
457void operator delete (
void*
ptr)
throw ();
459void operator delete[] (
void*
ptr)
throw ();
461void*
operator new (
size_t s);
462void operator delete (
void*
ptr);
463void*
operator new[] (
size_t s);
464void operator delete[] (
void*
ptr);
474template <
typename C,
typename A1>
480template <
typename C,
typename A1,
typename A2>
483 return new C (
a1,
a2);
486template <
typename C,
typename A1,
typename A2>
489 return new C (
a1,
a2);
492template <
typename C,
typename A1,
typename A2>
495 return new C (
a1,
a2);
498template <
typename C,
typename A1,
typename A2>
501 return new C (
a1,
a2);
504template <
typename C,
typename A1,
typename A2,
typename A3>
510template <
typename C,
typename A1,
typename A2,
typename A3>
516template <
typename C,
typename A1,
typename A2,
typename A3>
522template <
typename C,
typename A1,
typename A2,
typename A3>
528template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4>
534template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4>
540template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
547template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
554template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
561template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
562 typename A5,
typename A6>
569template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
570 typename A5,
typename A6>
576template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
577 typename A5,
typename A6,
typename A7>
584template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
585 typename A5,
typename A6,
typename A7>
592template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
593 typename A5,
typename A6,
typename A7,
typename A8>
600template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
601 typename A5,
typename A6,
typename A7,
typename A8>
607template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
608 typename A5,
typename A6,
typename A7,
typename A8,
typename A9>
615template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
616 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
625template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
626 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
627 typename A10,
typename A11>
632 return new C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11);
635template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
636 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
637 typename A10,
typename A11,
typename A12>
642 return new C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12);
645template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
646 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
652 return new C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13);
655template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
656 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
662 return new C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14);
665template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
666 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
674 return new C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14,
678template <
typename C,
typename A1,
typename A2,
typename A3,
typename A4,
679 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
682 typename A20,
typename A21>
689 return new C (
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14,
The list class represents a linked list.
list(T item)
Construct a new list object with a single item.
void * fast_realloc(void *ptr, size_t old_size, size_t new_size)
C * tm_resize_array(int new_num, C *Ptr)
void fast_free(void *ptr, size_t s)
void fast_delete(void *ptr)
void * fast_new(size_t s)
void * fast_alloc(size_t s)
void * alloc_check(const char *msg, void *ptr, size_t *sp)
void tm_delete_array(C *Ptr)