Boost logo

Boost-Commit :

From: grafikrobot_at_[hidden]
Date: 2007-11-27 12:55:13


Author: grafik
Date: 2007-11-27 12:55:13 EST (Tue, 27 Nov 2007)
New Revision: 41415
URL: http://svn.boost.org/trac/boost/changeset/41415

Log:
Add some utility output formatting functions.
Text files modified:
   trunk/tools/jam/src/output.c | 24 ++++++++++++++++++++++++
   trunk/tools/jam/src/output.h | 6 ++++++
   2 files changed, 30 insertions(+), 0 deletions(-)

Modified: trunk/tools/jam/src/output.c
==============================================================================
--- trunk/tools/jam/src/output.c (original)
+++ trunk/tools/jam/src/output.c 2007-11-27 12:55:13 EST (Tue, 27 Nov 2007)
@@ -6,6 +6,7 @@
 
 #include "jam.h"
 #include "output.h"
+#include "newstr.h"
 #include <stdio.h>
 
 #define bjam_out (stdout)
@@ -95,3 +96,26 @@
     fflush(bjam_err);
     fflush(globs.cmdout);
 }
+
+
+char * outf_int( int value )
+{
+ char buffer[50];
+ sprintf(buffer, "%i", value);
+ return newstr(buffer);
+}
+
+char * outf_double( double value )
+{
+ char buffer[50];
+ sprintf(buffer, "%f", value);
+ return newstr(buffer);
+}
+
+char * outf_time( time_t value )
+{
+ char buffer[50];
+ strftime(buffer,49,"%Y-%m-%d %H:%M:%SZ",gmtime(&value));
+ return newstr(buffer);
+}
+

Modified: trunk/tools/jam/src/output.h
==============================================================================
--- trunk/tools/jam/src/output.h (original)
+++ trunk/tools/jam/src/output.h 2007-11-27 12:55:13 EST (Tue, 27 Nov 2007)
@@ -7,6 +7,8 @@
 #ifndef BJAM_OUTPUT_H
 #define BJAM_OUTPUT_H
 
+#include <time.h>
+
 #define EXIT_OK 0
 #define EXIT_FAIL 1
 #define EXIT_TIMEOUT 2
@@ -20,4 +22,8 @@
     int exit_reason
     );
 
+char * outf_int( int value );
+char * outf_double( double value );
+char * outf_time( time_t value );
+
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk