/* public function c file */ /* written by Liu Zhiguo 2002-03-26 */ /* version 1.0 */ /* -------------------------------- */ #include "./include/includes.h" #include "./include/public.h" #include "./include/pub_debug.h" # ifndef S_SPLINT_S /*@ignore@*/ /* ++++++++++++++++++++++++++++++++++++++ */ /* transfer ascii code to bcd code */ /* ++++++++++++++++++++++++++++++++++++++ */ /* void AsciiToBcd (BYTE *bcd_buf, const char *ascii_buf, int len) { int i; char ch; char flag=0; if (ascii_buf == NULL) { for (i=0;i='a') ch -= 'a' - 10; else if (ch>='A') ch -= 'A' - 10; else ch -= '0'; if (flag) { if (i & 1) *bcd_buf = ch << 4; else *(bcd_buf++) |= ch & 0x0f; } else { if (i & 1) *(bcd_buf++) |= ch & 0x0f; else *bcd_buf = ch << 4; } } } */ /* ++++++++++++++++++++++++++++++++++++++ */ /* transfer bcd code to ascii code */ /* ++++++++++++++++++++++++++++++++++++++ */ /* void BcdToAscii (char *ascii_buf, const BYTE *bcd_buf, int len) { int i; char ch; if (bcd_buf == NULL) { for (i=0;i> 4; ascii_buf[i] = ch + ((ch > 9)? 'A'-10 : '0'); } ascii_buf[i] = '\0'; } */ /*@end@*/ #endif