📄 dkcj.c
字号:
iott_value[count].io_length = 0;
}
else
{
iott_value[count].io_offset = TEN_OFFSET;
iott_value[count].io_length = TEN_LENGTH;
}
break;
case 1:
if((length-count_position) > 4) {
iott_value[count].io_offset = MYRIAD_OFFSET;
iott_value[count].io_length = MYRIAD_LENGTH;
}
else
{
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
}
break;
}
iott_value[count].io_type = IO_DEV|IO_LINK;
iott_value[count].io_nextp = &iott_value[count+1];
iott_value[count].io_fhandle=szfile[filenum].filehandle;
iott_value[count].io_bufp = 0;
count++;
count_position++;
}
iott_value[count-1].io_type = IO_DEV|IO_EOT;
iott_value[count-1].io_nextp = NULL;
return(count);
}
int Index_sj(char* sj_value,DX_IOTT *iott_time,int filenum)
{
int count;
int count_a;
for(count=0; count<4; count++) {
iott_time[count].io_offset = fastnumfilewz[sj_value[count]-48].offset;
iott_time[count].io_length = fastnumfilewz[sj_value[count]-48].length;
}
iott_time[count].io_offset = YEARF_OFFSET;
iott_time[count].io_length = YEARF_LENGTH;
count++;
if(sj_value[4]==48) {
iott_time[count].io_offset = fastnumfilewz[sj_value[5]-48].offset;
iott_time[count].io_length = fastnumfilewz[sj_value[5]-48].length;
}
else
{
iott_time[count].io_offset = TENF_OFFSET;
iott_time[count].io_length = TENF_LENGTH;
count++;
if(sj_value[5]==48) {
iott_time[count].io_offset = 0;
iott_time[count].io_length = 0;
}
else {
iott_time[count].io_offset = fastnumfilewz[sj_value[5]-48].offset;
iott_time[count].io_length = fastnumfilewz[sj_value[5]-48].length;
}
}
count++;
iott_time[count].io_offset = MONTHF_OFFSET;
iott_time[count].io_length = MONTHF_LENGTH;
count++;
if(sj_value[6]==48) {
iott_time[count].io_offset = fastnumfilewz[sj_value[7]-48].offset;
iott_time[count].io_length = fastnumfilewz[sj_value[7]-48].length;
}
else
{
if(sj_value[6]==49) {
iott_time[count].io_offset = TENF_OFFSET;
iott_time[count].io_length = TENF_LENGTH;
count++;
}
else
{
iott_time[count].io_offset = fastnumfilewz[sj_value[6]-48].offset;
iott_time[count].io_length = fastnumfilewz[sj_value[6]-48].length;
count++;
iott_time[count].io_offset = TENF_OFFSET;
iott_time[count].io_length = TENF_LENGTH;
count++;
}
if(sj_value[7]==48) {
iott_time[count].io_offset = 0;
iott_time[count].io_length = 0;
}
else {
iott_time[count].io_offset = fastnumfilewz[sj_value[7]-48].offset;
iott_time[count].io_length = fastnumfilewz[sj_value[7]-48].length;
}
}
count++;
iott_time[count].io_offset = DAYF_OFFSET;
iott_time[count].io_length = DAYF_LENGTH;
for(count_a=0;count_a<count;count_a++) {
iott_time[count_a].io_type = IO_DEV|IO_LINK;
iott_time[count_a].io_nextp = &iott_time[count_a+1];
iott_time[count_a].io_fhandle=szfile[filenum].filehandle;
iott_time[count_a].io_bufp = 0;
}
iott_time[count_a].io_type = IO_DEV|IO_EOT;
iott_time[count_a].io_nextp = NULL;
iott_time[count_a].io_fhandle=szfile[filenum].filehandle;
iott_time[count_a].io_bufp = 0;
return(count+1);
}
int Index_value(char *sz_value,DX_IOTT *iott_value,int filenum)
{
int count_tmp;
int length_tmp;
int count_position;
int count;
int account;
int all_zero; //后面的值全为零的标志
int ling_flag; //播了'零'语音
int zero_yuan;
int zero_jiao;
int length;
int point;
int length_integer;
int length_decimal;
length=0;
while(sz_value[length]!=0)
length++;
for(point=1;point<=length;point++) {
if(sz_value[point-1]==46) {
break;
}
}
if(point<=length) {
length_integer=point-1;
length_decimal=length-point;
if(length_decimal>2) {
length_decimal=2;
length=point+2;
}
}
else
{
length_integer=length;
length_decimal=0;
}
count_position=0;
count=0;
ling_flag=1;
while((count_position<length_integer)&&(count<=LENGTH_VALUE)) {
account=sz_value[count_position];
if(( account == 48)&&( ling_flag == 1)) {
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
}
else
{
iott_value[count].io_offset = numberfilewz[account-48].offset;
iott_value[count].io_length = numberfilewz[account-48].length;
if( account== 48)
ling_flag=1;
else
ling_flag=0;
}
iott_value[count].io_type = IO_DEV|IO_LINK;
iott_value[count].io_nextp = &iott_value[count+1];
iott_value[count].io_fhandle=szfile[filenum].filehandle;
iott_value[count].io_bufp = 0;
length_tmp=(length_integer-count_position-1)%4+1;
count_tmp=1;
while(count_tmp<length_tmp) {
if((sz_value[count_position+count_tmp]>48)&&(sz_value[count_position+count_tmp]<=57)) {
all_zero=0;
break;
}
count_tmp++;
all_zero=1;
}
if(all_zero==1) {
ling_flag=1;
}
if(length_tmp == 1) {
for(count_tmp=count_position+1;count_tmp<length_integer;count_tmp++) {
if(( sz_value[count_tmp]>48)&&(sz_value[count_tmp]<=57)) {
all_zero=0;
break;
}
all_zero=1;
}
if(all_zero==1) {
ling_flag=1;
}
else
{
ling_flag=0;
}
}
count++;
switch ((length_integer-count_position)%4) {
case 0:
if((account<=48)||(account>57)){
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
}
else
{
iott_value[count].io_offset = THOUSAND_OFFSET;
iott_value[count].io_length = THOUSAND_LENGTH;
}
break;
case 3:
if((account<=48)||(account>57)){
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
}
else
{
iott_value[count].io_offset = HUNDRED_OFFSET;
iott_value[count].io_length = HUNDRED_LENGTH;
}
break;
case 2:
if((account<=48)||(account>57)){
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
}
else
{
iott_value[count].io_offset = TEN_OFFSET;
iott_value[count].io_length = TEN_LENGTH;
}
break;
case 1:
if((length_integer-count_position) > 4) {
iott_value[count].io_offset = MYRIAD_OFFSET;
iott_value[count].io_length = MYRIAD_LENGTH;
}
else
{
if(( length_integer == 1)&&( account == 48)) {
zero_yuan = 1;
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
}
else
{
zero_yuan=0;
iott_value[count].io_offset = YUAN_OFFSET;
iott_value[count].io_length = YUAN_LENGTH;
}
}
break;
}
iott_value[count].io_type = IO_DEV|IO_LINK;
iott_value[count].io_nextp = &iott_value[count+1];
iott_value[count].io_fhandle=szfile[filenum].filehandle;
iott_value[count].io_bufp = 0;
count++;
count_position++;
}
count_position=point;
ling_flag=1;
while ((count_position<length)&&(count<=LENGTH_VALUE)) {
account=sz_value[count_position];
if((account==48)&&(count_position+1<length)) {
if((sz_value[count_position+1]>48)&&(sz_value[count_position+1]<=57)&&(zero_yuan==0)) {
ling_flag=0;
}
else
ling_flag=1;
}
if((account==48)&&(ling_flag==1)) {
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
}
else
{
iott_value[count].io_offset = numberfilewz[account-48].offset;
iott_value[count].io_length = numberfilewz[account-48].length;
ling_flag=1;
}
iott_value[count].io_type = IO_DEV|IO_LINK;
iott_value[count].io_nextp = &iott_value[count+1];
iott_value[count].io_fhandle=szfile[filenum].filehandle;
iott_value[count].io_bufp = 0;
count++;
switch (length-count_position) {
case 2:
if((account<=48)||(account>57)){
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
zero_jiao = 1;
}
else
{
zero_jiao = 0;
iott_value[count].io_offset = JIAO_OFFSET;
iott_value[count].io_length = JIAO_LENGTH;
}
break;
case 1:
if((account<=48)||(account>57)){
if((zero_yuan==1)&&(zero_jiao==1)) {
iott_value[count].io_offset = numberfilewz[0].offset ;
iott_value[count].io_length = numberfilewz[0].length ;
}
else
{
iott_value[count].io_offset = 0;
iott_value[count].io_length = 0;
}
}
else
{
iott_value[count].io_offset = FEN_OFFSET;
iott_value[count].io_length = FEN_LENGTH;
}
break;
}
iott_value[count].io_type = IO_DEV|IO_LINK;
iott_value[count].io_nextp = &iott_value[count+1];
iott_value[count].io_fhandle=szfile[filenum].filehandle;
iott_value[count].io_bufp = 0;
count++;
count_position++;
}
iott_value[count-1].io_type = IO_DEV|IO_EOT;
iott_value[count-1].io_nextp = NULL;
return(count);
}
void time_out()
{
int channum;
for(channum=0;channum<argnum;channum++) {
if((cjtime())&&(!channal_work())) {
dxinfo[channum].chtime++;
}
if(dxinfo[channum].chtime>MAXTIME){
dxinfo[channum].chtime=0;
get_number();
if(cjstate.current_number<=headermessage.record_number) {
if(get_record(channum) == 1) { //取得记录数据
dx_sethook(dxinfo[channum].chdev,DX_OFFHOOK,EV_SYNC);
if(dial_telephone(channum) == 1) {
dxinfo[channum].idlework = ID_WORK;
}
}
}
}
}
signal(SIGALRM,(void (*)()) time_out);
alarm(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -