Overview
| Artifact ID: | 6ea2a1d70bd0d0da004e1a700fff93f21e1ffd8c |
|---|---|
| Ticket: | 722737ffffffffffffffffffffffffffffffffff |
| Date: | 2003-12-20 00:23:36 |
| User: | kennykb |
| Artifact Attached: | 7e66b271e135df5f063207e076c5ee3b90f88472 |
| Filename: | tclDToA.c |
| Description: | New file "generic/tclDToA.c" |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113/* *---------------------------------------------------------------------- * * tclDToA.c -- * File defining external procedures 'Tcl_DToA', 'Tcl_StrToD', * and 'Tcl_FreeDToA' for conversion between floating point and * decimal. * * Copyright (c) 2003 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclListObj.c,v 1.13 2002/01/07 23:09:13 dgp Exp $ * *---------------------------------------------------------------------- * */ #include <tclInt.h> #include <stdlib.h> #include <string.h> /* *---------------------------------------------------------------------- * * localMalloc -- * * Alias function for Tcl_Alloc with the type signature of * 'malloc', used as a macro substituent for MALLOC in Gay's * 'dtoa.c'. * * Results: * Returns a pointer to a newly allocated block of memory. * * Side effects: * Manipulates the heap to allocate memory. * *---------------------------------------------------------------------- */ static void* localMalloc (size_t n) /* n - size of block to allocate */ { return (void*) Tcl_Alloc( n ); } /* * Define endian-ness of the target machine for dtoa.c */ #ifdef WORDS_BIGENDIAN #define IEEE_MC68k 1 #else #define IEEE_8087 1 #endif /* * Define 32-bit integer types for dtoa.c */ #ifdef TCL_WIDE_INT_IS_LONG #define Long int #define ULong unsigned int #endif /* * Define 64-bit integer types for dtoa.c */ #define Llong Tcl_WideInt #define ULLong Tcl_WideUInt /* * Define memory allocator for dtoa.c */ #define MALLOC localMalloc /* * dtoa.c should check for Infinity and Nan on output. */ #define INFNAN_CHECK 1 /* * Define synchronization primitives for dtoa.c */ #define MULTIPLE_THREADS TCL_THREADED #ifdef TCL_THREADED TCL_DECLARE_MUTEX(dtoaMutex0) TCL_DECLARE_MUTEX(dtoaMutex1) #define ACQUIRE_DTOA_LOCK(n) Tcl_MutexLock( JOIN(dtoaMutex,n) ) #define FREE_DTOA_LOCK(n) Tcl_MutexUnlock( JOIN(dtoaMutex,n) ) #else #define ACQUIRE_DTOA_LOCK(n) /* empty */ #define FREE_DTOA_LOCK(n) /* empty */ #endif /* * Rename the supplied functions dtoa, strtod, and freedtoa to * appropriate names in the Tcl internal Stubs table. */ #define dtoa TclDToA #define strtod TclStrToD #define freedtoa TclFreeDToA /* * Bring in Gay's double-to-ASCII code. */ #include "dtoa.c"