home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <fcntl.h>
- #include <io.h>
- #include <ctype.h>
- #include <dos.h>
- #include <alloc.h>
- #include <dir.h>
- #include <string.h>
- #include <stdarg.h> //========
-
- #define black 0
- #define blue 1
- #define green 2
- #define eblue 3
- #define red 4
- #define pred 5
- #define eyellow 6
- #define white 7
- #define intense 8
- #define yellow 14
- #define ewhite 15
- #define blue_back 16
- #define green_back 32
- #define red_back 64
-
- char pathname[14];
- FILE *fp;
- int js1,js2;
-
- struct dbfile {
- struct dbf{
- char mean[20];
- char dbname[10];
- char mainkey[4][12];
- char flag[2];
- char flag_share[2];
- char share_path[30];
- } db[10];
- int count;
- struct dbfile *last,*next;
- } *dbfhead,*p,*q;
-
- main()
- {
- int charact;
- char *path={"c:\\cdbag\\"};
- int count1,count2,count3;
- char sub_dir[9];
- char drive_no[3];
- char file_no[9];
- char ext_no[5];
- int flag_no;
-
- char *baoqi=" ╬ó ╗· ═° ┬τ ╗╖ ╛│ ╧┬ ╣▄ └φ ╚φ ╝■ ╫╘ ╢» ╔· │╔ ╞≈ ";
- char biaoti[4][14]={
- "▓╦╡Ñ╔·│╔",
- "┐Γ╜ß╣╣╔·│╔",
- "╙ª╙├│╠╨≥╔·│╔",
- "═╦│÷"
- };
- cls(1,0,24,79,0|113); system("c:");
- print(0,0,0|30," ▓╦╡Ñ╔·│╔ ┐Γ╜ß╣╣╔·│╔ ╙ª╙├│╠╨≥╔·│╔ ═╦│÷ ");
- /*cls(7,18,15,66,6|1);*/
- cls(4,16,22,69,0);
- frame(4,15,22,67,0|30);
- print(4,17,yellow | blue_back," ");
- print(5,17,yellow | blue_back,"%s",baoqi);
- print(6,17,yellow | blue_back," ");
- print(7,17,yellow | blue_back," ú├ú─ú┬ú┴ú╟ ú┤ú«ú░░µ ");
- print(8,17,yellow | blue_back," ");
- print(9,17,yellow | blue_back," ▒▒╛⌐║╜┐╒║╜╠∞┤≤╤º╝╞╦π╗·╧╡ ");
- print(10,17,yellow | blue_back," ");
- print(11,17,yellow | blue_back," ╝╞╦π╗·╕▀╝╝╩⌡▓·╞╖┐¬╖ó╓╨╨─╤╨╓╞ ");
- print(12,17,yellow | blue_back," ");
- print(13,17,yellow | blue_back," ╡╪╓╖ú║▒▒║╜602╜╠╤╨╩╥ ╡τ╗░ú║2017251-603 ");
- print(14,17,yellow | blue_back," ");
- print(15,17,yellow | blue_back," ╠╪╘╝╛¡╧·ú║╬≈░▓║╜┐╒╝╞╦π╝╝╩⌡╣½╦╛ ╡τ╗░ú║752137 ");
- print(16,17,yellow | blue_back," ");
- print(17,17,yellow | blue_back," ╛¡╧·╡╪╓╖ú║╬≈░▓╩╨╠½░╫─╧┬╖29║┼(▒▀╝╥┤σ╩«╫╓─╧) ");
- print(18,17,yellow | blue_back," ");
- print(19,17,yellow | blue_back," ╥╗╛┼╛┼╥╗─Ω╩«╥╗╘┬ ");
- print(20,17,yellow | blue_back," ");
- getchb();
- cls(3,10,23,76,0|113);
- cls(5,10,19,73,0);
- frame(5,9,19,71,0|30);
- print(6,32,yellow | blue_back,"╧╡ ═│ ╝≥ ╜Θ");
- print(8,11,yellow | blue_back," CDBAG 4.0╩╟╝╠CDBAG 3.0╔╠╞╖╗»░µ▒╛╓«║≤╡─╫ε╨┬░µ▒╛ú║");
- print(10,11,yellow | blue_back," ó┘ ╕∙╛▌╙├╗º╜╗╗Ñ╩╜╨Φ╟≤╢¿╥σú¼┐∞╦┘╫╘╢»╔·│╔╡Ñ╙├╗º╗≥═°");
- print(11,11,yellow | blue_back," ┬τ╢α╙├╗ºú═ú╔ú╙╧╡═│íú");
- print(12,11,yellow | blue_back," ó┌ ╫╘╢»╔·│╔DBASE ó≤ PLUSú»FOXBASE PLUS ╘┤│╠╨≥╧╡═│íú");
- print(13,11,yellow | blue_back," ó█ ╓º│╓┐∞╦┘╘¡╨═⌐ñ⌐ñ╘¡╨═╘÷┴┐╨┬╡─ú═ú╔ú╙┐¬╖ó╖╜╖¿íú");
- print(14,11,yellow | blue_back," ó▄ ╔·│╔╡─ú═ú╔ú╙╝»│╔╥╗╠σ╗»ú¼╗²─╛╫Θ║╧┐¬╖┼╩╜╜ß╣╣íú");
- print(15,11,yellow | blue_back," ó▌ ╬¬╙ª╙├┐¬╖ó╚╦╘▒║═╫ε╓╒╙├╗º╠ß╣⌐╫█║╧╡─╥╗╠σ╗»╡─┐¬╖┼");
- print(16,11,yellow | blue_back," ╩╜ú═ú╔ú╙┐¬╖ó╗╖╛│║═╣ñ╛▀íú");
- getchb();
- cls(1,5,22,76,0|113);
- /* cls(7,25,10,55,yellow | blue_back);*/
- cls(8,28,12,59,0);
- frame(8,27,12,57,0|30);
- print(8,28,yellow | blue_back," ╟δ╩Σ╚δ╙ª╙├╧╡═│╫╙─┐┬╝├√");
- print(10,29,0|113,"%-26s"," ");
- print(10,29,0|113," ");
- read_string(pathname,13);
- flag_no=fnsplit(pathname,drive_no,sub_dir,file_no,ext_no);
- if (flag_no & DRIVE)
- system(drive_no);
- while (mkdir(pathname)!=0)
- {
- print(8,28,yellow | blue_back," ╕├╙ª╙├╧╡═│╫╙─┐┬╝├√╥╤╛¡┤µ╘┌ ");
- print(9,28,yellow | blue_back," ╩╟ ╖± ╓╪ ╨┬ ╩Σ ╚δ(Y/N) ? ");
- print(10,29,0|113,"%-26s");
- print(10,29,0|113," ");
- charact=getchb();
- while (charact!='N'&&charact!='n'&&charact!='Y'&&charact!='y') charact=getchb();
- if (charact=='n'||charact=='N') break;
- /*cls(7,25,10,55,yellow | blue_back);*/
- print(8,28,yellow | blue_back," ╟δ╩Σ╚δ╙ª╙├╧╡═│╫╙─┐┬╝├√ ");
- print(9,28,0|30,"%-26s"," ");
- print(10,29,0|113,"%-26s"," ");
- print(10,29,0|113," ");
- read_string(pathname,13);
- flag_no=fnsplit(pathname,drive_no,sub_dir,file_no,ext_no);
- if (flag_no & DRIVE)
- system(drive_no);
- }
- chdir(pathname);
- cls(7,25,12,59,0|113);
- count1=0;
- print(0,5,0|15,"%s",biaoti[count1]);
- for (;;)
- {
- charact=getchb();
-
- switch (charact)
- {
- case 275:
- print(0,5+20*count1,0|30,"%s",biaoti[count1]);
- count1=(count1-1<0)?3:count1-1;
- break;
- case 277:
- print(0,5+20*count1,0|30,"%s",biaoti[count1]);
- count1=(count1+1>3)?0:count1+1;
- break;
- case 27:return(0);
- case 13:switch (count1)
- {
- case 0:system("c:\\cdbag4\\menu 1 wh");
- /* print(0,5,white,"▓╦╡Ñ╔·│╔ ┐Γ╜ß╣╣╔·│╔\
- ╙ª╙├│╠╨≥╔·│╔ ═╦│÷");*/
- cls(0,0,24,79,0|113);
- print(0,0,0|30," ▓╦╡Ñ╔·│╔ ┐Γ╜ß╣╣╔·│╔ ╙ª╙├│╠╨≥╔·│╔ ═╦│÷ ");
- break;
- case 1:edit_dbfstru();
- cls(2,2,21,77,0|113);
- break;
- case 2:progag(pathname);
- break;
- case 3:mainprg(pathname);
- cls(1,0,24,79,0|113);
- cls(10,31,12,51,6|1);
- cls(9,29,11,49,yellow | blue_back);
- print(10,35,yellow | blue_back,"Generate...");
- system("copy c:\\cdbag4\\ndx.dbf *.* > oztom");
- system("copy c:\\cdbag4\\dbf_stru.dbf *.* > oztom");
- system("copy c:\\cdbag4\\menu.dbf *.* > oztom");
- system("copy c:\\cdbag4\\lmenu.prg *.* > oztom");
- system("copy c:\\cdbag4\\pro.prg *.* >oztom");
- system("copy c:\\cdbag4\\db.dbf *.* > oztom");
- system("copy c:\\cdbag4\\choice.prg *.* > oztom");
- system("copy c:\\cdbag4\\pro.prg *.* > oztom");
- system("copy c:\\cdbag4\\dbmenu.prg *.* > oztom");
- system("copy c:\\cdbag4\\ndx.prg *.* > oztom");
- system("copy c:\\cdbag4\\get_choi.prg *.* > oztom");
- system("copy c:\\cdbag4\\brow.exe *.* > oztom");
- system("cd \\"); cls(0,0,24,79,white);
- return(0);
- }
- break;
- }
- print(0,5+count1*20,0|15,"%s",biaoti[count1]);
- }
- }
-
- getmem()
- {
- int i,n;
- p=(struct dbfile *) malloc(sizeof(struct dbfile));
- p->count=0;
- p->next=p->last=NULL;
- for (i=0;i<10;i++)
- {
- strcpy(p->db[i].mean,NULL);
- strcpy(p->db[i].dbname,NULL);
- for (n=0;n<4;n++)
- strcpy(p->db[i].mainkey[n],NULL);
- strcpy(p->db[i].flag,NULL);
- strcpy(p->db[i].flag_share,NULL);
- strcpy(p->db[i].share_path,NULL);
- }
- return(1);
- }
-
- edit_dbfstru()
- {
- char miss[80];
- char dbfname[19];
- int i,j;
- strcpy(dbfname,pathname);
- strcat(dbfname,"\\db.txt");
- if ((fp=fopen(dbfname,"r"))==NULL)
- {
- /*cls(9,28,11,56,6|1);*/
- cls(8,26,12,59,6|1);
- frame(8,25,12,57,white | red_back);
- print(8,27,white | red_back," ─·├╗╙╨╬¬▒╛╧╡═│╢¿╥σ┐Γ▓╬╩² ");
- print(9,27,white | red_back," ▓╗─▄╔·│╔┐Γ╜ß╣╣ ");
- print(10,27,white | red_back," ╝ⁿ ╚╬ ╥╗ ╝ⁿ ╝╠ ╨°.... ");
- getchb();
- cls(8,27,12,59,0|113);
- return(0);
- }
- i=0; getmem(); dbfhead=q=p;
- while (fgets(miss,120,fp)!=NULL)
- {
- if (i==10)
- {
- i=0; getmem();
- q->next=p; p->last=q; q=p;
- }
- sscanf(miss,"#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#",p->db[i].mean,\
- p->db[i].mainkey[0],p->db[i].mainkey[1],p->db[i].mainkey[2],p->db[i].mainkey[3],\
- p->db[i].dbname,p->db[i].flag,p->db[i].flag_share,p->db[i].share_path);
- j=strlen(p->db[i].dbname);
- while (p->db[i].dbname[j-1]==' ') j--;
- p->db[i].dbname[j]='\0';
- i++; p->count++;
- }
- fclose(fp);
- p=dbfhead;
- sele_dbf();
- fp=fopen("db.txt","w");
- p=dbfhead;
- for (;;)
- {
- for (i=0;i<p->count;i++)
- fprintf(fp,"#%s#,#%s#,#%s#,#%s#,#%s#,#%s#,#%s#,#%s#,#%s#\n",p->db[i].mean,\
- p->db[i].mainkey[0],p->db[i].mainkey[1],p->db[i].mainkey[2],p->db[i].mainkey[3],\
- p->db[i].dbname,p->db[i].flag,p->db[i].flag_share,p->db[i].share_path);
- p=p->next;
- if (p==q->next) break;
- dbfhead->next=NULL; p->last=NULL;
- free(dbfhead); dbfhead=p;
- }
- free(dbfhead);
- fclose(fp);
- return(1);
- }
-
- disp_midd(row,color)
- int row,color;
- {
- print(7+row,9,color,"%-20s",p->db[row].mean);
- print(7+row,41,color,"%-10s",p->db[row].dbname);
- print(7+row,66,color,"%s",p->db[row].flag);
- }
-
- disp_dbf()
- {
- int i;
- /*cls(5,8,16,74,6|1);
- cls(4,7,15,73,yellow | blue_back);*/
- frame(5,7,18,73,0|30);
- print(5,9,yellow | blue_back,"╩²╛▌┐Γ▓╦╡Ñ║¼╥σ ╩²╛▌┐Γ├√ ╜¿┐Γ▒Ω╓╛");
- print(6,9,white | blue_back,"--------------------------------------------------------------");
- for (i=0;i<p->count;i++) disp_midd(i,yellow | blue_back);
- return(0);
- }
-
- disp_instruc()
- {
- /*cls(20,8,23,74,6|1);
- cls(19,7,22,73,yellow | blue_back);
- print(20,20,yellow | blue_back,"╟δ ╤í ╘± ─· ╨Φ ▓┘ ╫≈ ╡─ ╩² ╛▌ ┐Γ ");*/
- print(24,0,0|75,"%-80s","PgDn ╔╧╖¡ PgUp ╧┬╖¡ íⁿ ╔╧╥╞╣Γ┤° í² ╧┬╥╞╣Γ┤° Enter╤í╘± Esc ═╦│÷ ");
- }
-
- sele_dbf()
- {
- int i,n,m,k,j;
- char *opertype[3]={
- "▒α ╝⌐ ┐Γ ╜ß ╣╣ (╜¿ ┴ó \\╨▐ ╕─)",
- "╜½ ╥╤ ╙╨ ╡─ ┐Γ ╜ß ╣╣ ┐╜ ╚δ ",
- "╔╛ │² ╥╤ ╙╨ ╡─ ┐Γ ╜ß ╣╣"
- };
- disp_instruc();
- disp_dbf();
- i=0; disp_midd(i,0|113);
- while ((n=getchb())!=27)
- {
- switch (n)
- {
- case 273:if (p==dbfhead) break;
- i=0; p=p->last;
- disp_dbf();
- break;
-
- case 281:if (p==q) break;
- i=0; p=p->next;
- disp_dbf();
- break;
- case 272:if (i==0) break;
- disp_midd(i,yellow | blue_back);
- i--;
- break;
- case 280:if (i==p->count-1) break;
- disp_midd(i,yellow | blue_back);
- i++;
- break;
- case 13:
- /*cls(10,20,14,51,6|1);
- cls(9,19,13,50,0|113);*/
- cls(10,20,14,54,0);
- frame(10,18,14,52,0|113);
- print(10,20,0|113,"%s",opertype[0]);
- print(11,20,0|113,"%s",opertype[1]);
- print(12,20,0|113,"%s",opertype[2]);
- m=0; print(10,20,yellow | blue_back,"%-30s",opertype[m]);
- js1=i; j=1;
- while ((k=getchb())!=27)
- {
- switch (k)
- {
- case 272:
- print(10+m,20,0|113,"%-30s",opertype[m]);
- m=(m==0)?2:m-1;
- break;
- case 280:
- print(10+m,20,0|113,"%-30s",opertype[m]);
- m=(m==2)?0:m+1;
- break;
- case 13:if (m==0) {edit_stru(); j=0;}
- if (m==1) {copy_stru(); j=0;}
- if (m==2) {dele_stru(); j=0;}
- }
- if (j==0) break;
- print(10+m,20,yellow | blue_back,"%-30s",opertype[m]);
- }
- disp_dbf();
- break;
- }
- disp_midd(i,0|113);
- }
- cls(1,0,24,79,0|113);
- return(0);
- }
-
- edit_stru()
- {
- FILE *fw;
- char editpath[50];
- strcpy(editpath,"c:\\cdbag4\\mc 2 ");
- strcat(editpath,p->db[js1].mean);
- strcat(editpath," ");
- strcat(editpath,p->db[js1].dbname);
- strcat(editpath,".txt");
- system(editpath);
- strcpy(editpath,p->db[js1].dbname);
- strcat(editpath,".txt");
- if ((fw=fopen(editpath,"r"))!=NULL)
- {
- p->db[js1].flag[0]='Y';
- YN_value(p->db[js1].dbname,p->db[js1].flag);
- fclose(fw);
- }
- cls(17,0,18,79,0|113);
- return(0);
- }
-
- copy_stru()
- {
- char path_name[40];
- char path_name1[30];
- char copypath[80];
- FILE *fw;
- strcpy(copypath,"copy ");
- /*cls(14,15,17,59,6|1);
- cls(13,14,16,58,0|113);*/
- cls(14,16,16,60,0);
- frame(14,14,17,58,0|30);
- print(17,15,6|1,"%-.*s",46,"⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ");
- print(14,16,yellow | blue_back,"╟δ ╩Σ ╚δ ╘┤ ╬─ ╝■ ├√ : ");
- print(15,16,0|113,"%-40s"," ");
- print(15,16,0|113," ");
- read_string(path_name,35);
- strcat(path_name,".dbf");
- if ((fw=fopen(path_name,"r"))==NULL)
- {
- /*cls(13,14,15,58,0|30);
- cls(14,16,17,60,0);*/
- frame(14,14,17,58,0|75);
-
- print(14,22,0|75," ╕├ ╘┤ ╬─ ╝■ ▓╗ ┤µ ╘┌ ");
- print(15,22,0|75,"Press any key to continue...");
- getchb(); fclose(fw);
- cls(17,0,18,79,0|113);
- return(0);
- }
- fclose(fw);
- strcat(copypath,path_name); strcat(copypath," ");
- strcat(copypath,pathname); strcat(copypath,"\\");
- strcat(copypath,p->db[js1].dbname); strcat(copypath,".dbf"); strcat(copypath," > oztom");
- system(copypath); p->db[js1].flag[0]='Y';
- YN_value(p->db[js1].dbname,p->db[js1].flag);
- strcpy(path_name1,p->db[js1].dbname); strcat(path_name1,".txt");
- field_read(path_name,path_name1);
- cls(17,0,18,79,0|113);
- return(0);
- }
-
- dele_stru()
- {
- char path[80],delpath[80];
- int i;
- strcpy(path,"del ");
- /*cls(14,23,17,51,6|1);
- cls(13,22,16,50,yellow | red_back);*/
- cls(13,21,16,52,0);
- frame(13,20,16,50,0|75);
- print(13,51,6|1,"⌐┐");
- if (p->db[js1].flag[0]=='y'||p->db[js1].flag[0]=='Y')
- {
- print(13,22,0|75,"┤╦▓┘╫≈╜½╡╝╓┬╩²╛▌┐Γ╜ß╣╣╢¬╩º");
- print(14,22,0|75," ╚╖ ╨┼ ╖±(Y/N) ");
- i=getchb();
- while (i!='y'&&i!='Y'&&i!='n'&&i!='N') i=getchb();
- if (i=='y'||i=='Y')
- {
- strcat(path,pathname); strcat(path,"\\");
- strcat(path,p->db[js1].dbname); strcpy(delpath,path);
- strcat(path,".txt"); strcat(delpath,".dbf"); strcat(delpath," > oztom");
- strcat(path," > oztom");
- system(path); system(delpath);
- p->db[js1].flag[0]='N';
- YN_value(p->db[js1].dbname,p->db[js1].flag);
- }
- }
- else
- {
- print(13,22,0|75,"┤╦┐Γ▒╛└┤▓ó╬▐╜ß╣╣, ▓╗─▄╔╛│²");
- print(14,22,0|75,"Press any key to continue.");
- getchb();
- }
- cls(17,0,18,79,0|113);
- return(0);
- }
-
- field_read(string1,string2)
- char *string1,*string2;
- {
- struct FIELD {
- char field_name[11];
- char field_type;
- int field_len;
- int field_doc;
- struct FIELD *next,*last;
- };
- struct FIELD *head,*work,*nall;
- int handle;
- FILE *ft;
- char int_buff[5];
- char char_buff[33];
- int field_ctc=0;
- handle=_open(string1,O_RDONLY);
- lseek(handle,32,SEEK_SET);
- _read(handle,int_buff,2);
- nall=(struct FIELD *) malloc(sizeof(struct FIELD));
- nall->next=nall->last=NULL;
- head=work=nall;
- strcpy(char_buff,NULL);
- while (int_buff[0]!=0x0d)
- {
- work=nall; lseek(handle,(field_ctc+1)*32,SEEK_SET);
- strcpy(char_buff,NULL);
- _read(handle,char_buff,32);
- sscanf(char_buff,"%s",work->field_name);
- work->field_type=char_buff[11];
- work->field_len=char_buff[16];
- work->field_doc=char_buff[17];
- if (work->field_len<0) work->field_len=work->field_len+256;
- field_ctc++;
- nall=(struct FIELD *) malloc(sizeof(struct FIELD));
- nall->next=nall->last=NULL;
- work->next=nall;
- nall->last=work;
- _read(handle,int_buff,2);
- }
- work->next=NULL; nall->last=NULL; free(nall);
- work=head;
- ft=fopen(string2,"w");
- while (work!=NULL)
- {
- fprintf(ft,"#%s#,#%c#,%d,%d\n",work->field_name,work->field_type,\
- work->field_len,work->field_doc);
- work=work->next;
- }
- fclose(ft);
- }
-
- YN_value(string,value)
- char *string,*value;
- {
- int i;
- struct dbfile *dn;
- dn=dbfhead;
- for (;;)
- {
- for (i=0;i<dn->count;i++)
- if (strcmp(string,dn->db[i].dbname)==0) strcpy(dn->db[i].flag,value);
- dn=dn->next;
- if (dn==q->next);
- break;
- }
- return(0);
- }
- /*------------------------------------------------------------------------*/
- print(int row,int col,int attr,char *format,...)
- {
- va_list arg;
- char print_str[254],*string;
- va_start(arg,format);
- vsprintf(print_str,format,arg);
- string=print_str;
- _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;
- geninterrupt(0x10);
- ++_DL;
- _AH=(unsigned char)9;
- _AL=*((char *)_SI);
- _SI++;
- _BH=(unsigned char)0;
- _BL=(unsigned char)attr;
- geninterrupt(0x10);
- }
- }
-
- /*------------------------------------------------------------------------*/
- print1(int attr,char *format,...)
- {
- va_list arg;
- int row,col;
- char print_str[254],*string;
- va_start(arg,format);
- vsprintf(print_str,format,arg);
- string=print_str;
- _AH =(unsigned char)3;
- _BH =(unsigned char)0;
- geninterrupt(0x10);
- _DL++;
- _SI =(unsigned int) string;
- _CX=1;
- while(*((char *)_SI)){
- _AH=(unsigned char)2;
- _BH=(unsigned char)0;
- geninterrupt(0x10);
- ++_DL;
- _AH=(unsigned char)9;
- _AL=*((char *)_SI);
- _SI++;
- _BH=(unsigned char)0;
- _BL=(unsigned char)attr;
- geninterrupt(0x10);
- }
- }
-
- /*-----------------------------CLEAR SCREEN---------------------------------*/
- cls(S_X,S_Y,E_X,E_Y,attr)
- int S_X,S_Y,E_X,E_Y,attr;
- {
- _AH=(unsigned char)6;
- _AL=(unsigned char)0;
- _BH=(unsigned char)attr;
- _CH=(unsigned char)S_X;
- _CL=(unsigned char)S_Y;
- _DH=(unsigned char)E_X;
- _DL=(unsigned char)E_Y;
- geninterrupt(0x10);
- }
-
- read_string(string,length)
- char *string;
- int length;
- {
- char middstr[41];
- int ctc,charact;
- int x,y;
- for (ctc=0;ctc<20;ctc++) middstr[ctc]='\0';
- ctc=0;
- while (ctc<length-1)
- {
- charact=getchb();
- if (charact==13) break;
- if ((charact==8)&&(ctc>0)) {
- now_cursor(&x,&y);
- go_to(x+1,y); printf(" ");
- go_to(x+1,y); middstr[--ctc]='\0';
- continue;
- }
- if (charact<=30 || charact>=128) continue;
- printf("%c",charact);
- middstr[ctc++]=charact;
- }
- if (strcmp(middstr,NULL)!=0)
- strcpy(string,middstr);
- return(0);
- }
-
- getchb()
- {
- union REGS regs;
- int t,m;
- regs.x.ax=0;
- int86(0x16,®s,®s);
- t=regs.x.ax & 0x00ff;
- m=(regs.x.ax-t)/256;
- if (t!=0) return(t);
- return(m+200);
- }
- /*----------------------------CURSOR POSITION-------------------------------*/
- go_to(int row,int col)
- {
- _AH=(unsigned char)2;
- _BH=(unsigned char)0;
- _DH=(unsigned char)row-1;
- _DL=(unsigned char)col-1;
- geninterrupt(0x10);
- }
-
- now_cursor(int *row,int *col)
- {
- _AH=(unsigned char)3;
- _BH=(unsigned char)0;
- geninterrupt(0x10);
- *row=_DH;
- *col=_DL;
- }
-
- /*---------------------------------------------------------------------------------*/
- frame(s_r,s_c,e_r,e_c,attr)
- int s_r,s_c,e_r,e_c,attr;
- {
- int i,j;
- char line[80];
- union REGS r;
- r.h.ah=6;
- r.h.al=0;
- r.h.bh=attr;
- r.h.ch=s_r-1;
- r.h.cl=s_c-1;
- r.h.dh=e_r-1;
- r.h.dl=e_c-1;
- int86(0x10,&r,&r);
- strcpy(line,"⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ");
- print(s_r-1,s_c-1,attr,"⌐│");
- print(s_r-1,s_c+1,attr,"%-.*s",e_c-s_c-2,line);
- print(s_r-1,e_c-1,attr,"⌐╖");
- for(i=s_r+1;i<e_r;i++)
- {
- print(i-1,s_c-1,attr,"⌐º");
- print(i-1,e_c-1,attr,"⌐º");
- }
- print(e_r-1,s_c-1,attr,"⌐╗");
- print(e_r-1,s_c+1,attr,"%-.*s",e_c-s_c-2,line);
- print(e_r-1,e_c-1,attr,"⌐┐");
- }
-