home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a014 / 1.ddi / CDBINC.EXE / COMMM.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-08  |  18.8 KB  |  832 lines

  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include <alloc.h>
  4. #include<dos.h>
  5. #define pr(x)  fprintf(fp,x)
  6. #define  MAXP  10
  7. #define CONT 20
  8. #define CB 14
  9. #define VIDEO 0x10
  10. #define F1 15104
  11. typedef struct bb{
  12.          char MEAN[21],DB[9],KEY[4][11],COFLAG,COPATH[11];
  13.          int no;
  14.          struct bb *next;
  15.         }BASE;
  16. typedef struct cc {
  17.          char field[128][11],ftype[128];
  18.          int len1[128], point[128];
  19.                  int NN;
  20.          int no;
  21.          struct cc *next;
  22.            }CONTENT;
  23. typedef struct ll {
  24.             int  MAR[9][128];
  25.             int  no;
  26.             struct ll *next;
  27.             }LINK;
  28. extern LINK *flink;
  29. extern BASE *fbase;
  30. extern CONTENT *fcon;
  31. extern char *explain,PATH[30],lname[5][31],lnamebak[5][3][11];
  32. extern int NB,repeat,I,J,II,JJ,linkflag;
  33. int code;
  34. getbase()
  35. {  int i,j,row,col,ctcn;
  36.    char buff[80];
  37.    char sh[2],sh1[2]    ;
  38.    FILE *fp;
  39.    BASE *mybase;
  40.    CONTENT *mycon;
  41.    code=0;
  42.    strcpy(buff,PATH)    ;
  43.    strcpy( buff, "db.txt" )    ;
  44.    fp=fopen( buff, "r");
  45.    fbase = (BASE *)malloc(sizeof(BASE));
  46.    mybase = fbase;
  47.    mybase->next = NULL;
  48.    mybase->no = 0;
  49. /*   for(NB=0; !feof(fp); NB++)*/
  50.    for(NB=0;(fgets(buff,80,fp)!=NULL); NB++)
  51.      {  if(NB!=0)
  52.       {
  53.         mybase->next=(BASE*)malloc(sizeof(BASE));
  54.         mybase=mybase->next;
  55.         mybase->no=NB;
  56.         mybase->next=NULL;
  57.       }
  58.  
  59.     sscanf(buff,"#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#,#%[^#]#\n",
  60.            mybase->MEAN,mybase->KEY[0],mybase->KEY[1],
  61.            mybase->KEY[2],mybase->KEY[3],mybase->DB,sh, sh1,mybase->COPATH)    ;
  62.     mybase->COFLAG=sh1[0];
  63.     fflush(fp)    ;
  64.      }
  65.     fclose(fp);
  66.     }
  67.  
  68.  
  69.  
  70. getcontent(char *aarr,int *s)
  71. {  int i,j,k,wh,cu=0;
  72.    char name[30],buff[60];
  73.    FILE *fp;
  74.    CONTENT *mycon;
  75.    BASE *mybase;
  76.    for (wh=0;s[wh]!=0;wh++)
  77.       {
  78.      if(wh==0)
  79.       {
  80.          if((fcon=(CONTENT*)malloc(sizeof(CONTENT)))==NULL)  printf("memory if not enough");
  81.          mycon=fcon;
  82.          mycon->no=s[wh]-1;
  83.          mycon->next=NULL;
  84.          mybase=fbase;
  85.          while (mybase->no!=s[wh]-1) mybase=mybase->next;
  86.       }
  87.      else
  88.       {
  89.          if((mycon->next=(CONTENT*)malloc(sizeof(CONTENT)))==NULL) printf("=+++++++++++");
  90.          mycon=mycon->next;
  91.          mycon->next=NULL;
  92.          mycon->no=s[wh]-1;
  93.          mybase=fbase;
  94.          while (mybase->no!=s[wh]-1) mybase=mybase->next;
  95.       }
  96.      strcpy(name,aarr);
  97. /*     strcpy( name, "creat\\")    ;*/
  98.      strcat(name,mybase->DB);
  99.      strcat(name,".txt");
  100.      fp=fopen(name,"r");
  101.      for(i=0;(fgets(buff,60,fp)!=NULL) ; i++,cu++)
  102.      {
  103.           sscanf(buff,"#%[^#]#,#%c#,%d,%d\n",mycon->field[cu],&mycon->ftype[cu],&mycon->len1[cu],&mycon->point[cu])    ;
  104.           fflush(fp)    ;
  105.      }
  106.      mycon->NN = cu    ;
  107.      fclose(fp);
  108.      cu=0;
  109.       }
  110. }
  111.  
  112.  
  113.  
  114.  /* ╩Σ╚δ┐Γ╓«╝Σ┴¼╜╙┬╖╛╢*/
  115. getroad(aarr,s,l)
  116. char *aarr;
  117. int *s,l;
  118. {  int i,n,x,y,nn,col,j,cir,ii;
  119.    FILE *codef;
  120.    clear_win(0,0,24,79,0x70)    ;
  121.    II=0;
  122.    cursor(15,10);
  123.    printf("╟δ╢¿╥σ╡┌ %d ╕÷▓┘╫≈┐Γ",l+1);
  124.    clear_win(18,20,22,62,0)    ;
  125.    clear_win(17,18,21,60,30)    ;
  126.    color_puts("╟δ╩Σ╚δ┐Γ╡─┤·║┼(0╘≥▒φ╩╛╜ß╩°╤í╘±) : ",0|226,18,22)    ;
  127.    chpage(0);
  128.    i=0;
  129. L:   if ((n=get((long) II,(long)JJ,20,24))!=0)
  130.      {  if (n=='H')
  131.       {  help1();
  132.          while ((n=get((long)II,(long)JJ,20,24))=='H')
  133.            {
  134.          help1();
  135.         }
  136.          if (n==0) return(0); }
  137.     if (n=='U'||n=='D'||n=='u'||n=='d')
  138.        {
  139.           chpage(n);
  140.           goto L;
  141.         }
  142.     nn=n%CB;
  143.      if(nn==0)
  144.        nn=CB;
  145.     y=((nn-1)%2)*35+6;
  146.     x=(nn-1)/2+5;
  147.     cursor(x,y);
  148.     printf("*");
  149.     s[i]=n;
  150.     i++;
  151.     cursor(20,25);
  152.     printf("_");
  153.     col=26;
  154.     while ((n=get((long)II,(long)JJ,20,col))!=0)
  155.       {  if (n=='H')  {  help1();
  156.                  continue;  }
  157.              if (n=='U'||n=='D')
  158.        {
  159.           chpage(n);
  160.           continue;
  161.         }
  162.          for (j=0;j<i;j++)
  163.            if (s[j]==n) {  cir=1;
  164.                    break;
  165.                 }
  166.            else cir=0;
  167.          if (cir)  {
  168.               color_puts("▓╗─▄│÷╧╓╓╪╕┤╤í╘±╣╣│╔╗╪┬╖! ╟δ╘┘┤╬╩Σ╚δ",12,24,45);
  169.               dela();
  170.               color_puts("                                    ",0|75,24,45);
  171.               continue;
  172.                }
  173.          if (n!=0)
  174.            {  nn=n%CB;
  175.           if(nn==0)
  176.             nn=CB;
  177.           y=((nn-1)%2)*35+6;
  178.           x=(nn-1)/2+5;
  179.           cursor(20,++col);
  180.           printf("_");
  181.           cursor(x,y);
  182.           printf("*");
  183.           cursor(20,++col);
  184.           s[i]=n;
  185.           i++;
  186.            }
  187.       }
  188.     s[i]=0;
  189.     getcontent(aarr,s);
  190.     if (i==1) return(i);
  191.     clear_win(15,36,19,72,0)    ;
  192.     clear_win(14,34,18,70,0|53)    ;
  193.     color_puts("╤í╘±╢α┐Γ┴¬╜╙╖╜╩╜",0|53,15,44);
  194.     n=selete("┤«╨═", "╨╟╨═",17,43,56,0|53);
  195.     linkflag=((n==1)?1:0);
  196.     if ((codef=fopen("code.dbf","r"))!=NULL)
  197.        {
  198.        color_puts("╩╟ ╖± ╥¬ ┤· ┬δ ▓┘ ╫≈",0|53,15,42);
  199.        n=selete("Yes ", "No  ",17,43,56,0|53)    ;
  200.        if (n==1) code=1;
  201.        }
  202.     fclose(codef);
  203.     return(i);
  204.      }
  205.    else
  206.      return(0);
  207. }
  208.  
  209.  
  210. disp()
  211. {  int i,x,y,n;
  212.    BASE *mybase;
  213.    color_puts(explain,56,0,0);
  214.    color_puts("  F1-Help  Esc-Exit  ╗╪│╡: ═╦│÷▒╛─ú┐Θ                                           ",0|75,24,0);
  215.    color_puts("----  ▒╛╧╡═│╓╨╡─╚½▓┐╩²╛▌┐Γ╚τ╧┬  ----",0|113,2,22)    ;
  216.    gframe(4,2,12,75,0,0|226);
  217.    x=5;
  218.    y=7;
  219.    n=0;
  220.    mybase=fbase;
  221.    while (mybase->no!=II)
  222.      mybase=mybase->next;
  223.    for (i=II;i<NB&&n<CB;i++)
  224.       {  cursor(x,y);
  225.      printf("\033[1;33;44m%2d. %-10s",i+1,mybase->MEAN);
  226.      printf("\033[0;0;0m")    ;
  227.      y+=35;
  228.      if (y>60)
  229.        {  x++;
  230.           y=7;
  231.        }
  232.      mybase=mybase->next;
  233.      n++;
  234.       }
  235. }
  236.  
  237.  
  238.  
  239. disp_base(ch)
  240. int ch;
  241. {  int row,col,i,n;
  242.    BASE *mybase;
  243.    CONTENT *mycon;
  244.    mybase=fbase;
  245.    mycon=fcon;
  246. /*   for(i=0;i<NB;i++)
  247.      {
  248.     if(i!=0)
  249.      {
  250.        mybase=mybase->next;
  251.        mycon=mycon->next;
  252.      }
  253.     if(mybase->no==(ch-1))
  254.      break;
  255.      }  */
  256.    while (mybase->no!=ch-1) mybase=mybase->next;
  257.    while (mycon->no!=ch-1) mycon=mycon->next;
  258.    color_puts(" ",43,0,1);
  259.    ch=ch-1;
  260.    cursor(1,16);
  261.    printf("\033[0;0;7m-----  ┐Γ # %s # ╓╨║¼╙╨╥╘╧┬╫╓╢╬  ----",mybase->MEAN);
  262.    gframe(3,2,11,75,0,0|226);
  263.    row=5;
  264.    col=5;
  265.    n=1;
  266.    for (i=I;i<mycon->NN&&row<10;i++)
  267.       {  cursor(row,col);
  268.      printf("\033[1;33;44m%2d. %-s",n+I,mycon->field[i]);
  269.      col+=17;
  270.      n++;
  271.      if (col>60)
  272.        {  row++;
  273.           col=5;
  274.        }
  275.       }
  276. }
  277.  
  278.  
  279.  
  280.  
  281. cmp(char *str,int aa)
  282. {  int i,bb;
  283.    CONTENT *meycon;
  284.    meycon=fcon;
  285.    while(meycon->no!=aa)
  286.     meycon=meycon->next;
  287.    bb=meycon->NN;
  288.    for (i=0;i<bb;i++)
  289.       if (strcmp(str,meycon->field[i])==0)  return(i);
  290.    return(-1);
  291. }
  292.  
  293.  
  294.  
  295.  
  296. deflink(s,dname,whmy)
  297. int *s;
  298. char *whmy;
  299. char dname[];
  300. {  int i,c,n,ctcn,ct;
  301.    FILE *whfp;
  302.    CONTENT *midcon,*mycon;
  303.    BASE *mybase;
  304.    char middst[41];
  305.    repeat=1; ct=0;
  306.    color_puts("╢¿╥σ┴¼╜╙┐Γ╡─╩╢▒≡├√(╫ε╢α20╕÷╫╓╖√): ",0|53,15,36)    ;
  307.    color_puts("                         ",0|53,17,40)    ;
  308.    cursor( 17, 43 )    ;
  309.    scanf("%s",dname);
  310. /**   gets(dname);**/
  311.    clear_win(0,0,24,79,0x70)    ;
  312.    for (i=0;i<5;i++) {strcpy(lname[i],NULL); lname[i][0]='\0';}
  313.    I=0;
  314.    i=1;ctcn=0;
  315.    while (s[i]!=0)
  316.      {
  317.      judge(0,s[ctcn]);
  318.      while (s[i]!=0) {
  319.      cursor(16,15);
  320.      clear_win(18,20,22,60,0)    ;
  321.      clear_win(17,18,21,58,30)    ;
  322.      color_puts("╟δ╚╖╢¿╦∙╢¿╥σ╡─┴¼╜╙┐Γ╡─┴¼╜╙╫╓╢╬ : ",0|226,18,22)    ;
  323.      color_puts("╫ó╥Γ: ┴¼╜╙╫╓╢╬▒╪╨δ─▄╬¿╥╗╡╪╩╢▒≡╥╗╕÷╝╟┬╝!",12,15,10)    ;
  324.      color_puts(" ╓╗╨Φ╝ⁿ╚δ╫╓╢╬╡─┤·║┼                                                                   ",0|75,24,0)    ;
  325.      c=get((long)I,(long)J,20,34);
  326.      if (c=='U'||c=='D')
  327.        {  judge(c,s[ctcn]);
  328.           continue;
  329.        }
  330.      if (c==0)
  331.         {
  332.         if (lname[i-1][0]=='\0')  continue;
  333.         else break;
  334.         }
  335.      mycon=fcon;
  336.      while(mycon->no!=(s[ctcn]-1))
  337.       mycon=mycon->next;
  338.      midcon=mycon;
  339.      if (s[i]!=0)
  340.        {   n=s[i]-1;
  341.            mybase=fbase;
  342.            while(mybase->no!=n)
  343.          mybase=mybase->next;
  344.            strcpy(middst,mycon->field[c-1]);
  345.            if (cmp(mycon->field[c-1],n)<0)
  346.          {  cursor(20,10);
  347.             printf("%s ▓╗┤µ╘┌ # %s # ╫╓╢╬, ╬▐╖¿┴¼╜╙. ╟δ╓╪╨┬╤í╘±┴¼╜╙╫╓╢╬",mybase->MEAN,midcon->field[c-1]);
  348.             dela();
  349.             cursor(20,10);
  350.             printf("                                                                       ");
  351.             continue;
  352.          }
  353.            else {
  354.             if (lname[i-1][0]!='\0') strcat(lname[i-1],"+");
  355.             if (mycon->ftype[c-1]=='D')
  356.                {
  357.                strcpy(middst,NULL); strcat(middst,"DTOC(");
  358.                strcat(middst,mycon->field[c-1]); strcat(middst,")");
  359.                }
  360.             if (mycon->ftype[c-1]=='N')
  361.                {
  362.                strcpy(middst,NULL); strcat(middst,"STR(");
  363.                strcat(middst,mycon->field[c-1]); strcat(middst,",");
  364.                strcat(middst,"19");strcat(middst,")");
  365.                }
  366.             if (mycon->ftype[c-1]=='C')
  367.                strcpy(middst,mycon->field[c-1]);
  368.            if (lname[i-1][0]!='\0')  strcat(lname[i-1],middst);
  369.             else strcpy(lname[i-1],middst);
  370.             }
  371.        }
  372.     }
  373.      if (linkflag==1) i++;
  374.      else {ctcn++;i++;}
  375.      ct=0;
  376.      }
  377. /*     strcpy(middst,PATH);*/
  378.      strcpy(middst,whmy);
  379.      strcat(middst,"ndx.txt");
  380.      whfp=fopen(middst,"a");
  381.      for (i=1;s[i]!=0;i++)
  382.     {   n=s[i]-1;
  383.         mybase=fbase;
  384.         while(mybase->no!=n)
  385.         mybase=mybase->next;
  386.         fprintf(whfp,"#%s#,#%s#,##,0,0\n",mybase->DB,lname[i-1]);
  387.     }
  388.      fclose(whfp);
  389. }
  390.  
  391.  
  392.  
  393. sele_disp(int *s,int l)
  394. {  int i,k,m,n,t,c,x,y;
  395.    BASE *mybase,*midbase;
  396.    CONTENT *mycon;
  397.    LINK *mylink;
  398.    mylink=flink;
  399.    while (mylink->no!=l)
  400.      mylink=mylink->next;
  401.    clear_win(0,0,24,79,0)    ;
  402.    color_puts(explain,14,0,1);
  403.    color_puts("       *** ╧┬├µ╟δ╢¿╥σ╜ß╣√╧╘╩╛╧ε ***",11,6,15);
  404.    color_puts("    ─·╓╗╨Φ┤╙▒╗┴¼╜╙╡─╕≈╕÷┐Γ╓╨╖╓▒≡╤í╘±╚⌠╕╔╫╓╢╬╝┤┐╔.",11,8,12)    ;
  405.    color_puts("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",14,4,10);
  406.    cursor(11,20);
  407.    printf("╙╔ ╧┬ ┴╨ ┐Γ ┴¼ ╜╙ ╫Θ │╔:");
  408.    cursor(13,20);
  409.    i=1;
  410.    midbase=fbase;
  411.    while(midbase->no!=(s[0]-1))
  412.      midbase=midbase->next;
  413.    printf("%s",midbase->DB);
  414.    while(s[i]!=0)
  415.    { midbase=fbase;
  416.      while(midbase->no!=(s[i]-1))
  417.        midbase=midbase->next;
  418.      i++;
  419.      printf("->%s",midbase->DB);
  420.    }
  421.   color_puts("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",14,15,10);
  422.   color_puts("    ░┤ ╚╬ ╥Γ ╝ⁿ......     ",0|48,17,25);
  423.    bioskey(0);
  424.    i=0;
  425.    clear_win(0,0,24,79,0x70)    ;
  426.    while (s[i]!=0)
  427.      {     n=s[i]-1;
  428.      mybase=fbase;
  429.      mycon=fcon;
  430.      while(mybase->no!=n) mybase=mybase->next;
  431.      while(mycon->no!=n) mycon=mycon->next;
  432. /*      {
  433.        mybase=mybase->next;
  434.        mycon=mycon->next;
  435.       }*/
  436.      I=0;
  437.      judge(0,s[i]);
  438.     clear_win(15,16,19,52,0)    ;
  439.     clear_win(14,14,18,50,0|53)    ;
  440.     color_puts("╟δ╩Σ╚δ╧╘╩╛╖╜╩╜",0|53,15,24);
  441.     c=selete("╚½▓┐╧╘╩╛", "▓┐╖╓╧╘╩╛",17,23,36,0|53);
  442.      if (c==1) for (t=0;t<mycon->NN;t++) mylink->MAR[n][t]=1;
  443.     else
  444.       {
  445.           clear_win(17,42,21,63,0)    ;
  446.           clear_win(16,40,20,61,0x10)    ;
  447.           color_puts("╨Φ╥¬╧╘╩╛╡─╫╓╢╬╙╨ ",286,17,43);
  448.           while ((c=get((long)I,(long)J,19,50))!=0)
  449.         {
  450.             if (c=='U'||c=='D')
  451.               {  judge(c,s[i]);
  452.              continue;
  453.               }
  454.             mark(c);
  455.             mylink->MAR[n][c-1]=1;
  456.         }
  457.        }
  458.      clear_win(16,10,23,65,0x70)    ;
  459.      i++;
  460.      }
  461. }
  462.  
  463.  
  464. in_c(s,i)
  465. int *s,*i;
  466. {  int n=0;
  467.    if (s[1]!=0)
  468.     color_puts("╟δ╤í╘±╠⌡╝■╫╓╢╬ (╝ⁿ╚δíⁿ/í²╤í╘±▓┘╫≈┐Γ) :",10,24,10);
  469.    else
  470.     color_puts("╟δ╤í╘±╠⌡╝■╫╓╢╬ :",10,24,20);
  471.    while (n==0)
  472.      {  if (s[1]!=0)
  473.       {  while ((n=get((long)I,(long)J,24,50))!=0)
  474.            {  if (n=='u'||n=='d')
  475.             {  if (n=='u'&&*i>0)  (*i)--;
  476.                else if (s[*i+1]!=0)  (*i)++;
  477.                I=0;
  478.                judge(0,s[*i]);
  479.             }
  480.           else  if (n=='U'||n=='D')
  481.               {  judge(n,s[*i]);
  482.                  continue;
  483.               }
  484.             else break;
  485.            }
  486.       }
  487.     else
  488.       {  n=get((long) I,(long)J,24,38);
  489.          if (n=='U'||n=='D')
  490.            {  judge(n,s[*i]);
  491.           n=0;
  492.           continue;
  493.            }
  494.       }
  495.     if (n==0) error();
  496.      }
  497.    return(n);
  498. }
  499.  
  500.  
  501.  
  502. help1()
  503. {  char c;
  504.    int i;
  505.    char *temp    ;
  506.    unsigned int  row=12, col=13    ;
  507.  
  508.    temp = ( char * ) malloc(sizeof( char )*1152)    ;
  509.    now_cursor( &row, &col )    ;
  510.    video_save( 6, 11, 77, 18, temp )    ;
  511.    color_puts("⌐│⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐╖",15,11,6)    ;
  512.    color_puts("⌐º    ─·┐╔╤í╘±╔╧╩÷┐Γ, ╜°╨╨╡Ñ┐Γ╗≥╢α┐Γ▓┘╫≈. ╚⌠╥¬╔·│╔╢╘╢α┐Γ▓┘╫≈, ╘≥╕≈┐Γ╝Σ⌐º",15,12,6)    ;
  513.    color_puts("⌐º▒╪╨δ╙╨╧α═¼╫╓╢╬, ╟╥╧α═¼╫╓╢╬╘┌▒╗┴¼╜╙┐Γ╓╨╙ª╩╟╣╪╝ⁿ╫╓.                   ⌐º",15,13,6)    ;
  514.    color_puts("⌐º    ╘┌╤í┐Γ╩▒, ╚τ╣√─·╓╗╤í╘±┴╦╥╗╕÷┐Γ, ╘≥▒φ╩╛╢╘╡Ñ┐Γ▓┘╫≈; ╚τ╣√─·╤í╘±┴╦┴╜⌐º",15,14,6)    ;
  515.    color_puts("⌐º╕÷╥╘╔╧╡─┐Γ, ╘≥▒φ╩╛╢╘╢α┐Γ▓┘╫≈, ╧╡═│╜½╫╘╢»╕∙╛▌─·╤í╘±╡─╦│╨≥░╤╕≈┐Γ┴¼╜╙╞≡⌐º",15,15,6)    ;
  516.    color_puts("⌐º└┤.                                                                 ⌐º",15,16,6)    ;
  517.    color_puts("⌐º                    ╫ó╥Γ : ┐╔┴¼╜╙╡─┐Γ╫ε╢α─▄╙╨6╕÷                    ⌐º",15,17,6)    ;
  518.    color_puts("⌐╗⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐Ñ⌐┐",15,18,6)    ;
  519. /*   movcur();*/
  520.    bioskey(0);
  521.    video_restore( 6, 11, 77, 18, temp )    ;
  522. /*   clear_win(11,0,18,79,0x70)    ;
  523.    setcur();                     */
  524.  
  525.    cursor( row, col )    ;
  526. }
  527. /*╠⌡╝■▓┘╫≈╣½╙├╫╙│╠╨≥*/
  528.  
  529.  
  530.  
  531.  
  532.  
  533. dela()
  534. {  int i,j;
  535.    for (i=0;i<10;i++)
  536.       for (j=-30000;j<30000;j++) ;
  537. }
  538.  
  539.  
  540.  
  541. getcc()
  542. {  union REGS r;
  543.    r.h.ah=0;
  544.    int86(0x16,&r,&r);
  545.    if (r.h.al==27) exit(0);
  546.    if (r.h.al) return(r.h.al);
  547.    return(r.x.ax);
  548. }
  549.  
  550.  
  551.  
  552. get(i,j,row,col)
  553. long i,j    ;
  554. int row,col;
  555. {  int key,c    ;
  556.    long n=0;
  557.    color_puts("   ",30,row,col);
  558.    cursor(row,col);
  559.    while ((key=getcc())!=0x0D)
  560.      {
  561.     switch (key)
  562.       {  case 18432 : return('u');
  563.          case 18688 : return('U');
  564.          case 20480 : return('d');
  565.          case 20736 : return('D');
  566.          case 15104 : return('H');
  567.          case    8  : if (n!=0) n=n/10;
  568.               else  {  error();  cursor(row,col);  }
  569.               break;
  570.          default    : if( key <= '9' && key >= '0')
  571.                 printf("\033[1;33;44m%c",key)    ;
  572.               n=10*n+key%256-'0';
  573.               break;
  574.       }
  575.      }
  576.    if ((n>j||n<=i)&&n!=0) {  error();
  577.                  get((long)i,(long)j,row,col);
  578.               }
  579.    else return(n);
  580.    }
  581.  
  582.  
  583.  
  584.  
  585. cursor(int y, int x)
  586. {
  587.   _DH = (unsigned char)y    ;
  588.   _DL = (unsigned char)x    ;
  589.   _AH = (unsigned char)2    ;
  590.   _BH = (unsigned char)0    ;
  591.   geninterrupt(0x10)    ;
  592. }
  593.  
  594. color_puts(char *string, int  color, int row, int col)
  595. {
  596.   _SI = (unsigned int) string    ;
  597.   _DH = (unsigned char) row    ;
  598.   _DL = (unsigned char) col    ;
  599.   _CX = 1    ;
  600.   while(*(( char * ) _SI))
  601.    {
  602.      _AH = (unsigned char) 2    ;
  603.      _BH = (unsigned char) 0    ;
  604.      __int__(0x10)    ;
  605.      ++_DL    ;
  606.  
  607.      _AH = (unsigned char) 9    ;
  608.      _AL = *((char *)_SI)    ;
  609.      _SI++    ;
  610.      _BH = (unsigned char) 0    ;
  611.      _BL = (unsigned char) color    ;
  612.      __int__(0x10)    ;
  613.    }
  614. }
  615.  
  616.  
  617. clear_win(startrow,startcol,endrow,endcol,attribe)
  618. int startrow,startcol;
  619. int endrow,endcol;
  620. int attribe;
  621. {
  622.   _AH = (unsigned char) 6    ;
  623.   _AL = (unsigned char) 0    ;
  624.   _BH = (unsigned char) attribe    ;
  625.   _CH = (unsigned char) startrow    ;
  626.   _CL = (unsigned char) startcol    ;
  627.   _DH = (unsigned char) endrow    ;
  628.   _DL = (unsigned char) endcol    ;
  629.   geninterrupt(0x10)    ;
  630. }
  631.  
  632.  
  633. now_cursor(unsigned int *row, unsigned int *col )
  634. {
  635.     _AH = (unsigned char) 3    ;
  636.     _BH = (unsigned char) 0    ;
  637.     geninterrupt( 0x10 )    ;
  638.     *row = _DH    ;
  639.     *col = _DL    ;
  640. }
  641.  
  642.  
  643.  
  644. judge(c,n)
  645. int n,c;
  646. {
  647.    BASE *mybase;
  648.    CONTENT *mycon;
  649.  
  650.    if (c=='U') I-=CONT;
  651.    if (c=='D') I+=CONT;
  652.    if (I<0) I=0;
  653.    mycon=fcon;
  654.    while(mycon->no!=(n-1))
  655.      mycon=mycon->next;
  656.    if (I>mycon->NN) I-=CONT;
  657.    disp_base(n);
  658.    J=I+CONT;
  659.    if (J>mycon->NN) J=mycon->NN;
  660. }
  661.  
  662. mark( int n )
  663. {  int x,y;
  664.    x=(n-I-1)/4+5;
  665.    y=(n-1)%4*16+3+n%4+(n%4==0?4:0);
  666.    cursor(x,y);
  667.    printf("*")    ;
  668. }
  669.  
  670. movcur()
  671. {  union REGS regs;
  672.    regs.h.ah=19;
  673.    regs.h.al=0;
  674.    int86(0x10,®s,®s);
  675. }
  676.  
  677.  
  678.  
  679.  
  680. setcur()
  681. {  union REGS regs;
  682.    regs.h.ah=19;
  683.    regs.h.al=1;
  684.    int86(0x10,®s,®s);
  685. }
  686.  
  687.  
  688.  
  689. error()
  690. {  color_puts("###### ╩Σ╚δ┤φ╬≤! ╟δ╓╪╨┬╘┘╩Σ ######",12,24,46);
  691.    dela();
  692.    color_puts("                                   ",0|75,24,46);
  693. }
  694.  
  695.  
  696. chpage(int c)
  697. {
  698.   if (c=='U') II-=CB;
  699.   if (c=='D') II+=CB;
  700.   if (II<0) II=0;
  701.   if (II>NB) II-=CB;
  702.   disp();
  703.   JJ=II+CB;
  704.   if (JJ>NB) JJ=NB;
  705.  }
  706.  
  707. /*=========================gframe============================*/
  708. gframe(startx,starty,endx,endy,sss,color)
  709. int startx,starty;
  710. int endx,endy;
  711. int sss;
  712. int color;
  713. {
  714. static char dd[3][6][3]={
  715.       "⌐Ñ","⌐º","⌐│","⌐╖","⌐╗","⌐┐",
  716.       "⌐ñ","⌐ª","⌐░","⌐┤","⌐╕","⌐╝" ,
  717.       "  ","  ","  ","  ","  ","  "
  718.                      };
  719. int row,col;
  720. char *s;
  721. clear_win(startx+1,starty+2,endx+1,endy+2,0)    ;
  722. clear_win(startx,starty,endx,endy,0x10)    ;
  723. color_puts(dd[sss][2],color,startx,starty);
  724. for(col=starty+2; col<endy-2; col+=2)
  725.        color_puts(dd[sss][0],color,startx,col);
  726. color_puts(dd[sss][3],color,startx,endy-1);
  727.  
  728. for(row=startx+1; row<endx; ++row)
  729.  {
  730.    color_puts(dd[sss][1],color,row,starty);
  731.    color_puts(dd[sss][1],color,row,endy-1);
  732.    cursor(row,starty+2);
  733.   }
  734.  color_puts(dd[sss][4],color,endx,starty);
  735.  
  736.   for(col=starty+2; col<endy-2; ++col,++col)
  737.        color_puts(dd[sss][0],color,endx,col);
  738.   color_puts(dd[sss][5],color,endx,endy-1);
  739.    return;
  740. }
  741.  
  742.  
  743. /* --- selete a choice from  two term ----------    */
  744. /*       if selete a return 1                */
  745. /*       else return 2                                  */
  746. /*-----------------------------------------------    */
  747. selete(char *a, char *b, int row, int acol, int bcol, char color)
  748. {
  749.   int in,bb=1    ;
  750.  
  751.   color_puts(a,0|15,row,acol)    ;
  752.   color_puts(b,color,row,bcol)    ;
  753.   for(;;)
  754. {
  755.   in=getcc()    ;
  756.   switch(in)
  757.    {
  758.      case 19712 :
  759.           color_puts(a,color,row,acol)    ;
  760.           color_puts(b,0|15,row,bcol)    ;
  761.           bb=2;
  762.           continue;
  763.      case 19200 :
  764.           color_puts(a,0|15,row,acol)    ;
  765.           color_puts(b,color,row,bcol)    ;
  766.           bb=1    ;
  767.           continue;
  768.      case F1 :    help1()    ;
  769.           continue    ;
  770.      case 13 :
  771.           return(bb);
  772.    }
  773.   }
  774. }
  775.  
  776. video_save( startx, starty, endx, endy, destin )
  777.     int  startx, starty, endx, endy;
  778.     char *destin;
  779. {
  780.     union REGS r;
  781.     register int i, j;
  782.  
  783. /*    win( 1, 1, 80, 25 );*/
  784.     for ( j = starty ; j <= endy ; j++ )
  785.       for ( i = startx ; i <= endx ; i++ )  {
  786.         cursor( j, i )    ;
  787.         r.h.ah = 8; /* read character & attribute from screen */
  788.         r.h.bh = 0;  /* page 0 */
  789.         int86( VIDEO, &r, &r );
  790.         *destin++ = r.h.al;
  791.         *destin++ = r.h.ah;
  792.       }
  793. /*    win( startx, starty, endx, endy );*/
  794. }
  795.  
  796. /*--------------------------------------------------
  797.    Function : restore screen area from buffer source.
  798.    Variable :
  799.        startx, starty, endx, endy: screen area.
  800.        source : pointer to buffer.
  801.    ----------------------------------------------*/
  802. video_restore( startx, starty, endx, endy, source )
  803.     int  startx, starty, endx, endy;
  804.     char *source;
  805. {
  806.     register int i, j;
  807.     union REGS r;
  808.  
  809. /*    win( 1, 1, 80, 25 );*/
  810.     for ( j = starty ; j <= endy ; j++ )
  811.     for ( i = startx ; i <= endx ; i++ ) {
  812.           cursor( j, i )    ;
  813.           r.h.ah = 9;
  814.           r.h.bh = 0;
  815.           r.x.cx = 1;
  816.           r.h.al = *source++;
  817.           r.h.bl = *source++;
  818.           int86( VIDEO, &r, &r );
  819.     }
  820. /*    win( startx, starty, endx, endy );*/
  821. }
  822.  
  823. /*win( startx, starty, endx, endy )
  824.   int startx, starty;
  825.   int endx, endy;
  826. {
  827.   S_X = startx;
  828.   S_Y = starty;
  829.   E_X = endx;
  830.   E_Y = endy;
  831. }
  832.   */