Tiny namespace for hybrid36 format. More...
Functions | |
static const char * | decode_pure (const int *digits_values, unsigned digits_size, const char *s, unsigned s_size, int *result) |
static const char * | digits_lower () |
static const char * | digits_upper () |
static void | encode_pure (const char *digits, unsigned digits_size, unsigned width, int value, char *result) |
static void | fill_with_stars (unsigned width, char *result) |
const char * | hy36decode (unsigned width, const char *s, unsigned s_size, int *result) |
const char * | hy36encode (unsigned width, int value, char *result) |
static const char * | invalid_number_literal () |
static const char * | unsupported_width () |
static const char * | value_out_of_range () |
Tiny namespace for hybrid36 format.
This namespace includes freely available tools for h36 format.
|
static |
|
static |
|
static |
C port of the hy36encode() and hy36decode() functions in the hybrid_36.py Python prototype/reference implementation. See the Python script for more information.
This file has no external dependencies, NOT even standard C headers. Optionally, use hybrid_36_c.h, or simply copy the declarations into your code.
This file is unrestricted Open Source (cctbx.sf.net). Please send corrections and enhancements to cctbx . @cci .lbl. gov
See also: http://cci.lbl.gov/hybrid_36/
Ralf W. Grosse-Kunstleve, Feb 2007.
|
static |
|
static |
const char * PLMD::h36::hy36decode | ( | unsigned | width, |
const char * | s, | ||
unsigned | s_size, | ||
int * | result | ||
) |
hybrid-36 decoder: converts string s to integer result
width: must be 4 (e.g. for residue sequence numbers) or 5 (e.g. for atom serial numbers)
s: string to be converted does not have to be null-terminated
s_size: size of s must be equal to width, or an error message is returned otherwise
result: integer holding the conversion result
return value: pointer to error message, if any, or 0 on success
Example usage (from C++): int result; const char* errmsg = hy36decode(width, "A1T5", 4, &result); if (errmsg) throw std::runtime_error(errmsg);
const char * PLMD::h36::hy36encode | ( | unsigned | width, |
int | value, | ||
char * | result | ||
) |
hybrid-36 encoder: converts integer value to string result
width: must be 4 (e.g. for residue sequence numbers) or 5 (e.g. for atom serial numbers)
value: integer value to be converted
result: pointer to char array of size width+1 or greater on return result is null-terminated
return value: pointer to error message, if any, or 0 on success
Example usage (from C++): char result[4+1]; const char* errmsg = hy36encode(4, 12345, result); if (errmsg) throw std::runtime_error(errmsg);
|
static |
|
static |
|
static |
Hosted by GitHub | 1.8.14 |