
  㦭 ᮧ 㭪,  ࠢ  䠩 
뢥 १ ࠢ  ࠭.

 뢮   ࠭  ଠ樨        襬
⠪ 㭪:

char*	FieldInfo(struct DBF *d, int i);

 室  । 㪠⥫   , 뢠 DBF 䠩
   .   室 砥  㪠⥫   ப, ᮤঠ
, ⨯  ࠧ .

char*
FieldInfo(struct DBF *d, int i)
{
 static char	ret[48];	//頥 ப
 char c;

 c=d->fld[i].type;

  //஢塞      ஡      ᨬ 
  //⮣  뢮 ⥬      ⮤. 㭪  GetTypeName
  //頥 ᨬ쭮  .

 if ( (( c=='N' || c== 'F') && d->fld[i].high_len!=0) ||
      (  c=='D' && d->fld[i].low_len==8) )
    wsprintf(ret,
 	"%-11s %-11s %5d %2d",
 	d->fld[i].name,
 	GetTypeName(d, i),
 	d->fld[i].high_len,
 	d->fld[i].low_len
 	);
 else
 {
    wsprintf(ret,
 	"%-11s %-11s %5d   ",
 	d->fld[i].name,
 	GetTypeName(d, i),
 	d->fld[i].high_len
 	);
 }
 return ret;	//頥 㪠⥫  ப
}

  ⮬  ⮣,                ,  
ᯮ    ⮬   浪,  ⠪   㭪,
।  稥         㣮     
⮯.

int	field_exist(struct DBF* t1, int i, struct DBF* t2, int *j);

 室 㭪 ਭ:
	t1 - 㪠   
	i  -    ࢮ 
	t2 - 㪠   
	j  - 㪠⥫     ன 

頥 祭:
0 - ᫨   
1 - ᫨  ,  ⫨砥 ⨯
2 - ᫨  , ⨯  ,  ࠧ 
3 - ᫨  , ⨯  ,   , 
     ᬥ饭  砫  㣮
4 - ᫨     ࠬ ᮢ

     ᠬ   ᥡ  祣   ,   ᫥騥
᫮ 祭,   ᯮ짮  뢮:

char	*cmp[]= {
	"--",	//0
	"<>",	//1
	"~=",	//2
	"= ",	//3
	"=="	//4
	};


 ⮬ 襮ᠭ  㭪 㤥 룫拉 ⠪:

int
field_exist(struct DBF* t1, int i, struct DBF* t2, int *j)
{
 int	k;
 int	ret=0;
 
 for(k=0;k<fieldcount(t2);k++)
  if (!stricmp(t1->fld[i].name, t2->fld[k].name))	//
   {
     *j=k;	//   ன 
     ++ret;
     if (t1->fld[i].type == t2->fld[k].type)		//⨯
      {
        ++ret;
        if (t1->fld[i].all_len == t2->fld[k].all_len)	//
         {
	  ++ret;
          if (t1->fld[i].offset == t2->fld[k].offset) ++ret;	//ᬥ饭
         }
      }
     break; 
   }
      
 return ret;
}


  㭪 ࠢ :

void
CmpStruct()
{
 int	i, j;
 int	ret;
 int	bad=0;	//᫨  饥  ⠭  1

 for(i=0;i<fieldcount(d1);i++)			//  ࢮ 
 {
  switch (ret=field_exist(d1, i, d2, &j))	//஢塞 稥 
  {
	case 4:					//᫨  
	case 3:					//뢮
	case 2:					//ଠ
	case 1:					// 
		printf("%-32s", FieldInfo(d1,i));
		printf("  |%2s| ", cmp[ret]);
		printf("%-32s", FieldInfo(d2,j));
		break;
	default:				  //᫨  
		printf("%-30s", FieldInfo(d1,i)); //뢮 ଠ
		printf("  |%2s| ", cmp[0]);	  //⮫쪮    
		printf("%-30s", "-");
		bad=1;				//뫮 ᮢ襥 ...
  }
  printf("\n");
 }
 
 //᫨   ࢮ     뫨 ᮢ訥 
 // 뢥  ᠬ ᮢ訥   ன 
 
 if (fieldcount(d1)<fieldcount(d2) || bad)
 {
  for(i=0;i<fieldcount(d2);i++)
  {
   if (!field_exist(d2, i, d1, &j))
     {
	printf("%-32s", "-");
	printf("  |%2s| ", cmp[0]);
	printf("%-32s", FieldInfo(d2,i));
	printf("\n");
     }
  }
 }

}

  ,  ࠭ 砥 - ⨯:

POINT       Numeric         5  2  |==| POINT       Numeric         5  2
BIRTHDAY    Date            8     |= | BIRTHDAY    Date            8
FIO         Character      20     |= | FIO         Character      20
HOME        Character      18     |~=| HOME        Character      20
WORK        Character      25     |= | WORK        Character      25
NUM         Character       4     |<>| NUM         Numeric         4  0
LEFT        Numeric         5  0  |--| -
