: c - - 2


, .

 

#define BTD 0

#define PTR 1

#define STRU 2

#define UNI 3

#define ARR 4

struct d_type

{

char name[20]; //

int size; //

int dim; //

int TYPE; //

d_type *child; // ( )

};

extern d_type TYPES[100];

// man

d_type XXX[]=

{name, 20, 20, ARR, &TYPES[0]}, // char name[20];

{addr, 2, 0, PTR, &TYPES[3]}, // char *addr;

{class, 2, 2, BTD, &TYPES[1]}; // int class;

 

d_type TYPES[100] =

//

{char, 1, 0, BTD, NULL},

{int, 2, 0, BTD, NULL},

{long, 4, 0, BTD, NULL},

// char*

{, 2, 0, PTR, &TYPES[0]},

// typedef char *PSTR

{PSTR, 2, 0, PTR &TYPES[0]},

// int [20];

{, 40, 20, ARR, &TYPES[1]},

// man

{man, 24, 3, STRU, &XXX};

 

, , , . , . , .

 

int GetSize(d_type *p)

{

switch (p->TYPE)

{

//

case BTD: return p->size;

//