Check-in [ea627b1d2f]

Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:ea627b1d2f8502d936973e71fa1296b6f8adf7d1
Date: 2009-08-02 08:08:43
User: stephan
Comment:minor internal cleanups
Tags And Properties
Changes
hide diffs unified diffs patch

Changes to whprintf.c

Old (49b7a7dc214b209b) New (3624959abf938933)
1 /************************************************************************ 1 /************************************************************************
2 The printf-like implementation in this file is based on the one found 2 The printf-like implementation in this file is based on the one found
3 in the sqlite3 distribution is in the Public Domain. 3 in the sqlite3 distribution is in the Public Domain.
4 4
5 This copy was forked for use with the clob API in Feb 2008 by Stephan 5 This copy was forked for use with the clob API in Feb 2008 by Stephan
20 hidden lines
26 26
27 #include <stdio.h> /* FILE */ 27 #include <stdio.h> /* FILE */
28 #include <string.h> /* strlen() */ 28 #include <string.h> /* strlen() */
29 #include <stdlib.h> /* free/malloc() */ 29 #include <stdlib.h> /* free/malloc() */
30 #include <ctype.h> 30 #include <ctype.h>
31 | 31 #include <stdint.h>
32 #include "whprintf.h" 32 #include "whprintf.h"
33 typedef long double LONGDOUBLE_TYPE; 33 typedef long double LONGDOUBLE_TYPE;
34 34
35 /* 35 /*
36 If WHPRINTF_OMIT_FLOATING_POINT is defined to a true value, then 36 If WHPRINTF_OMIT_FLOATING_POINT is defined to a true value, then
307 hidden lines
344 */ 344 */
345 #ifndef WHPRINTF_BUF_SIZE 345 #ifndef WHPRINTF_BUF_SIZE
346 # define WHPRINTF_BUF_SIZE 350 /* Size of the output buffer for numeric conversions */ 346 # define WHPRINTF_BUF_SIZE 350 /* Size of the output buffer for numeric conversions */
347 #endif 347 #endif
348 348
> 349 #if ! defined(__STDC__) && !defined(__TINYC__)
349 #ifdef WHPRINTF_INT64_TYPE 350 #ifdef WHPRINTF_INT64_TYPE
350 typedef WHPRINTF_INT64_TYPE int64_t; 351 typedef WHPRINTF_INT64_TYPE int64_t;
351 typedef unsigned WHPRINTF_INT64_TYPE uint64_t; 352 typedef unsigned WHPRINTF_INT64_TYPE uint64_t;
352 #elif defined(_MSC_VER) || defined(__BORLANDC__) 353 #elif defined(_MSC_VER) || defined(__BORLANDC__)
353 typedef __int64 int64_t; 354 typedef __int64 int64_t;
354 typedef unsigned __int64 uint64_t; 355 typedef unsigned __int64 uint64_t;
355 #else 356 #else
356 typedef long long int int64_t; 357 typedef long long int int64_t;
357 typedef unsigned long long int uint64_t; 358 typedef unsigned long long int uint64_t;
> 359 #endif
358 #endif 360 #endif
359 361
360 #if 0 362 #if 0
361 / Not yet used. */ 363 / Not yet used. */
362 enum PrintfArgTypes { 364 enum PrintfArgTypes {
398 hidden lines
761 LONGDOUBLE_TYPE realvalue; /* Value for real types */ 763 LONGDOUBLE_TYPE realvalue; /* Value for real types */
762 const et_info *infop = 0; /* Pointer to the appropriate info structure */ 764 const et_info *infop = 0; /* Pointer to the appropriate info structure */
763 char buf[WHPRINTF_BUF_SIZE]; /* Conversion buffer */ 765 char buf[WHPRINTF_BUF_SIZE]; /* Conversion buffer */
764 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */ 766 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
765 etByte errorflag = 0; /* True if an error is encountered */ 767 etByte errorflag = 0; /* True if an error is encountered */
766 etByte xtype; /* Conversion paradigm */ | 768 etByte xtype = 0; /* Conversion paradigm */
767 char * zExtra = 0; /* Extra memory used for etTCLESCAPE conversions */ 769 char * zExtra = 0; /* Extra memory used for etTCLESCAPE conversions */
768 #if ! WHPRINTF_OMIT_FLOATING_POINT 770 #if ! WHPRINTF_OMIT_FLOATING_POINT
769 int exp, e2; /* exponent of real numbers */ 771 int exp, e2; /* exponent of real numbers */
770 double rounder; /* Used for rounding floating point values */ 772 double rounder; /* Used for rounding floating point values */
771 etByte flag_dp; /* True if decimal point should be shown */ 773 etByte flag_dp; /* True if decimal point should be shown */
593 hidden lines
1365 va_start( vargs, fmt ); 1367 va_start( vargs, fmt );
1366 char * ret = whprintfv_str( fmt, vargs ); 1368 char * ret = whprintfv_str( fmt, vargs );
1367 va_end( vargs ); 1369 va_end( vargs );
1368 return ret; 1370 return ret;
1369 } 1371 }

Changes to whprintf.h

Old (3f753713796eea59) New (17c9beb8377f1545)
1 #ifndef WHPRINTF_H_INCLUDED_ | 1 #ifndef WANDERINGHORSE_NET_WHPRINTF_H_INCLUDED
2 #define WHPRINTF_H_INCLUDED_ 1 | 2 #define WANDERINGHORSE_NET_WHPRINTF_H_INCLUDED 1
3 #include <stdarg.h> 3 #include <stdarg.h>
> 4 #include <stdio.h> /* FILE handle */
4 #ifdef __cplusplus 5 #ifdef __cplusplus
5 extern "C" { 6 extern "C" {
6 #endif 7 #endif
7 /**@page whprintf_page_main whprintf: generic printf-like utilities | 8 /** @page whprintf_page_main whprintf printf-like API
8 9
9 This API contains a printf-like implementation which supports 10 This API contains a printf-like implementation which supports
10 aribtrary data destinations. 11 aribtrary data destinations.
11 12
12 Authors: many, probably. This code supposedly goes back to the 13 Authors: many, probably. This code supposedly goes back to the
148 hidden lines
161 char * whprintf_str( char const * fmt, ... ); 162 char * whprintf_str( char const * fmt, ... );
162 163
163 #ifdef __cplusplus 164 #ifdef __cplusplus
164 } /* extern "C" */ 165 } /* extern "C" */
165 #endif 166 #endif
166 #endif /* WHPRINTF_H_INCLUDED_ */ | 167 #endif /* WANDERINGHORSE_NET_WHPRINTF_H_INCLUDED */