📄 calltoda_db.c
字号:
} else { index --; } } if( rec->options.phones.phone3 == param->mode ) { if( index == 0 ) { src = rec->fields[phone3]; if( src != NULL ) { StrNCopy_WPJ( param->buf2, src, MAX_TEXT - 1 ); return true; } return false; } else { index --; } } if( rec->options.phones.phone4 == param->mode ) { if( index == 0 ) { src = rec->fields[phone4]; if( src != NULL ) { StrNCopy_WPJ( param->buf2, src, MAX_TEXT - 1 ); return true; } return false; } else { index --; } } if( rec->options.phones.phone5 == param->mode ) { if( index == 0 ) { src = rec->fields[phone5]; if( src != NULL ) { StrNCopy_WPJ( param->buf2, src, MAX_TEXT - 1 ); return true; } return false; } else { index --; } } return false;}static int numOfMatchedPhone( unsigned data, AddrDBRecordType *recP ){ int f = 0; if( data < numPhoneLabels ) { f = ((recP->options.phones.phone1 == data && recP->fields[phone1] != NULL) ? 1 : 0 ) + ((recP->options.phones.phone2 == data && recP->fields[phone2] != NULL) ? 1 : 0 ) + ((recP->options.phones.phone3 == data && recP->fields[phone3] != NULL) ? 1 : 0 ) + ((recP->options.phones.phone4 == data && recP->fields[phone4] != NULL) ? 1 : 0 ) + ((recP->options.phones.phone5 == data && recP->fields[phone5] != NULL) ? 1 : 0 ) ; } return f;}static int RemoveCtrlChrs( CharPtr buf ){ unsigned char *p; p = (unsigned char *)buf; while( *p != '\0' ) { if( *p < 0x20 ) { *p = ' '; } p ++; } return 0;}static CharPtr StrNCopy_WPJ( CharPtr dst, CharPtr src, Word num ){ Word c = 0; unsigned char *p; p = dst; while( *src != '\0' && *src != '\001' && c < num ) { *(p ++) = *(src ++); c ++; } *p = '\0'; return dst;}static CharPtr StrNCat_WPJ( CharPtr dst, CharPtr src, Word num ){ Word c = 0; unsigned char *p; p = dst; while( *p != '\0' ) { p ++; c ++; } while( *src != '\0' && *src != '\001' && c < num-1 ) { *(p ++) = *(src ++); c ++; } *p = '\0'; return dst;}static CharPtr StrNToLower( CharPtr dst, CharPtr src, Word maxChar ){ CharPtr p; Word num; Char c; p = dst; num = 1; while( (c = *(src ++)) != '\0' && num < maxChar ) { *(dst ++) = _toLower( c ); num ++; } *dst = '\0'; return p;}static void make_table_StrStrI_bm( Word *table, char *token ){ int i, length; length = StrLen( token ); for( i = 0; i <= 255 ; i++ ) { table[i] = length; } for( i = 0 ; i <= length - 2 ; i ++ ) { table[ (unsigned char)*(token + i) ] = length - i - 1; } return;}static Boolean isPrivateRecord( Param *param, UInt rec ){ UInt attr; Err err; err = DmRecordInfo( param->dbP, rec, &attr, NULL, NULL ); if( (err == 0) && (attr & dmRecAttrSecret) ) { return true; } else { return false; }}static void AddrUnpack(AddrPackedDBRecord *src, AddrDBRecordPtr dest){ Int index; ULong flags; char *p; dest->options = src->options; flags = src->flags.allBits; p = &src->firstField; for (index = firstAddressField; index < addressFieldsCount; index++) { // If the flag is set point to the string else NULL if (GetBitMacro(flags, index) != 0) { dest->fields[index] = p; p += StrLen(p) + 1; } else dest->fields[index] = NULL; }}static Err AddrGetPackedRecord(DmOpenRef dbP, UInt index, AddrPackedDBRecord **packedP, Handle *recordH){ AddrPackedDBRecord *src; if( (*recordH = DmQueryRecord(dbP, index)) == 0 ) return dmErrMemError; src = (AddrPackedDBRecord *) MemHandleLock(*recordH); if (src == NULL) return dmErrIndexOutOfRange; *packedP = src; return 0;}static Boolean StrStrI_bm_new01( char *str, char *token, Word *table, Word len_str, Word len_token ) { unsigned char lastCh; int i; lastCh = *(token + len_token - 1); if( len_token < 1 ) { return true; } for( i = 0 ; i < len_str ; i ++ ) { if( _toLower(*(str + i)) == lastCh ) { return true; } } return false;}static Boolean StrStrI_bm_new2( char *str, char *token, Word *table, Word len_str, Word len_token ) { unsigned char lastCh, ch; int i,j,k; lastCh = *(token + len_token - 1); i = len_token - 1; while( i < len_str ) { ch = _toLower(*(str + i)); if( ch == lastCh ) { j = len_token - 2; k = i - 1; while( *(token + j) == _toLower(*(str + k))) { if( j == 0 ) { return true; } j --; k --; } } i += *(table + ch); } return false;}static Boolean StrStr_bm_new01( char *str, char *token, Word *table, Word len_str, Word len_token ) { unsigned char lastCh; int i; lastCh = *(token + len_token - 1); if( len_token < 1 ) { return true; } for( i = 0 ; i < len_str ; i ++ ) { if( *(str + i) == lastCh ) { return true; } } return false;}static Boolean StrStr_bm_new2( char *str, char *token, Word *table, Word len_str, Word len_token ) { unsigned char lastCh, ch; int i,j,k; lastCh = *(token + len_token - 1); i = len_token - 1; while( i < len_str ) { ch = *(str + i); if( ch == lastCh ) { j = len_token - 2; k = i - 1; while( *(token + j) == *(str + k)) { if( j == 0 ) { return true; } j --; k --; } } i += *(table + ch); } return false;}static Boolean StrStrI_intl( char *str, char *token, Word *table, Word len_str, Word len_token ){ int i; if( len_str <= len_token ) { return (StrNCaselessCompare( str, token, len_str ) == 0); } for( i = 0 ; i < len_str - len_token + 1 ; i ++ ) { if( StrNCaselessCompare( str+i, token, len_token ) == 0 ) { return true; } } return false;}/* $Revision: 1.4 $ * * $Log: CallToDA_db.c,v $ * Revision 1.4 2001/04/28 16:53:53 kterada * add new option * * Revision 1.3 2001/02/24 09:28:40 kterada * debug "devide by zero" * * Revision 1.2 2001/02/23 16:16:36 kterada * port to gcc * * Revision 1.1 2001/01/19 16:12:07 kterada * add all items to repository * * Revision 1.6 2000/12/20 16:50:27 kterada * Add intl. comparation * * Revision 1.5 2000/08/21 16:28:28 kterada * fix overflowed text handling * * Revision 1.4 2000/08/08 15:23:35 kterada * debug for two or more same category phone * * Revision 1.3 2000/08/07 17:39:40 kterada * update for two or more same category * * Revision 1.2 2000/07/04 16:38:13 kterada * *** empty log message *** * */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -