diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:30:32 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:30:32 -0800 |
commit | 8b23a6c7e1aee255004dd19098d4c2462b61b849 (patch) | |
tree | 7a4d682ba51f0ff0364c5ca2509f515bdaf96de9 /android/utils/misc.h | |
parent | f721e3ac031f892af46f255a47d7f54a91317b30 (diff) | |
download | external_qemu-8b23a6c7e1aee255004dd19098d4c2462b61b849.zip external_qemu-8b23a6c7e1aee255004dd19098d4c2462b61b849.tar.gz external_qemu-8b23a6c7e1aee255004dd19098d4c2462b61b849.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'android/utils/misc.h')
-rw-r--r-- | android/utils/misc.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/android/utils/misc.h b/android/utils/misc.h new file mode 100644 index 0000000..0db1e28 --- /dev/null +++ b/android/utils/misc.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2007-2008 The Android Open Source Project +** +** This software is licensed under the terms of the GNU General Public +** License version 2, as published by the Free Software Foundation, and +** may be copied, distributed, and modified under those terms. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +*/ +#ifndef _ANDROID_UTILS_MISC_H +#define _ANDROID_UTILS_MISC_H + +#include <stdint.h> + +/** TABULAR OUTPUT + ** + ** prints a list of strings in row/column format + ** + **/ + +extern void print_tabular( const char** strings, int count, + const char* prefix, int width ); + +/** CHARACTER TRANSLATION + ** + ** converts one character into another in strings + **/ + +extern void buffer_translate_char( char* buff, + unsigned buffLen, + const char* src, + char fromChar, + char toChar ); + +extern void string_translate_char( char* str, char from, char to ); + +/** TEMP CHAR STRINGS + ** + ** implement a circular ring of temporary string buffers + **/ + +extern char* tempstr_get( int size ); +extern char* tempstr_format( const char* fmt, ... ); + +/** QUOTING + ** + ** dumps a human-readable version of a string. this replaces + ** newlines with \n, etc... + **/ + +extern const char* quote_bytes( const char* str, int len ); +extern const char* quote_str( const char* str ); + +/** DECIMAL AND HEXADECIMAL CHARACTER SEQUENCES + **/ + +/* decodes a sequence of 'len' hexadecimal chars from 'hex' into + * an integer. returns -1 in case of error (i.e. badly formed chars) + */ +extern int hex2int( const uint8_t* hex, int len ); + +/* encodes an integer 'val' into 'len' hexadecimal charaters into 'hex' */ +extern void int2hex( uint8_t* hex, int len, int val ); + +#endif /* _ANDROID_UTILS_MISC_H */ |