📄 dt900.c
字号:
Dsp_str("工号:",3,0); Dsp_str(workerNo,3,5); Dsp_str("姓名:",5,0);
Dsp_str(workername,5,5); Dsp_str("密码:",7,0); cc: k=5;j=0; ret1=getkey3();
while(ret1!=0x0d && ret1!=0x0c) { password[j]=ret1; Dsp_str("*",7,k);
ret1=getkey3(); k++;j++; if(j>4) break; } password[j]=0x0;
for(i=strlen(password);i<4;i++) password[i]=' '; password[i]=0x0;
if(ret1==0x0c) { return(0); } if(strlen(password)>5 && times>=2) {
sound_get(); Dsp_str("三次输入密码错误!",7,2); Dsp_str("按任意键退出",9,0); getkey();
return(0) ; } else if(strlen(password)>5 && times<2) {
sound_get(); Dsp_str("密码错误!",9,2); getkey(); times=times+1; goto cd; }
if(strcmp(memberman,"NGS ")!=0) { if(strcmp(password,workerpw)!=0 &&
times>=2 ) { sound_get(); Dsp_str("三次输入密码错误!",9,2); getkey(); return(0); }
else if(strcmp(password,workerpw)!=0 && times<2) { sound_get();
Dsp_str("密码错误!",9,2); getkey(); times=times+1; goto cd; } else
if(strcmp(password,workerpw)==0) {memset(workernum,0x0,4);
strcpy(workernum,workerNo); } }/*if(strcmp(memberman,"NGS ")!=0)*/ else {
if(strcmp(password,"1685")==0) {memset(workernum,0x0,4); strcpy(workernum,"NGS
"); } else { sound_get(); Dsp_str("密码错误!",9,2); getkey(); goto cd; } }
return(1); } FNC_Init(); return(0); } void upc_opr(B *huijie) { int i; B
tempbarc[20]; strcpy(tempbarc,huijie);
if(strlen(tempbarc)==13&&tempbarc[0]==0x30) { for(i=0;i<12;i++)
huijie[i]=tempbarc[i+1]; huijie[i]=0x0; } } void del_menu(void) { short
x,y,cnt,lp; H code,ret; unsigned char cmsg[][22]={"*** 数据删除 ***", "1:删除入库数据",
"2:删除出库数据", "3:删除盘点数据", "[CLR] 退出" }; for(;;) { lcd_cls(); for( x=0,y=1,cnt=0;
cnt<5; y+=2,cnt++ ) { { lcd_csr_put( y, x );
cputstr(LCD_ATTR_NORMAL,cmsg[cnt]); } } for (;;) { code=getkey(); if
((char)(code)==12) return; if(code >= '1' && code <= '3') { code
-= 0x30; break; } } switch (code) { case 1: ret=del_opr(fruku); break; case 2:
ret=del_opr(fchuku); break; case 3: ret=del_opr(fpandian); break; } } } int
del_opr(B *filename) { H code; lcd_cls(); Dsp_str("删除",2,0);
Dsp_str(filename,2,5); Dsp_str("YES<ENT>",4,3); Dsp_str("NO<ANY key>",6,3);
code=getkey(); if(code == 0xd) { lcd_cls(); Dsp_str("即将删除",1,0);
Dsp_str(filename,3,0); Dsp_str(" YES<F4>",5,0); Dsp_str(" NO<ANY key>",7,0);
code=getkey(); if(code==16) { lcd_cls(); lcd_csr_put( 3 , 0 );
cputstr(LCD_ATTR_NORMAL , (B *)"数据清零..." ); lcd_csr_put( 5 , 5 );
cputstr(LCD_ATTR_NORMAL , (B *)"请稍等" ); dat_fdel(filename); Wait2( 5L ); Wait2(
5L ); s_sound( 2250, 5 ); return 1; } } return 0; } void Comm(void) { short
x,y,cnt,lp; H code; unsigned char cmsg[][23]={"1:下传数据资料", "2:上传入库 3:上传出库",
"4:上传盘点", "[CLR] 返回主菜单" }; for(;;) { lcd_cls(); Dsp_str("***** 数据通讯 *****",1,0);
for( x=0,y=3,cnt=0; cnt<4; y+=2,cnt++ ) { { lcd_csr_put( y, x );
cputstr(LCD_ATTR_NORMAL,cmsg[cnt]); } } for (;;) { code=getkey(); if
((char)(code)==12) return; if(code >= '1' && code <= '3') { code
-= 0x30; break; } } switch (code) { case 1: lp=recvfile(); break; case 2:
sendfile("ruku txt"); break; case 3: sendfile("chuku txt"); break; case 4:
sendfile("pandian txt"); break; } } } int recvfile(void) { ER ercd,fup; UH idx;
struct sys_tty param; B rec_buff[60]; FILE *file_a,*file_b; CU_FILE_INFO_FORM
fileInfo[2]; UH fileCount; lcd_cls(); Dsp_str("Recieving...",3,1);
Dsp_str("<F1>取消",5,1); cu_stopKeySet( CU_FNC_1 ); param.speed = B_19200;
param.length = CHAR_8; param.parity = PARI_NON; param.stop_bit = STOP_1; ercd =
cu_setDrive(CU_DRIVE_B); ercd = cu_open( COM , CU_CNCT_MULT , ¶m ); if(ercd !=
E_OK) { cu_stopKeySet( CU_FNC_NON ); lcd_cls(); lcd_csr_put( 1 , 0 ); cputstr(
LCD_ATTR_NORMAL , (B *)"COM 打开错误" ); lcd_csr_put( 5 , 0 ); cputstr(
LCD_ATTR_NORMAL , (B *)" 按任意键 !" ); ercd = cu_setDrive(CU_DRIVE_A); key_clear();
getkey(); return( 1 ); } fileCount = 3; ercd = cu_fileRecv( COM , 0 ,
CU_KIND_OTHER , &fileCount , &fileInfo , CU_GRAPH_ON_1 , 1 ); if(ercd !=
E_OK) { cu_close( COM ); cu_stopKeySet( CU_FNC_NON ); lcd_cls(); lcd_csr_put( 1
, 0 ); cputstr(LCD_ATTR_NORMAL , (B *)" 文件下传错误" ); lcd_csr_put( 5 , 0 );
cputstr( LCD_ATTR_NORMAL , (B *)" 请按任意键!" ); ercd = cu_setDrive(CU_DRIVE_A);
key_clear(); getkey(); return( 1 ); } cu_close( COM ); cu_stopKeySet( CU_FNC_NON
); key_clear(); lcd_cls(); lcd_csr_put( 1 , 0 ); cputstr(LCD_ATTR_NORMAL , (B
*)" 文件下传结束" ); lcd_csr_put( 5 , 0 ); cputstr( LCD_ATTR_NORMAL , (B *)" 请按任意键!"
); getkey(); ercd = cu_setDrive(CU_DRIVE_A); return( 0 ); } void addzero(B
*str,H len) { B temp[20]; H i; for(i=0;i<(KeyLen-len);i++) temp[i]='0';
temp[i]=0x0; strcat(temp,str); strcpy(str,temp); str[KeyLen]=0x0; }
/******************************************************************************
** Routine name: read_str ** ** Detail : 根据指定的模式读入字符串 ** ** Parameter : int
x,int y: 读入字符的回显位置 ** ** int mode : 指定读入的模式aal of barocde type ** ** 0: All;
1:scan only; 2:key only ** ** B *str : 字符串用来存放读入的字符串 ** ** 输入的时候可以放入缺省内容 ** **
int len : 读取字符串的长度 ** ** Return value: 0 : OK; 1:CLR; 2:Error ** ** Last Date :
1998/07/01 ** ** Author : CLCE YangDongQing **
******************************************************************************/
int read_str(int x,int y,int mode,B *str,int lenth) { /*** OBR DATA BUFFER
************/ B obr_data[48]; KEY_INPS key_str; KEY_INP key_chr; ER ret; W Leng;
B Lcnt,Len; UW Code; H csr_x,csr_y,csr_type; int i; /*** BAR CODE STORE AREA
INITIALIZE ***/ for( i=0; i<48; i++ ) { obr_data[i] = 0x00; } /*
for(i=0;i<LENTH;I++) for(i="0;i<lenth;i++)" } * { int B break; ); key if(ss1
else strtemp[i+1]="string[i+1];" if(ss0%2) strtemp[i]="string[i];" (ss0<8) if
ss1="string[i+1]-0xa1+0x40;" ss0="string[i]-0xb0;" if(string[i]="=0)" i++;
continue; if(string[i+1]<0x80) if(string[i]<0x80) }; if(string[i+1]="=0)"
strtemp[67],ss0,ss1; char unsigned i; *string) attrib,unsigned cputstr(int
******************************************************************************
** YangDongQing CLCE : Author 01 07 1998 Date Last OK 0 value: Return message
Display *msg attrib Parameter string Chinese display Detail cputstr name:
Routine ret; return OBR_close(); OBR_chgbuf(OBR_BUFOBR); lcd_csr_set(csr_type);
ret="OBR_open(" error default: KEY_CLR_EXT; | key_str.ext="KEY_OBR_EXT" only 2:
case str[i]="0x31;" if(obr_data[i]="=0x00)" CR_Check(obr_data,Len);
obr_data[Len]="0x00;" 读条码 &Len &Code, &obr_data[0], &Lcnt &Leng, if(ret="=E_OK)"
if(0xc="=ret)" if(E_KEY_OBR="=ret)" while(1) OBR_flush(); OPEN OBR 0x00000000 1:
cputstr(LCD_ATTR_NORMAL,?test?); key_read(&key_chr);
cputstr(LCD_ATTR_NORMAL,obr_data); sprintf(obr_data,?%x?,str[i]);
lcd_csr_put(3,0); 显示键值 and BOR 0: 判断工作模式 switch(mode) key_clear();
buf(OBR_STOFF);* lcd_csr_set(LCD_CSR_UNDER);
lcd_csr_get(&csr_x,&csr_y,&csr_type); key_chr.line_pos="y;"
key_chr.column_pos="x;" key_chr.type="LCD_ATTR_NORMAL;"
key_chr.font_size="LCD_ANK_LIGHT;" key_chr.echo="ECHO_OFF;"
key_chr.ext="KEY_OBR_EXT;" key_str.column_len="0;" key_str.line_pos="y;"
key_str.column_pos="x;" lenth input key_str.len="lenth;"
key_str.type="LCD_ATTR_NORMAL;" key_str.font_size="LCD_ANK_STANDARD;"
key_str.echo="ECHO_ON;" *** ROUTINE INITIALIZE KEY str[0]="0x0;">0x7e) ss1++;
strtemp[i+1]=ss1; } /* continue;*/ } else if(ss0<0x37) {
strtemp[i]=((ss0+1)/2)+0x84; if((ss0+1)%2) { strtemp[i+1]=ss1+95; } else {
if(ss1>0x7e) ss1++; strtemp[i+1]=ss1; } } else { ss0=ss0-0x37;
strtemp[i]=(ss0/2)+0xe0; if(ss0%2) { strtemp[i+1]=ss1+95; } else {
if(ss1>0x7e) ss1++; strtemp[i+1]=ss1; } } /* else */ } /* else if */ } /* end
of for */ strtemp[i]=0; lcd_usrfont(0,"a:\\font6sk.fon");
lcd_string(LCD_ANK_STANDARD,attrib,(B*)strtemp,LCD_LF_ON); return(0); }
/******************************************************************************
** Routine name: obr_change ** ** Detail : set the barcode type ** ** Parameter
: int incode : the serial of barocde type ** ** Return value: 0 : OK ** ** Last
Date : 1998/07/01 ** ** Author : CLCE YangDongQing **
******************************************************************************/
void obr_change(int incode) { /*** OBR USING MODE TABLE ***********************/
M_TBL obr_mode; /*** OBR_MODE ****/ obr_mode.Code = OBR_ALL; obr_mode.Cd39[0] =
0xff; obr_mode.Cd39[1] = 2; obr_mode.Cd39[2] = 38; obr_mode.Cd39[3] = 1;
obr_mode.Cd39[4] = 1; obr_mode.Cd39[5] = 1; obr_mode.Nw7[0] = 0xff;
obr_mode.Nw7[1] = 2; obr_mode.Nw7[2] = 38; obr_mode.Nw7[3] = 0; obr_mode.Nw7[4]
= 0; obr_mode.Nw7[5] = 0; obr_mode.Wpcea[0] = 0xff; obr_mode.Wpcea[1] = 10;
obr_mode.Wpcea[2] = 18; obr_mode.Wpcea[3] = 0; obr_mode.Wpcea[4] = 1;
obr_mode.Wpcea[5] = 1; obr_mode.Wpce[0] = 0xff; obr_mode.Wpce[1] = 8;
obr_mode.Wpce[2] = 13; obr_mode.Wpce[3] = 0; obr_mode.Wpce[4] = 1;
obr_mode.Wpce[5] = 1; obr_mode.Upcea[0] = 0xff; obr_mode.Upcea[1] = 9;
obr_mode.Upcea[2] = 12; obr_mode.Upcea[3] = 0; obr_mode.Upcea[4] = 1;
obr_mode.Upcea[5] = 1; obr_mode.Upce[0] = 0xff; obr_mode.Upce[1] = 7;
obr_mode.Upce[2] = 7; obr_mode.Upce[3] = 1; obr_mode.Upce[4] = 1;
obr_mode.Upce[5] = 1; obr_mode.Idsf[0] = 0xff; obr_mode.Idsf[1] = 2;
obr_mode.Idsf[2] = 40; obr_mode.Idsf[3] = 0; obr_mode.Idsf[4] = 1;
obr_mode.Idsf[5] = 1; obr_mode.Itrf[0] = 0xff; obr_mode.Itrf[1] = 4;
obr_mode.Itrf[2] = 40; obr_mode.Itrf[3] = 0; obr_mode.Itrf[4] = 0;
obr_mode.Itrf[5] = 1; obr_mode.Cd93[0] = 0xff; obr_mode.Cd93[1] = 1;
obr_mode.Cd93[2] = 40; obr_mode.Cd93[3] = 0; obr_mode.Cd93[4] = 1;
obr_mode.Cd93[5] = 0; obr_mode.Cd128[0] = 0xff; obr_mode.Cd128[1] = 1;
obr_mode.Cd128[2] = 40; obr_mode.Cd128[3] = 0; obr_mode.Cd128[4] = 1;
obr_mode.Cd128[5] = 0; obr_mode.Msi[0] = 0xff; obr_mode.Msi[1] = 1;
obr_mode.Msi[2] = 40; obr_mode.Msi[3] = 0; obr_mode.Msi[4] = 1; obr_mode.Msi[5]
= 1; obr_mode.Type = 1; obr_mode.Gain = 0; obr_mode.Buzc = 1; obr_mode.Ledc = 1;
obr_mode.Bufc = 0; obr_mode.Endc = 0; obr_mode.Mode = 0; switch( incode ) { case
0: obr_mode.Code = OBR_ALL; obr_mode.Cd39[1] = 2; obr_mode.Cd39[2] = 38;
obr_mode.Cd39[4] = 0; obr_mode.Cd39[5] = 1; obr_mode.Nw7[1] = 2; obr_mode.Nw7[2]
= 38; obr_mode.Itrf[1] = 4; obr_mode.Itrf[2] = 40; break; case 1: obr_mode.Code
= OBR_CD39; obr_mode.Cd39[1] = 1; obr_mode.Cd39[2] = 38; obr_mode.Cd39[4] = 0;
obr_mode.Cd39[5] = 1; break; case 2: obr_mode.Code = OBR_NW_7; obr_mode.Nw7[1] =
1; obr_mode.Nw7[2] = 38; break; case 3: obr_mode.Code = OBR_ITF;
obr_mode.Itrf[1] = 2; obr_mode.Itrf[2] = 40; break; default: return; }
OBR_modewt( &obr_mode ); }
/******************************************************************************
** Routine name: CR_Check ** ** Detail : CR code is existed then clear ** **
Parameter : B *msg : pointer to character string ** ** : short len : character
string length ** ** Return value: none ** ** Last Date : 1998/07/01 ** ** Author
: CLCE YangDongQing **
******************************************************************************/
void CR_Check( B *msg, short len ) { short i; for( i = 0; i < len; i++ ) {
if( msg[i] == 0x0d || msg[i] == '\0' ) { msg[i] = '\0'; break; } } for( ; i <
len; i++ ) msg[i] = '\0'; }
/******************************************************************************
** Routine name: Wait ** ** Detail : specified second wait routine ** **
Parameter : tmcnt : timer count ** ** Return value: none ** ** Author : Fuji
Software Inc. **
******************************************************************************/
void Wait( UW tmcnt ) { ER ercd; UW p_flg; ercd = s_settimer( FL_TM1_INT_ID,
FL_TM1_INT_RTC0, tmcnt ); wai_flg( &p_flg, FL_TM1_INT_ID, FL_TM1_INT_RTC0,
TWF_ANDW | TWF_CLR ); s_timerend( ercd ); } void IntPrint(int x,int y,B
*format,int tp) { B *temp[48]; sprintf(temp,format,tp); lcd_csr_put(x,y);
cputstr(LCD_ATTR_NORMAL,(B*)temp); }
/******************************************************************************
** Routine name: FNC_Initialize ** ** Detail : function key initialize set
(return default) ** ** Parameter : None ** ** Return value: None ** ** Author :
casio **
******************************************************************************/
void FNC_Init( void ) { KEYFORM kcode; kcode.attr = 0x0; kcode.code = 0x2d;
key_fnc( FNC_SET, FNC_1, &kcode); kcode.attr = 0x0; kcode.code = 0x1d;
key_fnc( FNC_SET, FNC_2, &kcode); kcode.attr = 0x0; kcode.code = 0x1c;
key_fnc( FNC_SET, FNC_3, &kcode); kcode.attr = 0x0; kcode.code = 0x10;
key_fnc( FNC_SET, FNC_4, &kcode); kcode.attr = 0x0; kcode.code = 0x20;
key_fnc( FNC_SET, FNC_5, &kcode); kcode.attr = 0xff; kcode.code = 0x0;
key_fnc( FNC_SET, FNC_6, &kcode); kcode.attr = 0xff; kcode.code = 0x1;
key_fnc( FNC_SET, FNC_7, &kcode); kcode.attr = 0xff; kcode.code = 0x02;
key_fnc( FNC_SET, FNC_8, &kcode); } void FNC_Update( void ) { KEYFORM kcode;
kcode.attr = 0x0; kcode.code = 0x1; key_fnc( FNC_SET, FNC_6, &kcode);
kcode.attr = 0x0; kcode.code = 0x2; key_fnc( FNC_SET, FNC_7, &kcode);
kcode.attr = 0x0; kcode.code = 0x3; key_fnc( FNC_SET, FNC_3, &kcode); }
/******************************************************************************
** Routine name: Wait2 ** ** Detail : specified second wait routine 2 (31.25ms)
** ** Parameter : tmcnt : timer count ** ** Return value: none ** ** Author :
Fuji Software Inc. **
******************************************************************************/
void Wait2( UW tmcnt ) { ER ercd; UW p_flg; ercd = s_settimer2( FL_TM2_INT_ID,
FL_TM2_INT_ITU0, tmcnt ); wai_flg( &p_flg, FL_TM2_INT_ID, FL_TM2_INT_ITU0,
TWF_ANDW | TWF_CLR ); s_timerend2( ercd ); } int getkey2(int y,int x) { KEY_INP
kinp; int code; kinp.ext = KEY_OBR_EXT; kinp.echo = ECHO_ON; kinp.font_size =
LCD_ANK_LIGHT; kinp.type = LCD_ATTR_NORMAL; kinp.column_pos = x; kinp.line_pos =
y; code=key_read(&kinp); return (code); } int getkey(void) { KEY_INP kinp;
int code; kinp.ext = KEY_OBR_EXT; kinp.echo = ECHO_OFF; kinp.font_size =
LCD_ANK_LIGHT; kinp.type = LCD_ATTR_NORMAL; kinp.column_pos =0; kinp.line_pos =
2; code=key_read(&kinp); return (code); } void Dsp_str( B *data,H gyo,H
keta) { lcd_csr_put( gyo, keta ); /* lcd_string( dsp_ank, dsp_mode, (B *)data,
LCD_LF_OFF );*/ cputstr(LCD_ATTR_NORMAL, (B*)data); /*cputstr800(dsp_mode,(B
*)data); */ } void Dsp_str2( B *data,H gyo,H keta) { lcd_csr_put( gyo, keta );
cputstr(LCD_ATTR_REVERS, (B*)data); } void Dsp_str3( B *data,H gyo,H keta) {
lcd_csr_put( gyo, keta ); cputstr(LCD_ATTR_WIDTH, (B*)data); }
/********************************************************************/ /*
Notice: 对长度为len的字符串,在其后补加空格,使其长度达到KeyLen */
/*******************************************************************/ void
addspace(B *str,H len,H KeyLen) { H i; for(i=len;i<KEYLEN;I++) lcd_cls();
for(i="0;i<(KeyLen-len);i++)" } { int B ER void i; str[i]=" " Dsp_str(?<F1
Dsp_str(?Sending....?,3,1); fileInfo[1]; CU_FILE_INFO_FORM *file_a,*file_b; FILE
rec_buff[60],ftemp[15]; param; sys_tty struct idx,i,j,k; UH ercd,fup; *fname) (B
sendfile str[KeyLen]="0x0;" strcpy(str,temp); strcat(temp,str); temp[i]="0" ; H
temp[20]; KeyLen) len, *str,H zeroadd(B>取消",5,1); for(i=0,j=0;i<8;i++,j++) {
if(fname[i]==' ') ftemp[j]=0x0; else ftemp[j]=fname[i]; } ftemp[i]=0x0;
strcat(ftemp,".txt"); if((fup = open( ftemp, O_RDONLY)) == E_LOWERR ) {
lcd_cls(); Dsp_str(ftemp,3,2); Dsp_str("文件无数据",5,1); getkey(); close(fup);
return; } close(fup); cu_stopKeySet( CU_FNC_1 ); param.speed = B_19200;
param.length = CHAR_8; param.parity = PARI_NON; param.stop_bit = STOP_1; ercd =
cu_open( COM , CU_CNCT_MULT , ¶m ); if(ercd != E_OK) { cu_stopKeySet( CU_FNC_NON
); lcd_cls(); lcd_csr_put( 1 , 0 ); cputstr( LCD_ATTR_NORMAL , (B *)"COM 打开错误"
); lcd_csr_put( 5 , 0 ); cputstr( LCD_ATTR_NORMAL , (B *)" 按任意键 !" );
key_clear(); getkey(); return( 1 ); } for(i=0;i<STRLEN(FNAME);I++)
code="key_read(&kinp);" lcd_cls(); } * return; getkey(); Error!?,1,0); { int
B W ER void ); char 0 return ret="fil_filesize(fgoods,&buffer,find_sw);"
key_clear(); (B if(cpos E_PRM; if(er!="pos)" if(er="=E_LOWERR)" er="0,loca;"
cpos="pos;" Top[6],Bott[6],Min[6]; tempcode[30]; min="0L,top=0L,bott=num-1;"
cpos; len2="0;" i,signal="2;" num) *fpos,W *sdata,W *code,B keylen,B keypos,int
fieldsize,int pos,int fn,W half_search(int close(fn);
NI="buffer.size/fieldsize;" index.txt!?,3,0); Dsp_str(?请先下载 Dsp_str(?index.txt )
E_LOWERR O_RDONLY))="=" if((fn="open(fgoods," find_sw; UB buffer; FIL_SIZE
fieldsize="Lenth,test1=0;" record[165],ALL[10]; pos,sumnum; fn,ret; Index_cal()
NJ="buffer.size/fieldsize;" Dsp_str(?请先下载商品主档!?,3,0); Dsp_str(?order.txt
record[165],ALL[10],temp_dsp[10]; Order_cal() N="buffer.size/fieldsize;"
Dsp_str(?goods.txt Goods_cal() (code); kinp.line_pos="7;" kinp.column_pos="5;"
kinp.type="LCD_ATTR_NORMAL;" kinp.font_size="LCD_ANK_LIGHT;"
kinp.echo="ECHO_OFF;" kinp.ext="KEY_OBR_EXT;" code; kinp; KEY_INP getkey3(void)
return( 文件传输结束? *)? , cputstr(LCD_ATTR_NORMAL 1 lcd_csr_put( CU_FNC_NON
cu_stopKeySet( COM cu_close( 请按任意键!? LCD_ATTR_NORMAL cputstr( 5
Dsp_str(?文件打开错误?,3,0); !="E_OK)" if(ercd CU_GRAPH_ON_1 &fileInfo CU_KIND_OTHER
ercd="cu_fileSend(" fileInfo[0].fileName[i]="fname[i];" fname[i]="0x0;"
if(fname[i]="='.')">=0L && cpos<=num*fieldsize)loca=0; else loca=1;
while(top<=bott && loca==0) { min=(top+bott)/2; len2=0;
cpos=min*fieldsize; lseek(fn,cpos,0); er=read(fn,sdata,fieldsize);
if(er==E_LOWERR) break; if(er!=fieldsize) break; for(i=0;i<KEYLEN;I++) } { if
(code[i] (code[i]!="tempcode[i])" (i="0;i<keylen;i++)" for
(strcmp(code,tempcode)="=0)break;" tempcode[i]="sdata[i+keypos];" ?)len2++;
if(tempcode[i]="='">tempcode[i])signal=0; if (code[i]<TEMPCODE[I])SIGNAL=1; } {
break; if if(top top="min+1;" (signal="=1)" bott="min-1;">bott)er=-1; }
if(er==E_LOWERR) return E_PRM; if(er!=fieldsize) return E_NG; *fpos=cpos; return
E_OK; if(er==-1) return E_PRM; } int Dat_F_Search(int fd,W start_adr,H
fieldsize,H keypos,H keylen,B *code,B *sdata,W *fpos) { int i; int er=0; W cpos;
cpos=start_adr; er=lseek(fd,cpos,0); if(er==E_LOWERR) { return E_PRM; }
if(er!=start_adr) { return E_PRM; } while(1) { er=read(fd,sdata,fieldsize);
if(er==E_LOWERR) break; if(er!=fieldsize) break; for(i=0;i<KEYLEN;I++) } *
end="lseek(fp,0,2);" { int B lno,end; W ER break; ret,i,j; }; OK return E_PRM;
if(er!="fieldsize)" if(er="=E_LOWERR)" if(pos temp[200],pictmp[5]; type) *fpos,H
pos,W codelen,W start,H len,H fp,H Next(int E_OK; *fpos="cpos;" E_NG;
cpos+="fieldsize;" compare if(i="=keylen)"
if(code[i]!="sdata[i+keypos])">=end-len){ *fpos=pos; return 0; } lno=pos;
for(;;){ lno+=len; lseek(fp,lno,0); memset(temp,0x0,200); ret=read(fp,temp,len);
if(ret){ for(i=start,j=0;j<codelen;j++,i++) pictmp[j]=temp[i]; pictmp[j]=0x0;
if(type==1) if(strcmp(pictmp," ")==0) { *fpos=lno; return 1; } if(type==2)
if(strcmp(pictmp," ")!=0){ *fpos=lno; return 1; } } else break; } *fpos=pos;
return 0; } int Preview(int fp,H len,H start,H codelen,W pos,W *fpos,H type) {
ER ret,i,j; W lno; B temp[200],pictmp[5]; if(pos==0){ *fpos=pos; return 0; }
lno=pos; for(;lno>0;){ lno-=len; lseek(fp,lno,0); memset(temp,0x0,200);
read(fp,temp,len); for(i=start,j=0;j<codelen;j++,i++) pictmp[j]=temp[i];
pictmp[j]=0x0; if(type==1) if(strcmp(pictmp," ")==0) { *fpos=lno; return 1; }
if(type==2) if(strcmp(pictmp," ")!=0){ *fpos=lno; return 1; } } *fpos=pos;
return 0; }</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -