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,*root5,*root9;/* end*/ extern int basecount,selecount,fselecount,linknum,link[5]; extern char linkfield[5][4][11],workname[30],linktype,lan,insert; extern BASE *root2,*root1,*root4; extern FIELD *p1,*p2,*p4,*p3; extern int num[6],use,sub1,sub2; extern char *title3[]; extern FIELD *NEXT(),*LAST(); extern FIELD *disp_f(); extern int ob,sub2; extern char file[13],PATH[30]; extern char condition[200],*con[6]; tj_f() { FILE *fp; char tail[4], name[13], *tjtype[]={"╟≤╝╟┬╝╕÷╩²","╟≤╫ε╨í╓╡","╟≤╫ε┤≤╓╡","╟≤╞╜╛∙╓╡","╟≤╫▄║═"}; int tj, key,i,j,k,ll; int loc[6]; char gsxih[50]; /*-----------------------------make start-------------------------*/ if(num[0]==0) make_file(0); if((insert!='y')&&(insert!='Y')) r_mean(); strcpy(file,"tj_f"); itoa(num[0],tail,10); strcat(file,tail); if((insert=='N')||(insert=='n')) w_menuf(); r1: ob=0; root2=root; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { p2->cla=0; p2->obj='N'; p2=p2->next; } } root2=root2->next; } /*--------------------------select statitical type------------------------*/ make_t(); print(4,5,6|1,"╟δ╤í═│╝╞└α╨═"); for(i=0;i<5;i++) print(7,i*12+5,0|15,"%s",tjtype[i]); i=0;tj=-1; print(7,5,0|75,"%s",tjtype[0]); make_help(10); while(tj==-1) { key=getcc(); print(7,i*12+5,0|15,tjtype[i]); switch(key) { case LEFT: if(i==0) printf("\007"); else i--; break; case RIGHT: if(i==4) printf("\007"); else i++; break; case Enter: tj=i; break; deflaut : printf("\007"); } print(7,i*12+5,0|75,tjtype[i]); } /*------------------------------tj_field-----------------------------*/ if(tj!=0) { make_t(); root2=root; while(root2!=NULL) if((root2->sele=='Y')&&(root2->sort==1)) break; else root2=root2->next; if(root2->sele=='Y') { p=root2->sstr; p4=p2=p; } /* 0-all1--n*/ p1=disp_f(p2,1); sele_f(p2,p1,p4,1,0,1); } /*endif*//*1--tj_f*/ /*----------------------------statis condition---------------------------*/ for(;;) { make_t(); print(4,5,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; } clear_win(5,4,9,76,6,0,black); p1=disp_f(p2,0); if((sele_f(p2,p1,p4,2,0,0))==1) break; } /*2--condition*/ /*---------------------gene prg--------------------------------*/ strcpy(name,file); strcat(name,".prg"); if(use==0) { 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"); /*----------------------------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"); loc[j]=100; } else { fprintf(fp," \n"); loc[j]=0; } if(j!=0) { 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"); } 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*/ 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"); } } 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-----------------------------*/ strcpy(name,file); strcat(name,"j.dbf"); fprintf(fp,"sele 9\nuse jg excl\nzap\nuse\nrun copy c:jg.dbf c:%s > zl\n",name); }/*enduse*/ else { if((fp=fopen(name,"a"))==NULL) exit(0); } strcpy(name,file); strcat(name,"j.dbf"); i=0; root2=root; while(root2!=NULL) if((root2->sele=='Y')&&(root2->sort==1)) break; else { if(root2->sele=='Y') i++; root2=root2->next; } /*----------------------------gene all type field statis---------------------------*/ switch(tj) { case 0: /**count*/ fprintf(fp,"sele %c \n",i+65); if(((lan=='y')||(lan=='Y'))&&(loc[i]==0)) { 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"); } fprintf(fp,"count all for %s to mmm1\n",condition); if(((lan=='Y')||(lan=='y'))&&(loc[i]==0)) { 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"); } fprintf(fp,"\nsele 9\nuse %s excl\nappen blan\nrepl ═│╝╞╢╘╧≤ with '╝╟┬╝',═│╝╞╠⌡╝■ with \"%s\",═│╝╞─┌╚▌ with '%s',═│╝╞╜ß╣√ with mmm1\n",name,condition,tjtype[0]); break; case 1: j=0; root2=root; while(root2!=NULL) { if(root2->sele=='Y') { p2=p=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { fprintf(fp,"sele %c\n",i+65); /*----------------------------------------lock---------------------------*/ if(((lan=='Y')||(lan=='y'))&&(loc[i]==0)) { 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"); } /*----------------------------------------lockend-----------------------*/ fprintf(fp,"index on %s to mndx\n",p2->field); /*-------------------------------unlock or relock------------------------*/ if(((lan=='y')||(lan=='Y'))&&(loc[i]==0)) { 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 or return--------------------*/ fprintf(fp,"go top\n\store %s to min%-d\n",p2->field,j); fprintf(fp,"sele 9\nuse %s excl\nappen blan\nrepl ═│╝╞╢╘╧≤ with '%s',═│╝╞─┌╚▌ with '%s',═│╝╞╜ß╣√ with min%d,═│╝╞╠⌡╝■ with \"%s\"\nsele 10\n",name,p2->field,tjtype[1],j++,condition); /* fprintf(fp,"run del c:mndx.?dx\n");*/ } p2=p2->next; } } root2=root2->next; } break; case 2: /*max*/ j=0; root2=root; while(root2!=NULL) { if(root2->sele=='Y') { p2=p=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { fprintf(fp,"sele %c\n",i+65); /*-----------------------------------lock---------------------------------*/ if(((lan=='y')||(lan=='Y'))&&(loc[i]==0)) { 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 %s to mndx\n",p2->field); /*-------------------------unlock----------------------------------------*/ if(((lan=='Y')||(lan=='y'))&&(loc[i]==0)) { 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 returne---------------------------*/ fprintf(fp,"go bott\n\store %s to max%-d\n",p2->field,j); fprintf(fp,"sele 9\nuse %s excl\nappen blan\nrepl ═│╝╞╢╘╧≤ with '%s',═│╝╞─┌╚▌ with '%s',═│╝╞╜ß╣√ with max%d,═│╝╞╠⌡╝■ with \"%s\"\nsele 10\n",name,p2->field,tjtype[2],j++,condition); /* fprintf(fp,"run del c:mndx.?dx\n");*/ } p2=p2->next; } } root2=root2->next; } break; case 3: /*aver*/ j=0; root2=root; fprintf(fp,"sele %c\n",i+65); /*-----------------------------------lock---------------------------------*/ if(((lan=='Y')||(lan=='y'))&&(loc[i]==0)) { 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,"average "); while(root2!=NULL) { if(root2->sele=='Y') { p2=p=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { if(j==0) fprintf(fp," %s",p2->field); else fprintf(fp,",%s",p2->field); j++; } p2=p2->next; } } root2=root2->next; } fprintf(fp," for %s to",condition); for(j=0;j<ob;j++) if(j==0) fprintf(fp," aver%-d",j); else fprintf(fp," ,aver%-d",j); /*-------------------------unlock----------------------------------------*/ if(((lan=='Y')||(lan=='y'))&&(loc[i]==0)) { fprintf(fp,"\nunlock\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 returne---------------------------*/ fprintf(fp,"\nsele 9\nuse %s excl\n",name); root2=root; j=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') fprintf(fp,"appen blan\nrepl ═│╝╞╢╘╧≤ with '%s',═│╝╞─┌╚▌ with '╟≤╞╜╛∙╓╡',═│╝╞╜ß╣√ with aver%-d,═│╝╞╠⌡╝■ with \"%s\"\n",p2->field,j++,condition); p2=p2->next; } } root2=root2->next; } break; case 4: /***sum*/ j=0; root2=root; fprintf(fp,"sele %c\n",i+65); /*-----------------------------------lock---------------------------------*/ if(((lan=='y')||(lan=='Y'))&&(loc[i]==0)) { 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,"sum "); while(root2!=NULL) { if(root2->sele=='Y') { p2=p=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') { if(j==0) fprintf(fp," %s",p2->field); else fprintf(fp,",%s",p2->field); j++; } p2=p2->next; } } root2=root2->next; } fprintf(fp," for %s to",condition); for(j=0;j<ob;j++) if(j==0) fprintf(fp," sum%-d",j); else fprintf(fp," ,sum%-d",j); /*-------------------------unlock----------------------------------------*/ if(((lan=='y')||(lan=='Y'))&&(loc[i]==0)) { fprintf(fp,"\nunlock\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 return---------------------------*/ fprintf(fp,"\nsele 9\nuse %s excl\n",name); root2=root; j=0; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->obj=='Y') fprintf(fp,"appen blan\nrepl ═│╝╞╢╘╧≤ with '%s',═│╝╞─┌╚▌ with '╟≤╫▄║═',═│╝╞╜ß╣√ with sum%-d,═│╝╞╠⌡╝■ with \"%s\"\nsele 9\n",p2->field,j++,condition); p2=p2->next; } } root2=root2->next; } break; default:break; } /*-----------------------------------make tail ------------------------------------*/ fclose(fp); use=1; clear_win(5,4,9,76,6,0,black); make_help(0); clear_win(13,4,20,75,6,0,black); printf("\033[17;20H╝╠╨°╠⌡╝■╫╓╢╬═│╝╞┬≡ú┐(Y/N) "); k=getcc(); if((k=='Y')||(k=='y')) goto r1; strcpy(name,file); strcat(name,".prg"); if((fp=fopen(name,"a"))==NULL) exit(0); else { strcpy(name,file); strcat(name,"j.dbf"); fprintf(fp,"close all\nrun c:brow c:%s\n",name); 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",name); clear_win(5,4,9,76,6,0,black); printf("\033[7;15H╚⌠─·╝ⁿ╚δ'Y',╘≥╧╡═│╜½╠ß╩╛─·╩Σ╚δ╣▓╧φ┬╖╛╢╝░╣▓╧φ├√."); 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",name,gsxih); } fclose(fp); } num[0]++; }/*end*/ /*----------------------------help---------------------------------*/ make_help(f) int f; { if(f==10) { print(f+5,30,6|1,"<╣ª─▄╦╡├≈>"); print(f+6,15,6|1,"╒Γ╨⌐╣ª─▄╩╟╙├╗º╘┌╜°╨╨╫╓╢╬═│╝╞╩▒,╧╡═│╦∙╠ß╣⌐╡─"); print(f+8,15,6|1,"╕≈╓╓═│╝╞╣ª─▄,╞Σ╓╨╟≤╝╟┬╝╕÷╩²--┐╔╤í╚╬╥Γ└α╨═╫╓╢╬;"); print(f+10,15,6|1,"╢°╞Σ╦ⁿ╡─╘≥▒╪╨δ╤í╩²╫╓╨═╫╓╢╬.╫╓╢╬╕÷╩²▓╗╧▐."); } else { print(f+6,30,6|1,"<╣ª─▄╦╡├≈>"); print(f+7,15,6|1,"╘┌┤╦┤ª╝ⁿ╚δN╗≥n╩▒,╙├╗º┐╔╘┌╘¡╙╨╡─▓┘╫≈┐Γ╡─╗∙┤í╔╧"); print(f+8,15,6|1,"╝╠╨°╔·│╔╠⌡╝■╫╓╢╬═│╝╞,╞Σ╠⌡╝■╝░═│╝╞╫╓╢╬┐╔╓╪╨┬╤í╘±╥▓"); print(f+9,15,6|1,"┐╔▓╗╨▐╕─╙├╥╘╟░╡─╤í╘±."); } } /*-----------------------------make titile ------------------------------*/ make_t() { clear_win(0,0,24,79,6,0,black); print(1,5,0|30,"**%s**",title3[sub2]); print(1,50,0|30,"**ESC->═╦│÷**"); gframe(5,2,11,78,0,0|30); print(4,5,6|1,"╣▓╤í"); print(4,13,6|1,"╫╓╢╬"); print(11,8,0|30,"Home/End"); print(11,60,0|30,"PgUp/PgDn"); gframe(13,2,23,78,0,0|30); print(13,8,0|30,"╨┼╧ó┤░┐┌"); } /*------------------------write statis.txt for mean name--------------------------*/ w_menuf() { FILE *fp; if((fp=fopen("statis0.txt","a"))==NULL) { error("don't open file statis.txt"); exit(1); } fprintf(fp,"#%s#,#%s#\n",workname,file); fclose(fp); } /*---------------------------------------make new or old------------------*/ make_file(nu) int nu; { char tt; char tai[4]; char ss2[14],ss1[14]; int i,inu; FILE *fg; switch(nu) { case 0: strcpy(ss2,"tj_f"); break; case 1: strcpy(ss2,"tj_h"); break; case 2: strcpy(ss2,"tj_z"); break; case 3: strcpy(ss2,"tj_t"); break; case 4: strcpy(ss2,"tj_q"); break; case 5: strcpy(ss2,"tj_s"); break; } strcpy(ss1,ss2); strcat(ss2,"0.prg"); if((fg=fopen(ss2,"r"))==NULL) num[nu]=0; else { fclose(fg); clear_win(0,0,24,79,6,0,black); gframe(5,2,11,76,0,0|30); print(7,20,6|1,"─·╘°╛¡╔·│╔╣²┤╦─ú┐Θ╡─╬─╝■╕▓╕╟┬≡ú┐(Y/N) "); tt=getcc(); if((tt=='Y')||(tt=='y')) { num[nu]=0; switch(nu) { case 0: system("del tj_f?.prg >zl"); unlink("statis0.txt"); break; case 1: system("del tj_h?.prg >zl"); unlink("statis1.txt"); break; case 2: system("del tj_z?.prg >zl"); unlink("statis2.txt"); break; case 3: system("del tj_t?.prg >zl"); unlink("statis3.txt"); break; case 4: system("del tj_q?.prg >zl"); unlink("statis4.txt"); break; case 5: system("del tj_s?.prg >zl"); unlink("statis5.txt"); break; } } else { print(7,20,6|1,"─·╥¬╓╪╨┬╔·│╔╥╤╔·│╔╣²╡──│╘┤│╠╨≥┬≡ú┐(Y/N): "); insert=getcc(); br: if((insert=='y')||(insert=='Y')) { print(7,20,6|1,"╟δ╩Σ╚δ╥¬╓╪╨┬╔·│╔╡─╘┤│╠╨≥╨≥║┼(┤╙0┐¬╩╝╝╞╩²): "); scanf("%d",&inu); } i=1; for(;;) { itoa(i,tai,10); strcpy(ss2,ss1); strcat(ss2,tai); strcat(ss2,".prg"); num[nu]=i; if((fg=fopen(ss2,"r"))==NULL) break; else fclose(fg); i++; } if((insert=='Y')||(insert=='y')) if(inu<num[nu]) num[nu]=inu; else if(inu==num[nu]) insert='N'; else { error("╨≥║┼╠½┤≤úí"); printf("\007"); getcc(); bottom(); goto br; } } } } /*----------------------------------ADD FIELD-------------------------------------*/ add_field(f1) int f1; { int ten; if(f1!=1) { clear_win(0,0,24,79,6,0,black); gframe(5,2,11,78,0,0|30); print(7,18,6|1,"─·╥¬╘÷╝╙╨┬╡─╫╓╢╬ú┐(Y/N):"); printf("\033[7;43H\033[0;37;40m"); gframe(14,2,22,78,1,0|30); if((sub1==1)&&(sub2==1)){ print(17,8,6|1,"╩╣╙├╦╡├≈:"); print(19,10, 6|1,"─·┐╔╥╘╝╙╚δ╥╗╕÷╩²╫╓╨═╫╓╢╬╙├└┤┤µ╖┼║ß╧≥═│╝╞╜ß╣√"); print(20,10,6|1,"╥▓┐╔╥╘▓╗╘÷╝╙╫╓╢╬,░╤║ß╧≥═│╝╞╜ß╣√╖┼╚δ╥╗╕÷╥╤┤µ╘┌╡─╩²╫╓╨═╫╓╢╬╓╨"); } ten=getcc(); } else { ten='Y'; clear_win(5,0,24,79,6,0,black); gframe(5,2,11,78,0,0|30); gframe(14,2,22,78,1,0|30); } if((ten=='Y')||(ten=='y')) { if(f1==0) { get_root(); root9=root1; } if(f1==3) root1=root9; root5=root1; root1->sele='Y'; clear_win(5,4,9,76,6,0,black); clear_win(16,4,20,76,6,0,black); print(17,10,6|1,"─·╦∙╝╙╡─╫╓╢╬╡─╫ε┤≤│ñ╢╚╬¬ 19╬╗,╨í╩²╬╗╩²╫ε┤≤╬¬ 6╬╗"); print(18,10,6|1,"─·╝╙╡─╫╓╢╬╙ª╩╟║╧╖¿╡─,╖±╘≥╧╡═│╜½▓╗╜╙╩▄"); /* disp_bmess(root1);*/ getmem(); l2: print(7,20,6|1,"╫╓╢╬├√:"); printf("\033[7;31H\033[0;37;40m"); p1->sele='Y'; fflush(stdin); scanf("%10s",p1->field); if((p1->field[0]>='0')&&(p1->field[0]<='9')) { printf("\007"); goto l2; } if((check(root1,p1,1))==-1) { printf("\007"); goto l2;/*need---*check****/ } if((check(root,p1,1))==-1) { printf("\007"); goto l2; } p1->type='N'; l3: print(8,10,6|1,"╫╓╢╬│ñ╢╚:"); printf("\033[8;21H\033[0;37;40m"); fflush(stdin); scanf("%d",&ten); if((ten>0)&&(ten<=19)) p1->length=ten; else { printf("\007"); goto l3;} l4: print(8,40,6|1,"╫╓╢╬╨í╩²╬╗╩²:"); printf("\033[8;55H\033[0;37;40m"); fflush(stdin); scanf("%d",&ten); if((ten>=0)&&(ten<p1->length-2)&&(ten<12)) p1->dec=ten; else {printf("\007"); goto l4; } print(9,10,6|1,"─·╚╖╨┼┬≡ú┐(Y/N):"); printf("\033[9;28H\033[0;37;40m"); if(((ten=getcc())=='N')||(ten=='n')) goto l2; else if(root1->sstr!=NULL) { root1->estr->next=p1; p1->last=root1->estr; root1->estr=p1; } else { root1->sstr=p1; root1->estr=p1; /* p1->last=root1->sstr;*/ } clear_win(5,4,9,76,6,0,black); }/*endif*/ } /*------read_mean_mainkey4-----------make_link_table-----------------*/ read_key() { int i,k; if(root5==NULL) { get_root(); root5=root1; } clear_win(1,1,24,79,6,0,black); gframe(5,10,11,68,0,0|30); h1: print(7,20,6|1,"╟δ╩Σ╚δ▒╛▓┘╫≈┐Γ╡─▓╦╡Ñ╠ß╩╛├√: "); scanf("%s",root5->mean); root2=root; while(root2!=NULL) { if((strcmp(root5->mean,root2->mean))==0) { error("╦∙╝╙▓╦╡Ñ╠ß╩╛├√▓╗─▄╙δ╥╤╙╨╡─╓╪╕┤úí"); getcc(); bottom(); goto h1; } root2=root2->next; } clear_win(1,1,24,79,6,0,black); gframe(5,10,11,68,0,0|30); h10: print(7,20,6|1,"╟δ╩Σ╚δ▒╛▓┘╫≈┐Γ╡─│╠╨≥├√: "); scanf("%s",root5->dbname); root2=root; while(root2!=NULL) { if((strcmp(root5->dbname,root2->dbname))==0) { error("╦∙╝╙│╠╨≥├√▓╗─▄╙δ╥╤╙╨╡─╓╪╕┤úí"); getcc(); bottom(); goto h10; } root2=root2->next; } root2=root; p3=root5->estr; while(root2!=NULL) { if(root2->sele=='Y') { p2=root2->sstr; while(p2!=NULL) { if(p2->sele=='Y') { getmem(); if(p3==NULL) { p=root5->sstr=p3=p1; p3->last=NULL; } else { p1->last=p3; p3->next=p1; p3=p1;} strcpy(p1->field,p2->field); p1->type=p2->type; p1->length=p2->length; p1->dec=p2->dec; } p2=p2->next; } } root2=root2->next; } root5->estr=p3; root3->next=root5; root5->last=root3; root3=root5; root3->sele='Y'; p2=root3->sstr; /*-------------read mainkey---------------------*/ clear_win(1,1,24,79,6,0,black); gframe(5,2,11,78,0,0|30); gframe(13,2,22,78,1,0|30); for( i=0;i<4;i++) { clear_win(7,6,8,74,6,0,black); if(i!=0) { print(7,23,6|1,"╝╠╨°╩Σ╚δ╣╪╝ⁿ╫╓┬≡(Y/N)ú┐ "); clear_win(7,6,8,74,6,0,black); k=getcc(); if((k=='N')||(k=='n')) break; } print(8,20,6|1,"╟δ╩Σ╚δ╣╪╝ⁿ╫╓%-d: ",i); add2: scanf("%s",root3->mainkey[i]); while(p2!=NULL) if((strcmp(p2->field,root3->mainkey[i]))==0) break; else p2=p2->next; if(p2==NULL) { error("╣╪╝ⁿ╫╓╙╨╬≤!");getcc(); bottom();printf("\033[8;34H"); p2=root3->sstr; goto add2;} } } /*-----------------------------ALL END -----------------------------------*/