home *** CD-ROM | disk | FTP | other *** search
-
- /*┬╝╚δ╬¼╗ñ─ú┐Θ*/
- #define black 0x0
- #define blue 0x10
- #define green 0x20
- #define cyan 0x30
- #define red 0x40
- #define white 0x70
-
- #define yellow 33
- #define ewhite 37
- #define blue_back 44
- #define green_back 42
-
- #define back_black 40
- #define back_red 41
- #define back_green 42
- #define back_yellow 43
- #define back_blue 44
- #define back_magenta 45
- #define back_cyan 46
- #define back_white 47
- #define fore_black 30
- #define fore_red 31
- #define fore_green 32
- #define fore_yellow 33
- #define fore_blue 34
- #define fore_magenta 35
- #define fore_cyan 36
- #define fore_white 37
-
- #define UP 6 /* used in edd() */
- #define DOWN 7
- #define PgUp 18688
- #define PgDn 20736
- #define NOTHING 0 /* used in edd() */
- #define DOUBLE 0 /* using in gframe() */
- #define SINGAL 1
- #define CLEAR 2 /* used in gframe */
- #define YES 1 /* using in want_cursor() */
- #define NO 0 /* using in want_cursor() */
-
-
- #include<stdio.h>
- #include<stdlib.h>
- #include <alloc.h>
- #include <dir.h>
- #include <string.h>
- #include <dos.h>
-
- #define pr(x) fprintf(fp,x)
- typedef struct bb{
- char MEAN[21],DB[9],KEY[4][11],COFLAG,COPATH[11];
- int no;
- struct bb *next;
- }BASE;
- BASE *fbase;
- int NB,repeat,I,J,II,JJ;
- char *ccxx;
- main(argc,argv)
- int argc;
- char *argv[];
- { char p,passwd[10],buff[60],sub[40];
- int choice,i,j,cho[13],cchh[13], currow, curcol ;
- FILE *fp, *fg ;
- char *pro[13]={
- "" ,
- "amd1.prg",
- "amd2.prg",
- "app.prg",
- "modify.prg",
- "delete.prg",
- "setp.prg",
- "pmod.prg",
- "dcopy.prg",
- "lookall.prg",
- "diction.prg",
- "maintain.prg",
- "mcode.prg"
- };
-
- if(argc<2)
- return;
- if (strcmp(argv[2],"wy")!=0) return(0);
- for(i=1;i<13;i++)
- {
- cchh[i]=0;
- cho[i]=0;
- }
- if((fp=fopen("get_in.prg","r"))!=NULL)
- {
- clear_win(0,0,24,79,0) ;
- color_puts("*** ┬╝ ╚δ ╬¼ ╗ñ ─ú ┐Θ ╥╤ ┤µ ╘┌ ***",14,12,15);
- color_puts(" ╩╟ ╖± ╓╪ ╨┬ ╔· │╔ ( Y / N ) ? ",14,13,15);
- cursor(14,35);
- p=(char)bioskey(0);
- if(p!='Y'&&p!='y')
- {
- for( i=1; i<13; i++)
- if( (fg=fopen(pro[i], "r"))!=NULL )
- {
- cchh[i]=1 ;
- cho[i]=1 ;
- fclose( fg ) ;
- }
- }
- else
- {
- for( i=1; i<13; i++ )
- if( (fg=fopen(pro[i], "r"))!=NULL)
- {
- strcpy( sub, "del " ) ;
- strcat( sub, pro[i] ) ;
- strcat( sub, ">optzom" ) ;
- fclose( fg ) ;
- system( sub ) ;
- }
- }
- fclose(fp);
- }
- fp=fopen("word.mem","w");
- fclose(fp);
- system("del word.mem");
- repeat=1;
-
- getbase(argv[1]);
- clear_win( 0, 0, 24, 79, 119 ) ;
- color_puts("****┬╝╚δ╬¼╗ñ****",14,1,1);
- clear_win( 11, 12, 13, 40, 0 ) ;
- clear_win( 10, 10, 12, 38, 52 ) ;
- passwd[0]='\0' ;
- color_puts( "╚τ╣√▓╗╨Φ╔Φ╓├ , ╟δ╗╪│╡ . ", 75, 24, 0 ) ;
- color_puts("┐┌ ┴ε", 94, 11, 15 ) ;
- color_puts(" ", 96, 11, 27 ) ;
- line_edit( 11, 27, 96, passwd, 9 ) ;
- clear_win( 14, 25, 18, 50, 0 ) ;
- clear_win( 13, 23, 17, 48, 0x10 ) ;
- color_puts( "╩╟╖±╤í╘±┤·┬δ▓┘╫≈", 95, 14, 28 ) ;
- j = selete("╩╟", "╖± ", 16, 30, 37, 56 ) ;
- if ( j == 1 )
- {
- system("copy c:\\cdbag4\\code*.* *.* > oztom");
- /* system("copy c:\\cdbag4\\codep.prg *.* > oztom");*/
- strcpy(sub,"c:\\cdbag4\\sub0 ");
- strcat(sub,argv[1]);
- system(sub); cho[12]=1; cchh[12]=1;
- }
- mkdir("creat");
- /* strcpy(sub,"copy "); strcat(sub,argv[1]); strcat(sub,"*.txt creat > oztom");*/
- /* system(sub);
- system("copy db.txt creat > oztom");*/
- strcpy(sub,"c:\\cdbag4\\");
- strcat(sub,"sub ");
- j=1;
- while(j)
- {
- printf("\033[2J");
- clear_win(0,0,24,79,white) ;
- clear_win(5,17,21,59,black) ;
- clear_win(4,15,20,57,blue);
- color_puts("****┬╝╚δ╬¼╗ñ****",14,1,1);
- color_puts("╧╡ ═│ ╙╨ ╚τ ╧┬ ╣ª ─▄",fore_black,5,28);
- color_puts("╠φ╝╙,▓σ╚δ,╨▐╕─,╔╛│²,▓Θ╤»(╥╗╠σ╗»)",fore_black,7 ,22);
- color_puts("1. ╧╡═│╢¿╥σ╞┴─╗╕±╩╜",fore_black,9,21);
- color_puts("2. ╙├╗º╢¿╥σ╞┴─╗╕±╩╜",fore_black,10,21);
- color_puts("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",fore_black,11,18);
- color_puts("3. ┤╙╞Σ╦ⁿ┐Γ╠⌡╝■╠φ╝╙",fore_black,12,21);
- color_puts("4. ╠⌡╝■╨▐╕─ 5. ╠⌡╝■╔╛│²",fore_black,13,21);
- color_puts("6. ╨▐╕─┐┌┴ε 7. ┼·┴┐╕ⁿ╨┬",fore_black,14,21);
- color_puts("8. ▒╕╖▌╩²╛▌ 9. ╚½▓┐Σ»└└",fore_black,15,21);
- color_puts("10.╧╡═│╬¼╗ñ╙δ╩²╛▌╫╓╡Σ",fore_black,17,21);
- color_puts("11.╙├╗º└⌐│Σ─ú┐Θ 0. ═╦│÷",fore_black,18,21);
- color_puts("╟δ╩Σ╚δ─π╡─╤í╘±(0--11) [ ]",fore_black,19,21);
- for(choice=1; choice<12; choice++)
- {
- if(cchh[choice]==1)
- {
- position(choice, &currow, &curcol) ;
- cursor(currow, curcol) ;
- printf("*") ;
- }
- }
- loop:
- color_puts(" ",43);
- if((choice=get(0,11,19,44))!=0)
- {
- position(choice, &currow, &curcol) ;
- cho[choice]=1;
- cursor(currow, curcol) ;
- printf("*");
- }
- color_puts("─π─▄╚╖╚╧┬≡? (Y/N) [ ]",43,23,15);
- cursor(23,34);
- p=(char)bioskey(0);
- if(p=='y'||p=='Y')
- { cchh[choice]=1;
- switch(choice)
- {
- case 1:
- sub[15]='\0';
- sub[13]='1';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 2:
- sub[15]='\0';
- sub[13]='2';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 3:
- sub[15]='\0';
- sub[13]='3';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 4:
- sub[15]='\0';
- sub[13]='4';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 5:
- sub[15]='\0';
- sub[13]='5';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 6:
- sub[13]='6';
- sub[15]='\0';
- system(sub);
- break;
- case 7:
- sub[15]='\0';
- sub[13]='7';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 8:
- sub[13]='8';
- sub[15]='\0';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 9:
- sub[13]='9';
- sub[15]='\0';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 10:
- sub[13]='a';
- sub[15]='\0';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 11:
- sub[13]='b';
- sub[15]='\0';
- strcat(sub,argv[1]);
- system(sub);
- break;
- case 0:
- j=0;
- break;
- }
- }
- else
- {
- if(choice!=0)
- {
- cho[choice]=0;
- cursor(currow, curcol) ;
- printf(" ") ;
- goto loop ;
- }
- }
- }
- m_menu(cchh,argv[1]);
- rrcon();
- /* cr_ndx(argv[1]);*/
- pass(passwd);
- /* system("copy c:\\cdbag4\\code.dbf *.* > oztom");*/
- system("copy c:\\cdbag4\\proced.prg *.* > oztom");
- system("copy c:\\cdbag4\\again.prg *.* > oztom");
- system("del oztom");
- }
-
-
- getbase(char *nowpath)
- { int i,j,row,col,ctcn;
- char buff[120],coflag[2];
- FILE *fp;
- BASE *mybase;
- fp=fopen("db.txt","r");
- fbase = (BASE *)malloc(sizeof(BASE));
- mybase = fbase;
- mybase->next = NULL;
- mybase->no = 0;
- for(NB=0; fgets(buff,120,fp)!=NULL; NB++)
- { if(NB!=0)
- {
- mybase->next=(BASE*)malloc(sizeof(BASE));
- mybase=mybase->next;
- mybase->no=NB;
- mybase->next=NULL;
- }
-
- sscanf(buff,"#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#\n",
- mybase->MEAN,mybase->KEY[0],mybase->KEY[1],
- mybase->KEY[2],mybase->KEY[3],mybase->DB,coflag,coflag,mybase->COPATH) ;
- mybase->COFLAG=coflag[0];
- fflush(fp) ;
- }
- fclose(fp);
- fp=fopen("dbfmenu.prg","w");
- pr("parameters name, flag, coflag\nset talk off\nset color to /w\nclear\n");
- pr("set color to /n\n") ;
- fprintf(fp,"@6,17 clear to %d, 65\n", 6+NB/2+NB%2+1) ;
- pr("set color to W+/B\n");
- fprintf(fp,"@5,15 clear to %d, 63\n", 5+NB/2+NB%2+1) ;
- pr("@0,0 say '***╠φ╝╙,▓σ╚δ,╨▐╕─,╔╛│²,▓Θ╤»***'\n");
- pr("@2,25 say '─·┐╔╢╘╧┬┴╨┐Γ╜°╨╨▓┘╫≈'\n");
- pr("@3,25 say '~~~~~~~~~~~~~~~~~~~~'\n");
- i=0;row=6;col=15;
- while(i<NB)
- {
- mybase=fbase;
- while(mybase->no!=i)
- mybase=mybase->next;
- if(mybase->COFLAG == 'Y' || mybase->COFLAG == 'y')
- {
- fprintf(fp,"flag%-2d=1\n",i+1) ;
- fprintf(fp,"path%-2d='%s'\n",i+1,mybase->COPATH) ;
- }
- else
- {
- fprintf(fp,"flag%-2d=0\n",i+1) ;
- fprintf(fp,"path%-2d='%s'\n",i+1,nowpath) ;
- }
- fprintf(fp,"@%d,%d say '%2d--%s'\n",row,col,i+1,mybase->MEAN);
- if(col==15) col=45;
- else {col=15;row++;}
- i++;
- }
- pr("pesl=' '\nset color to w+/B\n");
- pr("@22,10 say '╟δ╩Σ╚δ─·╤í╘±╡─┐Γ╡─╨≥║┼, 0 ▒φ ╩╛ ═╦ │÷' get pesl\n");
- pr("read\nset color to W+/N\n");
- fprintf(fp,"num=%d\n",i);
- pr("if pesl='0'\n");
- pr("name='0'\n");
- pr("return\n");
- pr("endif\n");
- pr("do while val(pesl)>num .or. (pesl<>'0' .and. val(pesl)=0)\n");
- pr("@ 22,0 clear\npesl=' '\n");
- fprintf(fp,"@22,10 say '╩Σ╚δ┤φ!╟δ╓╪╨┬╩Σ╚δ (1--%d),or 0 ═╦│÷ ' get pesl \n",i);
- pr("read\n");
- pr("enddo\n");
- pr("pppp=val(pesl)\n");
- pr("pppp=int(pppp)\n");
- pr("do case\n");
- i=0;
- mybase=fbase;
- while(i<NB)
- {
- fprintf(fp,"case pppp=%d\n",i+1);
- fprintf(fp,"name='%s'\nflag=flag%-2d\ncoflag=path%-2d\n",
- mybase->DB,i+1,i+1);
- mybase=mybase->next;
- i++;
- }
- fprintf(fp,"case pppp=0\nname='0'\nreturn\n");
- pr("endcase\n");
- pr("return\n");
- fclose(fp);
- }
-
-
-
-
- dela()
- { int i,j;
- for (i=0;i<10;i++)
- for (j=-30000;j<30000;j++) ;
- }
-
-
-
- getcc()
- { union REGS r;
- r.h.ah=0;
- int86(0x16,&r,&r);
- if (r.h.al==27) exit(0);
- if (r.h.al) return(r.h.al);
- return(r.x.ax);
- }
-
-
-
- get(i,j,row,col)
- int i,j,row,col;
- { int key,c,n=0;
- cursor(row,col);
- printf(" ");
- cursor(row,col);
- while ((key=getcc())!=0x0D)
- { switch (key)
- { case 18432 : return('u');
- case 18688 : return('U');
- case 20480 : return('d');
- case 20736 : return('D');
- case 15104 : return('H');
- case 8 : if (n!=0) n=n/10;
- else { error(); cursor(row,col); }
- break;
- default : if( key>='0' && key<='9' )
- printf("%c",key);
- n=10*n+key%256-'0';
- break;
- }
- }
- if ((n>j||n<=i)&&n!=0) { error();
- get(i,j,row,col);
- }
- else return(n);
- }
-
- cursor(int y, int x)
- {
- _DH = (unsigned char)y ;
- _DL = (unsigned char)x ;
- _AH = (unsigned char)2 ;
- _BH = (unsigned char)0 ;
- geninterrupt(0x10) ;
- }
-
- color_puts(char *string, int color, int row, int col)
- {
- _SI = (unsigned int) string ;
- _DH = (unsigned char) row ;
- _DL = (unsigned char) col ;
- _CX = 1 ;
- while(*(( char * ) _SI))
- {
- _AH = (unsigned char) 2 ;
- _BH = (unsigned char) 0 ;
- __int__(0x10) ;
- ++_DL ;
-
- _AH = (unsigned char) 9 ;
- _AL = *((char *)_SI) ;
- _SI++ ;
- _BH = (unsigned char) 0 ;
- _BL = (unsigned char) color ;
- __int__(0x10) ;
- }
- }
-
-
- clear_win(startrow,startcol,endrow,endcol,attribe)
- int startrow,startcol;
- int endrow,endcol;
- int attribe;
- {
- _AH = (unsigned char) 6 ;
- _AL = (unsigned char) 0 ;
- _BH = (unsigned char) attribe ;
- _CH = (unsigned char) startrow ;
- _CL = (unsigned char) startcol ;
- _DH = (unsigned char) endrow ;
- _DL = (unsigned char) endcol ;
- geninterrupt(0x10) ;
- }
-
-
- now_cursor(x,y)
- int *x,*y;
- { union REGS r;
- r.h.ah=3;
- r.h.bh=0;
- int86(0x10,&r,&r);
- *x = r.h.dh;
- *y = r.h.dl;
- return;
- }
-
-
-
-
-
- movcur()
- { union REGS regs;
- regs.h.ah=19;
- regs.h.al=0;
- int86(0x10,®s,®s);
- }
-
-
-
-
- setcur()
- { union REGS regs;
- regs.h.ah=19;
- regs.h.al=1;
- int86(0x10,®s,®s);
- }
-
-
-
- error()
- { color_puts("###### ╩Σ╚δ┤φ╬≤! ╟δ╓╪╨┬╘┘╩Σ ######",12,23,15);
- dela();
- color_puts(" ",10,23,15);
- }
-
-
-
-
-
- pass(char *passwd)
- {
- FILE *fp;
- fp=fopen("check.prg","w");
- pr("parameters in\n");
- pr("clear\nset color to w+/B\n");
- fprintf(fp,"password='%s'\n",passwd);
- pr("if len(trim(password))=0 .AND. .not. file('word.mem')\n");
- pr("return\n");
- pr("endif\n");
- pr("if file('word.mem')\n");
- pr("restore from word addi\n");
- pr("endif\n");
- pr("@2,2 say '***┬╝╚δ╬¼╗ñ***'\n");
- pr("cc=0\n");
- pr("do while cc <3\nset color to w+/B\n");
- pr("@9,20 say '╬¼ ╗ñ ╣ª ─▄ ╙ª ╙╔ ╧╡ ═│ │╠ ╨≥ ╘▒ ╩╣ ╙├'\n");
- pr("set color to w+/b\n@11,20 say '╟δ ╩Σ ╚δ ┐┌ ┴ε'\n");
- pr("set color to W+/b\nset cons off\n");
- pr("accept to ppaa\n");
- pr("set cons on\n");
- pr("l1=len(ppaa)\n");
- pr("l2=len(password)\n");
- pr("if l1=l2 .AND. ppaa=password\n");
- pr("@4,0 clear to 20,79\n");
- pr("exit\n");
- pr("endif\n");
- pr("if cc<2\n");
- pr("@17,20 say '┐┌ ┴ε ┤φ ╬≤, ▓╗ ─▄ ╜° ╚δ, ╟δ ╓╪ ╨┬ ╩Σ ╚δ!'\n");
- pr("wait\n");
- pr("set color to W+/b\n@4,0 clear to 21,79\n");
- pr("cc=cc+1\n");
- pr("else\n");
- pr("in=.F.\n");
- pr("return\n");
- pr("endif\n");
- pr("enddo\n");
- pr("return\n");
- fclose(fp);
- }
-
- m_menu(int *cho,char *aarr)
- {
- FILE *fp,*fw,*codef;
- int i,j,k=0,row,col;
- BASE *mybase;
- char *expl[13]={
- "═╦│÷",
- "╧╡═│╢¿╥Γ╞┴─╗╕±╩╜",
- "╙├╗º╢¿╥Γ╞┴─╗╕±╩╜",
- "┤╙╞Σ╦ⁿ┐Γ╠φ╝╙",
- "╠⌡╝■╨▐╕─",
- "╠⌡╝■╔╛│²",
- "╨▐╕─┐┌┴ε",
- "┼·┴┐╕ⁿ╨┬",
- "╩²╛▌▒╕╖▌",
- "╚½▓┐Σ»└└",
- "╧╡═│╬¼╗ñ╙δ╩²╛▌╫╓╡Σ",
- "╙├╗º└⌐│Σ─ú┐Θ",
- "┤·┬δ╬¼╗ñ"
- };
- char *pro[13]={
- " ",
- "amd1.prg",
- "amd2.prg",
- "app.prg",
- "modify.prg",
- "delete.prg",
- "setp.prg",
- "pmod.prg",
- "dcopy.prg",
- "lookall.prg",
- "diction.prg",
- "maintain.prg",
- "mcode.prg"
- };
- fp=fopen("get_in.prg","w");
- pr("set talk off\nset safe off\nset exclusive off\n");
- pr("sele 9\n");
- pr("use\n");
- /* if ((codef=fopen("code.dbf","r"))!=NULL)
- {
- fprintf(fp,"use code exclusive\n");
- fprintf(fp,"inde on trim(fieldname)+trim(fieldcode) to codeinde\n");
- fprintf(fp,"set inde to codeinde\n");
- }
- fclose(codef);*/
- pr("sele 10\n");
- pr("use\n");
- pr("in=.T.\n");
- pr("do check with in\n");
- pr("do while in\n");
- pr("set color to /W\n") ;
- pr("clear\n");
- for( i=3,j=0; i<13; i++)
- if( cho[i] == 1 )
- j++ ;
- fprintf(fp,"set color to /N\n") ;
- fprintf(fp,"@ 6,21 clear to %d,62\n",j+11) ;
- pr("set color to w+/B\n");
- fprintf(fp,"@5,19 clear to %d,60\n",j+10) ;
- pr("@2,2 say '***┬╝╚δ╬¼╗ñ***'\n");
- pr("set color to w+/B\n");
- row=6;col=25;j=1;
- /* if ((fw=fopen(pro[1],"r"))!=NULL) cho[1]=1;
- else cho[1]=0;
- fclose(fw);
- if ((fw=fopen(pro[2],"r"))!=NULL) cho[2]=1;
- else cho[2]=0;
- fclose(fw);*/
- if(cho[1]==1||cho[2]==1)
- {
- fprintf(fp,"@%d,%d say '***╠φ╝╙,▓σ╚δ,╨▐╕─,╔╛│²,▓Θ╤» (╥╗╠σ╗») ***'\n",row++,col-5);
- row++;
- col=25;
- if(cho[1]==1)
- fprintf(fp,"@%d,%d say '%d. %s'\n",row++,col,j++,expl[1]);
- if(cho[2]==1)
- fprintf(fp,"@%d,%d say '%d. %s'\n",row++,col,j++,expl[2]);
- fprintf(fp,"@%d,%d say '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'\n",row++,col-5);
- }
- /* if ((fw=fopen(pro[3],"r"))!=NULL) cho[3]=1;
- else cho[3]=0;
- fclose(fw);*/
- if(cho[3]==1)
- fprintf(fp,"@%d,%d say '%d. %s'\n",row++,col,j++,expl[3]);
- for(i=4;i<=12;i++)
- {
- /* if ((fw=fopen(pro[i],"r"))!=NULL) cho[i]=1;
- else cho[i]=0;
- fclose(fw);*/
- if(cho[i]==1)
- {
- if(i==10&&col==45) { col=25; row++;}
- fprintf(fp,"@%d,%d say '%x. %s'\n",row,col,j++,expl[i]);
- if (i==10) col=45;
- if(col==45)
- { col=25;row++;}
- else
- col+=20;
- }
- }
- fprintf(fp,"@%d,%d say '0. %s'\n",row,col,expl[0]);
- pr("choice=' '\n") ;
- pr("set color to w+/b\n");
- pr("@22,20 say '╟δ ╩Σ ╚δ ─· ╡─ ╤í ╘± ' get choice\n");
- pr("read\n");
- pr("set color to W+/b\n");
- pr("choice=trim(choice)\n");
- pr("if choice='0'\n");
- pr("exit\n");
- pr("endif\n");
- pr("do case\n");
- for(j=1;j<13;j++)
- if(cho[j]==1)
- {
- fprintf(fp,"case choice='%x'\n",++k);
- fprintf(fp,"do %s\n",pro[j]);
- }
- pr("endcase\n");
- pr("enddo\n");
- pr("clear\n");
- pr("@10,20 say '╒² ╘┌ ╓╪ ╨┬ ╦≈ ╥² , ╟δ ╔╘ ║≥ !'\n");
- pr("@8,17 to 12,53\n");
- pr("sele 8\nuse\nselect 9\n");
- pr("use\n");
- pr("select 10\n");
- pr("use\n");
- pr("return\n");
- fclose(fp);
- }
-
-
-
- rrcon()
- { FILE *fp;
- fp=fopen("rcon.prg","w");
- pr("parameters renu,cb,condition,cs\n");
- pr("if renu>0\n");
- pr("@5,0 clear to 24,79\n");
- pr("row=5\ncol=10\n");
- pr("b=asc('A')+cb-1\n");
- pr("b=chr(b)\n");
- pr("go renu\n");
- pr("fl=FIELD_LEN\n");
- pr("ft=FIELD_TYPE\n");
- pr("fname=FIELD_NAME\n");
- pr("value=space(fl)\n");
- pr("do case\n");
- pr("case ft='L' .or. ft='C'\n");
- pr("fn=fname+'='\n");
- pr("@row,col say fn get value\n");
- pr("read\n");
- pr("if len(trim(value))<>0\n");
- pr("if cb=0\n");
- pr("condition=condition+trim(fname)+'='+\"'\"+value+\"'\"\n");
- pr("else\n");
- pr("condition=condition+b+'->'+trim(fname)+'='+\"'\"+value+\"'\"\n");
- pr("endif\n");
- pr("endif\n");
- pr("row=row+2\n");
- pr("case ft='N'\n");
- pr("condition=condition+'('\n");
- pr("fn=fname+'>'\n");
- pr("@row,col say fn get value\n");
- pr("read\nr=.f.\nrr=.f.\nif len(trim(value))<>0\n");
- pr("if cb=0\n");
- pr("condition=condition+trim(fname)+'>'+value\nr=.t.\n");
- pr("else\n");
- pr("condition=condition+b+'->'+trim(fname)+'>'+value\nr=.t.\nendif\nendif\n");
- pr("value=space(fl)\n");
- pr("fn=fname+'='\n");
- pr("row=row+3\n");
- pr("@row,col say fn get value\n");
- pr("read\nif len(trim(value))<>0\n");
- pr("if r\ncondition=condition+'.OR.'\n");
- pr("endif\n");
- pr("if cb=0\n");
- pr("condition=condition+trim(fname)+'='+value\n");
- pr("else\ncondition=condition+b+'->'+trim(fname)+'='+value\nendif\nrr=.t.\nendif\n");
- pr("value=space(fl)\n");
- pr("fn=fname+'<'\n");
- pr("row=row+3\n");
- pr("@row,col say fn get value\n");
- pr("read\nif len(trim(value))<>0\n");
- pr("if r\ncondition= condition+'.AND.'\n");
- pr("else\nif rr\ncondition=condition+'.OR.'\n");
- pr("endif\nendif\n");
- pr("if cb=0\n");
- pr("condition=condition+trim(fname)+'<'+value\n");
- pr("else\n");
- pr("condition=condition+b+'->'+trim(fname)+'<'+value\nendif\nendif\n");
- pr("row=row+4\n");
- pr("condition=condition+')'\n");
- pr("case ft='D'\n");
- pr("@row,col say fname \n");
- pr("value=' '\n");
- pr("@row+1,col+5 say '> / /'\n");
- pr("@row+1,col+6 get value\n");
- pr("read\nr=.f.\nif len(trim(value))<>0\n");
- pr("date=trim(value)\n");
- pr("value=' '\n");
- pr("@row+1,col+9 get value\n");
- pr("read\n");
- pr("date=date+'/'+trim(value)\n");
- pr("value=' '\n");
- pr("@row+1,col+12 get value\n");
- pr("read\n");
- pr("date=date+'/'+trim(value)\n");
- pr("value='ctod('+'\"'+date+'\"'+')'\n");
- pr("if cb=0\n");
- pr("condition=condition+trim(fname)+'>'+value\nr=.t.\n");
- pr("else\n");
- pr("condition=condition+b+'->'+trim(fname)+'>'+value\nr=.t.\nendif\nendif\n");
- pr("value=' '\n");
- pr("@row+2,col+5 say '= / /'\n");
- pr("@row+2,col+6 get value\n");
- pr("read\nr=.f.\nif len(trim(value))<>0\n");
- pr("date=trim(value)\n");
- pr("value=' '\n");
- pr("@row+2,col+9 get value\n");
- pr("read\n");
- pr("date=date+'/'+trim(value)\n");
- pr("value=' '\n");
- pr("@row+2,col+12 get value\n");
- pr("read\n");
- pr("date=date+'/'+trim(value)\n");
- pr("value='ctod('+'\"'+date+'\"'+')'\n");
- pr("if r\n");
- pr("condition=condition+'.AND.'\n");
- pr("endif\n");
- pr("if cb=0\n");
- pr("condition=condition+trim(fname)+'='+value\nr=.t.\n");
- pr("else\n");
- pr("condition=condition+b+'->'+trim(fname)+'='+value\nr=.t.\nendif\nendif\n");
- pr("value=' '\n");
- pr("@row+3,col+5 say '< / /'\n");
- pr("@row+3,col+6 get value\n");
- pr("read\nr=.f.\nif len(trim(value))<>0\n");
- pr("date=trim(value)\n");
- pr("value=' '\n");
- pr("@row+3,col+9 get value\n");
- pr("read\n");
- pr("date=date+'/'+trim(value)\n");
- pr("value=' '\n");
- pr("@row+3,col+12 get value\n");
- pr("read\n");
- pr("date=date+'/'+trim(value)\n");
- pr("value='ctod('+'\"'+date+'\"'+')'\n");
- pr("if r\n");
- pr("condition=condition+'.AND.'\n");
- pr("endif\n");
- pr("if cb=0\n");
- pr("condition=condition+trim(fname)+'<'+value\nr=.t.\n");
- pr("else\n");
- pr("condition=condition+b+'->'+trim(fname)+'<'+value\nr=.t.\nendif\nendif\n");
- pr("endcase\n");
- pr("con=' '\n");
- pr("@20,10 say '╟δ ╢¿ ╥σ ╠⌡ ╝■ ╫╓ ╢╬ ╝Σ ╡─ ┴¼ ╜╙ ╣╪ ╧╡ ' get con\n");
- pr("@21,10 say '1.AND 2.OR 3.NOT 4.AND NOT 5.OR NOT 0.═╦ │÷'\n");
- pr("read\n");
- pr("do case\n");
- pr("case con='1'\n");
- pr("condition=condition+'.AND.'\n");
- pr("case con='2'\n");
- pr("condition=condition+'.OR.'\n");
- pr("case con='3'\n");
- pr("condition=condition+'.AND.'\n");
- pr("case con='4'\n");
- pr("condition=condition+'.AND..NOT.'\n");
- pr("case con='5'\n");
- pr("condition=condition+'.OR..NOT.'\n");
- pr("case con='0'\n");
- pr("cs=.f.\n");
- pr("endcase\n");
- pr("@3,0 say condition\n");
- pr("return\n");
- fclose(fp);
- }
-
-
- /*cr_ndx(char *aarr)
- {
- int i=0;
- BASE *mybase;
- FILE *fp;
- fp=fopen("cr_ndx.prg","w");
- while(i<NB)
- {
- mybase=fbase;
- while(mybase->no!=i)
- mybase=mybase->next;
- fprintf(fp,"if .not. file('%si%s.ndx')\n",aarr,mybase->DB);
- fprintf(fp,"select 1\n");
- pr("clear\n");
- pr("set color to w+/b\n");
- pr("@10,20 say '╒² ╘┌ ╜¿ ╦≈ ╥² , ╟δ ╔╘ ║≥ !'\n");
- pr("@8,17 to 12,50\n");
- pr("set color to W+/b\n");
- fprintf(fp,"use %s%s\n",mybase->COPATH,mybase->DB);
- fprintf(fp,"index on %s to %si%s\n",mybase->KEY,mybase->COPATH,mybase->DB);
- pr("endif\n");
- i++;
- }
- fclose(fp);
- }*/
-
-
- position(int choice, int *currow, int *curcol)
- {
- if(choice==1||choice==2)
- {
- *currow = 8+choice ;
- *curcol = 20 ;
- }
- if(choice==3)
- {
- *currow = 12 ;
- *curcol = 20 ;
- }
- if(choice>=4&&choice<10)
- {
- *currow = choice/2+11 ;
- *curcol = 20+(choice%2)*20 ;
- }
- if (choice==11||choice==10)
- {
- *currow = 7+choice ;
- *curcol = 20 ;
- }
- }
-
- /* --- selete a choice from two term ---------- */
- /* if selete a return 1 */
- /* else return 2 */
- /*----------------------------------------------- */
- selete(char *a, char *b, int row, int acol, int bcol, char color)
- {
- int in,bb=1 ;
-
- color_puts(a,0|15,row,acol) ;
- color_puts(b,color,row,bcol) ;
- for(;;)
- {
- in=getcc() ;
- switch(in)
- {
- case 19712 :
- color_puts(a,color,row,acol) ;
- color_puts(b,0|15,row,bcol) ;
- bb=2;
- continue;
- case 19200 :
- color_puts(a,0|15,row,acol) ;
- color_puts(b,color,row,bcol) ;
- bb=1 ;
- continue;
- case 13 :
- return(bb);
- }
- }
- }
-
-
-
- /*---------------- This is a line editer -----------------------*/
- /* row,col posite the starting cursor */
- /* color denote the color of the */
- /* blackbord and the character */
- /* buff line-editer's interal denoting */
- /*--------------------------------------------------------------*/
- line_edit(int row, int col, int color, char *buff, int len)
- {
- int in_number=0, ins=0, i, j, flag=0 ;
- char *str ;
- union {
- int i;
- char ch[2];
- }key;
-
- len -= 2 ;
- color_puts(buff, color, row, col ) ;
- while(1)
- {
- cursor( row, col+in_number ) ;
- key.i = bioskey(0) ;
- if ((key.i&0x00ff)==13) key.i=key.i&0x00ff;
- switch(key.i)
- {
- case 15104: /* F1 */
- break ;
-
- case 19200: /* left arrow */
- if(in_number)
- in_number=confirm(buff,in_number-1);
- cursor( row, col+in_number ) ;
- break ;
-
- case 19712: /* right arrow */
- if( buff[in_number]=='\0' )
- buff[in_number]=' ' ;
- if((unsigned)buff[in_number]>128 && (unsigned)buff[in_number]>128)
- in_number+=2 ;
- else
- in_number++ ;
- if(in_number>len)
- in_number=0 ;
- break ;
-
- case 29440: /* Ctrl_left */
- in_number=confirm(buff,in_number-8) ;
- if( in_number <0 )
- in_number=0 ;
- break ;
-
- case 29696: /* ctrl_right */
- in_number = confirm(buff, in_number+8) ;
- if( in_number>(i=strlen(buff)))
- in_number = i ;
- break ;
-
- case 18176: /* Home */
- in_number=0 ;
- cursor( row, col ) ;
- break ;
-
- case 20224: /* End */
- in_number=strlen(buff) ;
- cursor( row, col+in_number ) ;
- break ;
-
- case 21248: /* Del */
- if( in_number==strlen(buff) )
- /* printf("\007");*/ ;
- else
- {
- if( (unsigned)buff[in_number]>128 && (unsigned)buff[in_number]>128 )
- {
- for( i=in_number+2,j=strlen(buff); i<=j; i++ )
- buff[i-2]=buff[i] ;
- color_puts( " ", color, row, col+j-2 ) ;
- }
- else
- {
- for( i=in_number+1,j=strlen(buff); i<=j; i++)
- buff[i-1] = buff[i] ;
- color_puts( " ", color, row, col+j-1 ) ;
- }
- str = &buff[in_number] ;
- color_puts(str, color, row, col+in_number) ;
- }
- break ;
-
- case 3592: /* Backspace */
- if(in_number)
- {
- if( (unsigned)buff[in_number-1]>128 && (unsigned)buff[in_number-2]>128 && in_number>1 )
- {
- for( i=in_number,j=strlen(buff); i<=j; i++)
- buff[i-2] = buff[i] ;
- in_number-=2 ;
- color_puts( " ", color, row, col+j-2 ) ;
- }
- else
- {
- for( i=in_number,j=strlen(buff); i<=j; i++)
- buff[i-1] = buff[i] ;
- in_number-- ;
- color_puts( " ", color, row, col+j-1 ) ;
- }
- str = &buff[in_number] ;
- color_puts( str, color, row, col+in_number ) ;
- }
- else
- /* printf("\007"); */ ;
- break ;
-
- case 20992: /* Ins */
- ins=(ins?0:1) ;
- break ;
-
- case 13: /* 7181 Enter */
- for( i=strlen(buff)-1; buff[i]==' '&&i>=0; i--);
- buff[i+1]='\0' ;
- return ;
-
- default:
- if( ins )
- {
-
- if( strlen(buff)>=len || key.ch[0]==0)
- /* printf("\007") ; */;
- else
- {
- for( i=strlen(buff); i>in_number; i--)
- buff[i] = buff[i-1] ;
- buff[in_number] = key.ch[0] ;
- if( (unsigned)key.ch[0]>128 )
- if( flag==0 ) /* the forehalf of chinese */
- {
- flag++ ;
- in_number++ ;
- }
- else
- {
- flag-- ;
- str = &buff[in_number-1] ;
- color_puts( str, color, row, col-1+in_number++ ) ;
- }
- else
- {
- str = &buff[in_number] ;
- color_puts( str, color,row, col+in_number++ ) ;
- }
- }
- }
- else
- {
- if( in_number>=len || key.ch[0]==0 )
- /* printf("\007") ; */;
- else
- {
- buff[in_number] = key.ch[0] ;
- str = &buff[in_number] ;
- color_puts( str, color, row, col+in_number++ ) ;
- }
- }
-
- }
- }
- }
-
-
- /*----- if the charater is chinese , and then the cursor must be in the first position----*/
- confirm(char *s, int col)
- {
- int i ;
- if( (unsigned)s[col]<128)
- return(col) ;
- for(i=col; (unsigned)s[i]>128&&i>0; i--) ;
- if((col-i)%2!=0)
- return(col) ;
- else
- return(col-1) ;
- }
-