home *** CD-ROM | disk | FTP | other *** search
Wrap
#include <stdio.h> #include <dos.h> #include <string.h> #include <ctype.h> #include <sys\stat.h> #define black 0x0 #define blue 0x10 #define green 0x20 #define cyan 0x30 #define red 0x40 #define white 0x70 #define PgUp 18688 #define PgDn 20736 #define UP 18432 #define DOWN 20480 #define LEFT 19200 #define RIGHT 19712 #define Enter 13 #define Home 18176 #define End 20224 #define ESC 27 #define Del 21248 #define Ins 20992 #define F1 15104 #define F2 15360 #define F3 15616 #define F4 15872 #define F5 16128 #define F6 16384 #define F7 16640 #define F8 16896 #define F9 17152 #define F10 17408 typedef struct PPP { /* this is a database's structure */ char field[11]; char type; int length; int dec; struct PPP *last; /* poniter of the last block */ struct PPP *next; /* pointer of the next block */ char sele; char obj; int cla; }FIELD; extern FIELD *p,*p5; typedef struct MM { /*store base name*/ char mean[30]; char dbname[11]; /* the name of the database */ char mainkey[4][11]; /* mainkey of the database */ struct PPP *sstr; /* point to the database's structure */ struct PPP *estr;/* pointer for end of block of base*/ char flag; /*if finish base 0--not finish 1--finish*/ char serve; char path[30]; char sele; int sort; char join; struct MM *last; struct MM *next; }BASE ; extern BASE *root,*root3;/* end*/ extern int basecount,selecount,fselecount,linknum,link[5],sub1,sub2; extern char linkfield[5][4][11],workname[30],linktype,lan,insert; extern BASE *root2,*root1,*root4; extern FIELD *p1,*p2,*p4; extern int num[6],use; extern char file[13],*title3[],PATH[30]; extern FIELD *NEXT(),*LAST(); extern FIELD *disp_f(),*disp_ch(); extern int ob,f; extern char condition[200],*con[6]; extern char class[3][100],classbak[3][11]; char classtype[3]; tj_z() { FILE *fp,*fq; char tail[4], name[13]; char tjztem[3][20],up; int i,j,k,key; char gsxih[50]; /*-----------------------------MAKE TITLE------------------------------------*/ f=0; for(i=0;i<3;i++) { class[i][0]='\0'; classbak[i][0]='\0'; } if(num[2]==0) make_file(2); if((insert!='Y')&&(insert!='y')) r_mean(); strcpy(file,"tj_z"); itoa(num[2],tail,10); strcat(file,tail); if((insert=='n')||(insert=='N')) w_menuz(); clear_win(5,8,9,60,6,0,black); print(7,20,6|1,"═│╝╞╜ß╣√╖┼╘┌╒Γ╥╗└α╡─╔╧├µ┬≡ú┐(Y/N)"); up=getcc(); /*-----------------------------sele object field------------------------------*/ make_t(); print(4,30,6|1,"╤í╘±═│╝╞╫╓╢╬"); root2=root; while(root2!=NULL) if(root2->sele=='Y') break; else root2=root2->next; if(root2->sele=='Y') { p=root2->sstr; p4=p2=p; } /*0-all,1--n*/ p1=disp_f(p2,1); sele_f(p2,p1,p4,1,0,0); /*-------------------------------sdfskdfjk--------------------------------*/ strcpy(name,file); strcat(name,".prg"); if((fp=fopen(name,"w"))==NULL) { error("don't open file!"); exit(0); } fprintf(fp,"set echo off\nset talk off\nset safe off\n"); if((lan=='Y')||(lan=='y')) fprintf(fp,"set excl off\n"); else fprintf(fp, "set excl on\n"); fprintf(fp,"close all\n"); fprintf(fp,"sele 10\nuse dbstr excl\nif reccount()>1\n zap\n endif\n"); strcpy(name,file); strcat(name,".txt"); fprintf(fp,"append from %s deli with #\nuse\n",name); fprintf(fp,"creat dbf from dbstr\nuse\n"); fprintf(fp,"run copy c:dbf.dbf c:zx_temp.dbf >zl\n"); /*----------------------------selcetion & index-------------------------*/ root2=root; for(j=0;j<selecount;j++) { while(root2!=NULL) if(root2->sele=='Y') break; else root2=root2->next; if(root2->join=='Y') fprintf(fp,"if .not.file('%s\\%s.dbf')\nclear\n@12,10 say \"╬─╝■╗╣▓╗┤µ╘┌,─·╙ª╧╚╘╦╨╨▒≡╡─│╠╨≥,▓·╔·┤╦┐Γúí\" \nreturn\nendif\n",root2->path,root2->dbname); fprintf(fp,"sele %c\nuse %s\\%s ",j+65,root2->path,root2->dbname); if(root2->serve!='Y') fprintf(fp," excl \n"); else fprintf(fp," \n"); if(j!=0) { /*-----------------------------------lock---------------------------------*/ if(((lan=='y')||(lan=='Y'))&&(root2->serve=='Y')) { fprintf(fp,"do while .T.\ntime=0\ndo while .not.flock().and.time<250\n"); fprintf(fp,"time=time+1\nenddo\nif time<250\n"); } /*-----------------------------endlock------------------------------------*/ fprintf(fp,"index on"); for(i=0;i<link[j-1];i++) if(i==0) fprintf(fp, " %s",linkfield[j-1][i]); else fprintf(fp,"+%s",linkfield[j-1][i]); fprintf(fp," to ndx%-d\n",j-1);/*j-1*/ /*-------------------------unlock----------------------------------------*/ if(((lan=='y')||(lan=='Y'))&&(root2->serve=='Y')) { fprintf(fp,"unlock\nexit\nelse\nyes=' '\nclear\n@12,10 say \"╬─╝■╥╤▒╗╞Σ╦√╙├╗º,╝╠╨°╝╙╦°┬≡ú┐(Y/N)\" get yes\n"); fprintf(fp,"read\nclear\nif yes='N'.or.yes='n'\n@15,10 say \"╟δ╣²╥╗╗ß╢∙╘┘╙├\" \nwait\n"); fprintf(fp,"return\nendif\nendif\nenddo\n"); } /*----------------------------end unlock cance---------------------------*/ } root2=root2->next; } /*-------------------------set realtion----------------------------*/ if((linktype=='C')||(linktype=='c')) { for(j=0;j<selecount-1;j++) { fprintf(fp,"sele %c\nset relation to ",j+65); for(i=0;i<link[j];i++) if(i==0) fprintf(fp," %s",linkfield[j][i]); else fprintf(fp,"+%s",linkfield[j][i]); fprintf(fp," into %c\n",j+66); } } else for(j=0;j<selecount-1;j++) { fprintf(fp,"sele A\nset relation to "); for(i=0;i<link[j];i++) if(i==0) fprintf(fp, "%s",linkfield[j][i]); else fprintf(fp, "+%s",linkfield[j][i]); fprintf(fp," into %c\n",j+66); } /*----------------------------end relation-----------------------------*/ fprintf(fp,"sele 10\nuse dbf excl\nnu=1\nsele a\n"); fprintf(fp,"do while .T.\n"); fprintf(fp,"go nu\nsele 10\nappen blank\nrepl "); root2=root; while(root2!=NULL) { if(root2->dbname[0]=='\0') root2->sele='N'; root2=root2->next; } root2=root; j=k=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=p=root2->sstr; while(p2!=NULL) { if(p2->sele=='Y') { if(k<5) { fprintf(fp," %s with %c->%s ",p2->field,j+65,p2->field); k++; } else { fprintf(fp,"\nrepl "); fprintf(fp," %s with %c->%s ",p2->field,j+65,p2->field); k=1;} } p2=p2->next; } j++; } root2=root2->next; } fprintf(fp,"\nnu=nu+1\nsele 1\nif nu>reccount()\nexit\nendif\nenddo\nsele 10\n"); /*-----------------------------end of gene base ---------------------------------*/ /*-----------------------------STATIS class field------------------------------------*/ make_t(); print(4,30,6|1 ,"╤í╘±╖╓└α╫╓╢╬"); root2=root; for(i=0;i<3;i++) { class[i][0]='\0'; classbak[i][0]='\0'; } k=0; while(root2!=NULL) if(root2->sele=='Y') break; else root2=root2->next; if(root2->sele=='Y') { p=root2->sstr; p4=p2=p; } p1=disp_ch(p2); sele_ch(p2,p1,p4,3); /*---------------------------STATIS class end------------------------------*/ /*--------------------WRITE--------------TXT-------------------------------*/ strcpy(name,file); strcat(name,".txt"); if((fq=fopen(name,"w"))==NULL) { error("▓╗─▄┤≥┐¬╬─╝■!"); exit(0); } fprintf(fq,"#▒Ω╝╟#,#C#,8,0\n"); root2=root; k=1; p2=NULL; while(root2!=NULL) { if(root2->sele=='Y') { p2=p=root2->sstr; while(p2!=NULL) { if(p2->cla==k) { fprintf(fq,"#%s#,#%c#,%d,%d\n",p2->field,p2->type,p2->length,p2->dec); root2=root; k++; break; } p2=p2->next; } } if(p2==NULL) root2=root2->next; else p2=NULL; } root2=root; while(root2!=NULL) { if(root2->sele=='Y') { p2=p=root2->sstr; while(p2!=NULL){ if((p2->sele=='Y')&&(p2->cla==0)) if(p2->obj=='Y') fprintf(fq,"#%s#,#%c#,%d,%d\n",p2->field,p2->type,19,(p2->dec==0? 0:6)); else fprintf(fq,"#%s#,#%c#,%d,%d\n",p2->field,p2->type,p2->length,p2->dec); p2=p2->next; } } root2=root2->next; } fclose(fq); /*-----------------------------------end of txt----------------------------*/ /*-------------------------------gene jg base -------------------------------*/ fprintf(fp,"\close all \nrun copy c:dbf.dbf c:base_jg.dbf >zl\n"); fprintf(fp,"close all\nsele 9\nuse zx_temp excl\nzap\nuse base_jg excl\n "); if(f!=0) { fprintf(fp,"index on "); if(f==3) fprintf(fp," %s+%s+%s to zxndx \n",class[0],class[1],class[2]); if(f==2) fprintf(fp,"%s+%s to zxndx\n",class[0],class[1]); if(f==1) fprintf(fp,"%s to zxndx\n",class[0]); } fprintf(fp,"\ncopy to zx_jg1.dbf\nset index to\n use\n"); if(f!=0) fprintf(fp,"r=%d\nfen=''\n",f-1); /*--------------------------------make zsji----------------------------------*/ if((up=='Y')||(up=='y')) { fprintf(fp,"\nsele 1\nuse zx_jg1 excl\ngo top\nsum "); root2=root; k=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { if(k==0) fprintf(fp,"%s ",p2->field); else fprintf(fp,",%s ",p2->field); k++; } p2=p2->next; } } root2=root2->next; } for(i=0;i<k;i++) if(i==0) fprintf(fp," to ll%-d",i); else fprintf(fp,",ll%-d",i); fprintf(fp,"\ngo top\n"); k=f; if(k==3) { fprintf(fp,"l2=%s\n",classbak[2]); k--;} if(k==2) { fprintf(fp,"l1=%s\n",classbak[1]); k--;} if(k==1) fprintf(fp,"l0=%s\n",classbak[0]); fprintf(fp,"sele 9\nuse zx_temp excl\nappen blan\nrepl ▒Ω╝╟ with '╫▄╝╞',"); root2=root; k=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { if(k==0) fprintf(fp,"%s with ll%-d",p2->field,k); else fprintf(fp,",%s with ll%-d",p2->field,k); k++; } p2=p2->next; } } root2=root2->next; } k=f; if(k==3) { fprintf(fp,",%s with l2",classbak[2]); k--;} if(k==2) { fprintf(fp,",%s with l1",classbak[1]); k--;} if(k==1) fprintf(fp,",%s with l0\n",classbak[0]);} /*------------------------end of make zsji----------------------------------*/ if((f==0)&&((up=='Y')||(up=='y'))) fprintf(fp,"\nclose all\nsele 1\nuse zx_temp\nappen from zx_jg1\nclose all\n"); if(f!=0) { fprintf(fp,"\nuse\ndo while .T.\nsele 1\nuse zx_jg1 excl\n",f-1); k=f; if((up=='Y')||(up=='y')) { if(k==3) { fprintf(fp,"if r=%d\nstore '%s'-'+'-'%s'-'+'-'%s' to fen\nbiao='╨í╨í╨í╝╞'\nrecall all\nendif\n",f-k,class[0],class[1],class[2]); k--; } if(k==2) { fprintf(fp,"if r=%d\nstore '%s'-'+'-'%s' to fen\nbiao='╨í╨í╝╞'\nrecall all\nendif\n",f-k,class[0],class[1]); k--; } if(k==1) fprintf(fp,"if r=%d\nfen='%s'\nbiao='╨í╝╞'\nrecall all\nendif\n",f-k,class[0]); } else { if(k==3) { fprintf(fp,"if r=2\nstore '%s'-'+'-'%s'-'+'-'%s' to fen\nbiao='╨í╨í╨í╝╞'\nrecall all\nendif\n",class[0],class[1],class[2]); k--; } if(k==2) { fprintf(fp,"if r=1\nstore '%s'-'+'-'%s' to fen\nbiao='╨í╨í╝╞'\nrecall all\nendif\n",class[0],class[1]); k--; } if(k==1) fprintf(fp,"if r=0\nfen='%s'\nbiao='╨í╝╞'\nrecall all\nendif\n",class[0]); } fprintf(fp,"set uniq on\nc=str(r,1)\nindex on &fen to zxndx&c\nset index to zxndx&c\ndele all\nset uniq off\n"); fprintf(fp,"index on &fen to zxndx&c\nset index to zxndx&c\n go top\nnu=1\n"); fprintf(fp,"do while .T. \nbegin=nu\nbrec=recno()\nif deleted()\nskip\n nu=nu+1\n erec=recno()\nendif\n"); fprintf(fp,"do while .not.deleted().and..not.eof()\nskip\nnu=nu+1 \n erec=recno()\nenddo\n"); fprintf(fp,"erec=recno()\ncnt=nu-begin\ngo brec\nsum next cnt "); root2=root; k=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { if(k==0) fprintf(fp,"%s ",p2->field); else fprintf(fp,",%s ",p2->field); k++; } p2=p2->next; } } root2=root2->next; } for(i=0;i<k;i++) if(i==0) fprintf(fp," to ll%-d",i); else fprintf(fp,",ll%-d",i); if((up=='y')||(up=='Y')) fprintf(fp,"\ngo brec\n"); k=f; if(k==3) { fprintf(fp,"\nstore %s to l2\n",classbak[2]); k--; } if(k==2 ) { fprintf(fp,"\nstore %s to l1\n",classbak[1]); k--; } if(k==1) fprintf(fp,"\nstore %s to l0\n",classbak[0]); fprintf(fp,"sele 9\nuse zx_temp excl\nappen blan\nrepl ▒Ω╝╟ with biao,"); root2=root; k=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { if(k==0) fprintf(fp," %s with ll%-d",p2->field,k); else fprintf(fp,",%s with ll%-d",p2->field,k); k++; } p2=p2->next; } } root2=root2->next; } k=f; if(k==3) { fprintf(fp,",%s with l2",classbak[2]); k--; } if(k==2) { fprintf(fp,",%s with l1",classbak[1]); k--;} if(k==1) fprintf(fp,",%s with l0\n",classbak[0]); fprintf(fp,"\nsele 1\nif nu>reccount()\nexit\nendif\ngo erec\nenddo\nif r=0\nexit\nendif\n"); fprintf(fp,"r=r-1\nenddo\n"); } /*--------------------------------make zsji----------------------------------*/ if((up=='N')||(up=='n')) { if(f==0) fprintf(fp,"\nclose all\nsele 1\nuse zx_jg1\ncopy to zx_out.dbf\nsele 9\n use zx_temp\n"); fprintf(fp,"set index to \nsele 1\ngo top\nsum "); root2=root; k=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { if(k==0) fprintf(fp,"%s ",p2->field); else fprintf(fp,",%s ",p2->field); k++; } p2=p2->next; } } root2=root2->next; } for(i=0;i<k;i++) if(i==0) fprintf(fp," to ll%-d",i); else fprintf(fp,",ll%-d",i); fprintf(fp,"\ngo bottom\n"); k=f; if(k==3) { fprintf(fp,"l2=%s\n",classbak[2]); k--;} if(k==2) { fprintf(fp,"l1=%s\n",classbak[1]); k--;} if(k==1) fprintf(fp,"l0=%s\n",classbak[0]); fprintf(fp,"sele 9\nappen blan\nrepl ▒Ω╝╟ with '╫▄╝╞',"); root2=root; k=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { if(k==0) fprintf(fp,"%s with ll%-d",p2->field,k); else fprintf(fp,",%s with ll%-d",p2->field,k); k++; } p2=p2->next; } } root2=root2->next; } k=f; if(k==3) { fprintf(fp,",%s with l2",classbak[2]); k--;} if(k==2) { fprintf(fp,",%s with l1",classbak[1]); k--;} if(k==1) fprintf(fp,",%s with l0\n",classbak[0]);} /*------------------------------end of make zsji----------------------------*/ if((up=='N')||(up=='n')) { if(f!=0) { fprintf(fp," use\nsele 1\nappen from zx_temp\n"); fprintf(fp,"recall all\n close index\nsele 1\nuse zx_jg1 excl\nindex on "); for(i=0;i<f;i++) if(i==0) fprintf(fp,"%s",class[i]); else fprintf(fp,"+%s",class[i]); fprintf(fp," to zxndx\n"); fprintf(fp,"set index to zxndx\ncopy to zx_out.dbf\nset index to\nuse zx_out excl\n"); for(i=0;i<f;i++) if((classtype[i]=='D')||(classtype[i]=='d')) strcpy(tjztem[i],"ctod(' / / ')"); else if((classtype[i]=='N')||(classtype[i]=='n')) strcpy(tjztem[i],"0"); else strcpy(tjztem[i],"' '"); if(f==3) { fprintf(fp,"repl %s with %s, %s with %s, %s with %s for ▒Ω╝╟='╫▄╝╞'\n",classbak[0],tjztem[0],classbak[1],tjztem[1],classbak[2],tjztem[2]); fprintf(fp,"repl %s with %s, %s with %s for ▒Ω╝╟='╨í╝╞'\n",classbak[1],tjztem[1],classbak[2],tjztem[2]); fprintf(fp,"repl %s with %s for ▒Ω╝╟='╨í╨í╝╞'\n",classbak[2],tjztem[2]); } if(f==2) { fprintf(fp,"repl %s with %s, %s with %s for ▒Ω╝╟='╫▄╝╞'\n",classbak[0],tjztem[0],classbak[1],tjztem[1]); fprintf(fp,"repl %s with %s for ▒Ω╝╟='╨í╝╞'\n",classbak[1],tjztem[1]); } if(f==1) fprintf(fp,"repl %s with %s for ▒Ω╝╟='╫▄╝╞'\n",classbak[0],tjztem[0]); fprintf(fp,"\nclose all\n! c:brow c:zx_out.dbf\n"); } fprintf(fp,"\n!del c:zx_jg1.dbf >zl\n!del c:base*.dbf >zl\n"); } /*------------------------------make up tail---------------------------------*/ else { if(f!=0) { fprintf(fp," use\nsele 9\nuse zx_temp excl\nindex on "); for(i=0;i<f;i++) if(i==0) fprintf(fp,"%s",class[i]); else fprintf(fp,"+%s",class[i]); fprintf(fp," to zxndx1\ncopy to zx_temp1\nuse zx_temp1 excl\nappen from zx_jg1\n"); fprintf(fp,"recall all\n close index\nsele 9\nuse zx_temp1 excl\nindex on "); for(i=0;i<f;i++) if(i==0) fprintf(fp,"%s",class[i]); else fprintf(fp,"+%s",class[i]); fprintf(fp," to zxndx\n"); fprintf(fp,"set index to zxndx\ncopy to zx_out.dbf\nset index to\nuse zx_out excl\n"); for(i=0;i<f;i++) if((classtype[i]=='D')||(classtype[i]=='d')) strcpy(tjztem[i],"ctod(' / / ')"); else if((classtype[i]=='N')||(classtype[i]=='n')) strcpy(tjztem[i],"0"); else strcpy(tjztem[i],"' '"); if(f==3) { fprintf(fp,"repl %s with %s, %s with %s, %s with %s for ▒Ω╝╟='╫▄╝╞'\n",classbak[0],tjztem[0],classbak[1],tjztem[1],classbak[2],tjztem[2]); fprintf(fp,"repl %s with %s, %s with %s for ▒Ω╝╟='╨í╝╞'\n",classbak[1],tjztem[1],classbak[2],tjztem[2]); fprintf(fp,"repl %s with %s for ▒Ω╝╟='╨í╨í╝╞'\n",classbak[2],tjztem[2]); } if(f==2) { fprintf(fp,"repl %s with %s, %s with %s for ▒Ω╝╟='╫▄╝╞'\n",classbak[0],tjztem[0],classbak[1],tjztem[1]); fprintf(fp,"repl %s with %s for ▒Ω╝╟='╨í╝╞'\n",classbak[1],tjztem[1]); } if(f==1) fprintf(fp,"repl %s with %s for ▒Ω╝╟='╫▄╝╞'\n",classbak[0],tjztem[0]); fprintf(fp,"close all\n! c:brow c:zx_out.dbf\n"); fprintf(fp,"!del c:zx_jg1.dbf >zl\n!del c:base*.dbf >zl\n"); /* fprintf(fp,"!del c:zx_temp?.dbf >zl\n"); fprintf(fp,"!del c:zxndx?.?dx >zl\n"); */ } } /*-------------------------------------MAKE TAIL---------------------------------------*/ strcat(file,"j.dbf"); if(f!=0) fprintf(fp,"run copy c:zx_out.dbf c:%s > zl\n",file); else if((up=='Y')||(up=='y')) fprintf(fp,"run copy c:zx_temp.dbf c:%s > zl\n! c:brow c:zx_temp.dbf\n",file); else { fprintf(fp,"\nclose all\nsele 1\nuse zx_out\nappe from zx_temp\nuse\n run copy c:zx_out.dbf c:%s >zl\n",file); fprintf(fp,"! c:brow c:zx_out.dbf\n"); } fprintf(fp,"clear\n"); fprintf(fp,"ser=' '\n@ 10,10 say \"┤╦═│╝╞╜ß╣√╥¬▒╕╖▌┬≡ú┐(Y/N)\" get ser\nread\n"); fprintf(fp,"if ser='Y'.or.ser='y'\n ser=space(30)\n@12,10 say \"╟δ╩Σ╚δ─┐┬╝╝░╬─╝■├√│╞:\" get ser\nread\n"); fprintf(fp,"!copy c:%s &ser > zl\nendif\n",file); fprintf(fp,"!del c:dbf.dbf >zl\n!del c:zx_out.dbf >zl\n!del c:zx_temp?.dbf >zl\n"); clear_win(13,4,20,75,6,0,black); printf("\033[17;20H┤╦═│╝╞╜ß╣√╥¬╣▓╧φ┬≡ú┐(Y/N)"); k=getcc(); if((k=='Y')||(k=='y')) { print(19,10,6|1,"╩Σ╚δ╣▓╧φ─┐┬╝╝░╬─╝■├√: "); scanf("%s",gsxih); fprintf(fp,"!copy c:%s %s >zl",file,gsxih); } num[2]++; fclose(fp); } /*----------------------------------end of statis zx-----------------------*/ /*----------------------------WRITE STATIS.TXT-------------------------------*/ w_menuz() { FILE *fp; if((fp=fopen("statis2.txt","a"))==NULL) { error("don't open file statis.txt"); exit(0); } fprintf(fp,"#%s#,#%s#\n",workname,file); fclose(fp); } /*------z------------sele_char type field--------------------------------*/ sele_ch(ptr,ptr1,ptr2,num) FIELD *ptr,*ptr1,*ptr2; int num; { int i,j,k,key2; FIELD *tem,*tem1,*tem2; char ch[4]; kk2: ptr2=NULL; begin: while(((ptr->type=='L')||(ptr->sele=='N')||(ptr->type=='l'))&&(ptr!=NULL)) ptr=ptr->next; print(6,10,0|75,"%s",ptr->field); disp_fmess(ptr); i=6;j=10; for(;;) { key2=getcc(); mv: print(i,j,(ptr->cla!=0 ? 0|113:6|1),"%s",ptr->field); switch(key2) { case LEFT: if(j==10) printf("\007"); else { j=10; ptr=ptr->last; while(((ptr->type=='L')||(ptr->sele=='N')||(ptr->type=='l'))&&(ptr!=NULL)) ptr=ptr->last; } break; case RIGHT: tem1=ptr->next; while(((tem1->type=='L')||(tem1->sele=='N')||(tem1->type=='l'))&&(tem1!=NULL)) tem1=tem1->next; if((j==40)||(tem1==NULL)) printf("\007"); else { j=40; ptr=ptr->next; while(((ptr->type=='L')||(ptr->sele=='N')||(ptr->type=='l'))&&(ptr!=NULL)) ptr=ptr->next; } break; case UP: if(i==6) printf("\007"); else { i--; ptr=ptr->last; while((ptr->type=='L')||(ptr->sele=='N')||(ptr->type=='l')) ptr=ptr->last; ptr=ptr->last; while((ptr->type=='L')||(ptr->sele=='N')||(ptr->type=='l')) ptr=ptr->last; } break; case DOWN: tem1=ptr->next; while(((tem1->type=='L')||(tem1->sele=='N')||(tem1->type=='l'))&&(tem1!=NULL)) tem1=tem1->next; tem2=tem1->next; while(((tem2->type=='L')||(tem2->sele=='N')||(tem2->type=='l'))&&(tem2!=NULL)) tem2=tem2->next; if((i==10)||((tem2==NULL)||(tem1==NULL))) printf("\007"); else { i++; ptr=ptr->next; while(((ptr->type=='L')||(ptr->sele=='N')||(ptr->type=='l'))&&(ptr!=NULL)) ptr=ptr->next; ptr=ptr->next; while(((ptr->type=='L')||(ptr->sele=='N')||(ptr->type=='l'))&&(ptr!=NULL)) ptr=ptr->next;} break; case PgUp: k=0; tem=ptr; ptr=ptr2; while(k<10) { ptr=ptr->last; while((ptr->type=='L')||(ptr->sele=='N')||(ptr->type=='l')) ptr=ptr->last; if(ptr==NULL) break; k++; } if(ptr!=NULL) { clear_win(5,3,9,76,6,0,black); ptr1=disp_ch(ptr); i=6;j=10; ptr2=ptr; } else { ptr=tem; printf("\007"); } break; case PgDn: if(ptr1==NULL) printf("\007"); else { clear_win(5,3,9,76,6,0,black); ptr=ptr1; ptr1=disp_ch(ptr); i=6;j=10; ptr2=ptr; } break; case Enter: case F5: ptr->cla!=0 ? f--:f++; if(ptr->cla==0) { ptr->cla=f; classtype[f-1]=ptr->type; } else ptr->cla=0; if(f>3) { ptr->cla=0; f--; error("╖╓└α╫╓╢╬▓╗─▄╢α╙┌╚²╕÷!"); getcc(); bottom(); } if(num==1) { strcpy(class[0],ptr->field); return(1); } break; case F6: ptr=p; f=0; while(ptr!=NULL) { ptr->cla=0; ptr=ptr->next; } return(-1); case F4: k=0; if((sub1==1)&&(sub2==3)&&(f==0)) { error("╟δ─·╤í╖╓└α╫╓╢╬úí"); getcc(); bottom(); root2=root; for(i=0;i<3;i++) { class[i][0]='\0'; classbak[i][0]='\0'; } k=0; while(root2!=NULL) if(root2->sele=='Y') break; else root2=root2->next; if(root2->sele=='Y') { p=root2->sstr; p4=p2=p; } p1=disp_ch(p2); ptr=p2; ptr1=p1; ptr2=p4; goto kk2; } root2=root; while(root2!=NULL) { if(root2->sele=='Y') { ptr2=root2->sstr; while(ptr2!=NULL) { if(ptr2->cla==k+1) { clear_win(5,4,9,76,6,0,black); print(6,15,6|1,"─·╥¬╢╘\"%s\"╫╓╢╬╜°╨╨╫╙┤«╖╓└α┬≡ú┐(Y/N):",ptr2->field); printf("\033[6;59H"); key2=getcc(); root2=root; if((key2=='Y')||(key2=='y')) { print(8,10,6|1,"╟δ╩Σ╚δ╫╙┤«╖╓└α╡─┐¬╩╝╬╗╓├: ╫╙┤«╬╗╩²: "); yy1: printf("\033[8;35H"); scanf("%d",&i); if((i<=0)||(i>=ptr2->length)) {error(" ╬╗╓├┤φ╬≤!"); goto yy1;} yy2: printf("\033[8;49H"); scanf("%d",&j); if((j<=0)||(j+i>ptr2->length)) { error("│¼│÷┴╦▒╛╫╓╢╬╡─╫▄│ñ╢╚!"); goto yy2; } if((ptr2->type=='N')||(ptr2->type=='n')) { strcat(class[k],"substr(str("); strcat(class[k],ptr2->field); strcat(class[k],","); itoa(ptr2->length,ch,10); strcat(class[k],ch); strcat(class[k],","); itoa(ptr2->dec,ch,10); strcat(class[k],ch); strcat(class[k],")"); } if ((ptr2->type=='D')||(ptr2->type=='d')) { strcat(class[k],"substr(dtoc("); strcat(class[k],ptr2->field); strcat(class[k],")"); } if((ptr2->type=='C')||(ptr2->type=='c')) { strcat(class[k],"substr("); strcat(class[k],ptr2->field); } strcat(classbak[k],ptr2->field); strcat(class[k],","); itoa(i,ch,10); strcat(class[k],ch); strcat(class[k],","); itoa(j,ch,10); strcat(class[k],ch); strcat(class[k],")"); k++; ptr2=root2->sstr; continue; } else { if((ptr2->type=='N')||(ptr2->type=='n')) { strcat(class[k],"str("); strcat(class[k],ptr2->field); itoa(ptr2->length,ch,10); strcat(class[k],","); strcat(class[k],ch); strcat(class[k],","); itoa(ptr2->dec,ch,10); strcat(class[k],ch); strcat(class[k],")"); } if((ptr2->type=='D')||(ptr2->type=='d')) { strcat(class[k],"str(year("); strcat(class[k],ptr2->field); strcat(class[k],"),4)+str(month("); strcat(class[k],ptr2->field); strcat(class[k],"),2)+str(day("); strcat(class[k],ptr2->field); strcat(class[k],"),2)"); } if((ptr2->type=='C')||(ptr2->type=='c')) strcat(class[k],ptr2->field); strcat(classbak[k],ptr2->field); k++;ptr2=root2->sstr; continue; } } ptr2=ptr2->next; } } root2=root2->next; } return(1); case End: /*next select's base*/ root1=root2; while((root2=root2->next)!=NULL) { if(root2->sele=='Y') { ptr=root2->sstr; ptr2=ptr; clear_win(5,4,9,76,6,0,black); ptr1=disp_ch(ptr); i=0;j=10; goto begin; } /*endif*/ }/*endwhile*/ if(root2==NULL) { printf("\007"); root2=root1; } break; case Home:/*last select's base*/ root1=root2; while((root2=root2->last)!=NULL) { if(root2->sele=='Y') { ptr=root2->sstr; ptr2=ptr; clear_win(5,4,9,76,6,0,black); ptr1=disp_ch(ptr); i=0;j=10; goto begin;}/*endif*/ } /*endwhile*/ if(root2==NULL) { printf("\007"); root2=root1; } break; default: printf("\007");break; } /*endswitch*/ print(i,j,(ptr->cla!=0 ? 0|113:0|75),"%s",ptr->field); print(4,10,6|1,"%d",f); disp_fpart(ptr); }/*end for*/ } /*-----------------------------------END ALL-----------------------------*/