Skip to content
Snippets Groups Projects
Commit 9e95b7a3 authored by edgrif's avatar edgrif
Browse files

add trivial func to convert single digit to char representation.

parent fadc31b4
No related branches found
No related tags found
No related merge requests found
......@@ -24,9 +24,9 @@
*
* Description: Utility functions for ZMap.
* HISTORY:
* Last edited: Dec 12 14:22 2008 (edgrif)
* Last edited: Mar 30 10:11 2009 (edgrif)
* Created: Thu Feb 26 10:33:10 2004 (edgrif)
* CVS info: $Id: zmapUtils.h,v 1.38 2008-12-15 14:06:26 edgrif Exp $
* CVS info: $Id: zmapUtils.h,v 1.39 2009-04-03 15:38:21 edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_UTILS_H
......@@ -167,6 +167,8 @@ gboolean zMapUtilsConfigDebug(char *debug_flag, gboolean *value) ;
char *zMapGetTimeString(ZMapTimeFormat format, char *format_str_in) ;
char zMapInt2Char(int num) ;
gboolean zMapStr2Bool(char *str, gboolean *bool_out) ;
gboolean zMapStr2Int(char *str_in, int *int_out) ;
gboolean zMapInt2Str(int int_in, char **str_out) ;
......
......@@ -26,9 +26,9 @@
*
* Exported functions: See ZMap/zmapUtils.h
* HISTORY:
* Last edited: Feb 9 09:51 2009 (edgrif)
* Last edited: Mar 30 10:11 2009 (edgrif)
* Created: Fri Mar 12 08:16:24 2004 (edgrif)
* CVS info: $Id: zmapUtils.c,v 1.29 2009-02-09 10:07:05 edgrif Exp $
* CVS info: $Id: zmapUtils.c,v 1.30 2009-04-03 15:38:21 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -279,6 +279,25 @@ char *zMapGetTimeString(ZMapTimeFormat format, char *format_str_in)
/* Given an int between 0 and 9 returns the corresponding char representation,
* (surely this must exist somewhere ??).
*
* Returns '.' if number not in [0-9]
* */
char zMapInt2Char(int num)
{
char result = '.' ;
char table[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} ;
if (num >= 0 && num <= 9)
result = table[num] ;
return result ;
}
/* There follow a series of conversion routines. These are provided either
* because there are no existing ones or because the existing ones have
* arcane usage.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment