/*************************************************************************************** * * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. * * By downloading, copying, installing or using the software you agree to this license. * If you do not agree to this license, do not download, install, * copy or use the software. * * Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved. * * Redistribution and use in binary forms, with or without modification, are permitted. * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * ****************************************************************************************/ /***************************************************************************************/ #include "sys_inc.h" #include "word_analyse.h" /***************************************************************************************/ HT_API BOOL is_char(char ch) { if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '#') || (ch == '@') || (ch == '/')) { return TRUE; } return FALSE; } HT_API BOOL is_num(char ch) { if (ch >= '0' && ch <= '9') { return TRUE; } return FALSE; } static char separator[] = {' ','\t','\r','\n',',',':','{','}','(',')','\0','\'','"','?','<','>','=',';'}; HT_API BOOL is_separator(char ch) { uint32 i; for (i=0; i 15) { return FALSE; } for (i=0; i<4; i++) { if ((address[index] < '0') || (address[index] > '9')) { return FALSE; } if (((address[index +1] < '0') || (address[index +1] > '9')) && (address[index +1] != '.')) { if ((address[index +1] == '\0') && (i == 3)) { return TRUE; } return FALSE; } if (address[index +1] == '.') { index+=2; continue; } if (((address[index +2] < '0') || (address[index +2] > '9')) && (address[index +2] != '.')) { if ((address[index +2] == '\0') && (i == 3)) { return TRUE; } return FALSE; } if (address[index +2] == '.') { index+=3; continue; } if (i < 3) { if (address[index +3] != '.') { return FALSE; } } byte_value = (address[index] - '0') *100 + (address[index +1] -'0') *10 + (address[index +2] - '0'); if (byte_value > 255) { return FALSE; } if (i < 3) { index += 4; } else { index += 3; } } if (index != total_len) { return FALSE; } return TRUE; } HT_API BOOL is_integer(char * p_str) { int i; int len = (int)strlen(p_str); for (i=0; i= buf_len) { return bHaveNextWord; } *next_word_offset = cur_word_offset + len; if ((*next_word_offset >= line_max_len) || (line[*next_word_offset] == '\0')) { bHaveNextWord = FALSE; } switch (w_t) { case WORD_TYPE_NULL: break; case WORD_TYPE_STRING: if (len == 0 && is_separator(*ptr_end)) { (*next_word_offset)++; word_buf[0] = *ptr_end; word_buf[1] = '\0'; return bHaveNextWord; } break; case WORD_TYPE_NUM: { char * ptr; for (ptr=ptr_start; ptr value_len) { len = value_len - 1; } memcpy(value, value_start, len); value[len] = '\0'; return TRUE; } else { char * ptr = text_buf + next_offset; while((*ptr == ' ' || *ptr == '\t') && (next_offset