FACT++  1.0
static void get_format_data ( int  format,
FORMAT_STR format_data,
char *  def 
)
static

Definition at line 1668 of file dic.c.

References FORMAT_STR::flags, IT_IS_FLOAT, NOSWAP, FORMAT_STR::par_bytes, FORMAT_STR::par_num, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_LONG, SIZEOF_SHORT, SWAPD, SWAPL, and SWAPS.

Referenced by handle_dns_info().

1669 {
1670  register FORMAT_STR *formatp = format_data;
1671  register char code, last_code = 0;
1672  int num;
1673  char *ptr = def;
1674 
1675  if(format){}
1676  while(*ptr)
1677  {
1678  switch(*ptr)
1679  {
1680  case 'i':
1681  case 'I':
1682  case 'l':
1683  case 'L':
1684  *ptr = 'I';
1685  break;
1686  case 'x':
1687  case 'X':
1688  *ptr = 'X';
1689  break;
1690  case 's':
1691  case 'S':
1692  *ptr = 'S';
1693  break;
1694  case 'f':
1695  case 'F':
1696  *ptr = 'F';
1697  break;
1698  case 'd':
1699  case 'D':
1700  *ptr = 'D';
1701  break;
1702  case 'c':
1703  case 'C':
1704  *ptr = 'C';
1705  break;
1706  }
1707  ptr++;
1708  }
1709  code = *def;
1710  while(*def)
1711  {
1712  if(code != last_code)
1713  {
1714  formatp->par_num = 0;
1715  formatp->flags = 0;
1716  switch(code)
1717  {
1718  case 'i':
1719  case 'I':
1720  case 'l':
1721  case 'L':
1722  formatp->par_bytes = SIZEOF_LONG;
1723  formatp->flags |= SWAPL;
1724  break;
1725  case 'x':
1726  case 'X':
1727  formatp->par_bytes = SIZEOF_DOUBLE;
1728  formatp->flags |= SWAPD;
1729  break;
1730  case 's':
1731  case 'S':
1732  formatp->par_bytes = SIZEOF_SHORT;
1733  formatp->flags |= SWAPS;
1734  break;
1735  case 'f':
1736  case 'F':
1737  formatp->par_bytes = SIZEOF_LONG;
1738  formatp->flags |= SWAPL;
1739 #ifdef vms
1740 /*
1741  if((format & 0xF0) != (MY_FORMAT & 0xF0))
1742 */
1743  formatp->flags |= (format & 0xF0);
1744  formatp->flags |= IT_IS_FLOAT;
1745 #endif
1746  break;
1747  case 'd':
1748  case 'D':
1749  formatp->par_bytes = SIZEOF_DOUBLE;
1750  formatp->flags |= SWAPD;
1751 #ifdef vms
1752 /*
1753  if((format & 0xF0) != (MY_FORMAT & 0xF0))
1754 */
1755  formatp->flags |= (format & 0xF0);
1756  formatp->flags |= IT_IS_FLOAT;
1757 #endif
1758  break;
1759  case 'c':
1760  case 'C':
1761  case 'b':
1762  case 'B':
1763  case 'v':
1764  case 'V':
1765  formatp->par_bytes = SIZEOF_CHAR;
1766  formatp->flags |= NOSWAP;
1767  break;
1768  }
1769  }
1770  def++;
1771  if(*def != ':')
1772  {
1773 /* tested by the server
1774  if(*def)
1775  {
1776  printf("Bad service definition parsing\n");
1777  fflush(stdout);
1778  }
1779  else
1780 */
1781  formatp->par_num = 0;
1782  }
1783  else
1784  {
1785  def++;
1786  sscanf(def,"%d",&num);
1787  formatp->par_num += num;
1788  while((*def != ';') && (*def != '\0'))
1789  def++;
1790  if(*def)
1791  def++;
1792  }
1793  last_code = code;
1794  code = *def;
1795  if(code != last_code)
1796  formatp++;
1797  }
1798  formatp->par_bytes = 0;
1799 /*
1800  if((format & 0xF) == (MY_FORMAT & 0xF))
1801  {
1802  for(i = 0, formatp = format_data; i<index;i++, formatp++)
1803  formatp->flags &= 0xF0;
1804  }
1805 */
1806 }
Definition: dim.h:191
short flags
Definition: dim.h:219
Definition: dim.h:191
Definition: dim.h:191
#define SIZEOF_CHAR
Definition: dim.h:596
short par_bytes
Definition: dim.h:218
#define SIZEOF_DOUBLE
Definition: dim.h:600
int par_num
Definition: dim.h:217
#define SIZEOF_LONG
Definition: dim.h:598
#define IT_IS_FLOAT
Definition: dim.h:27
#define SIZEOF_SHORT
Definition: dim.h:597
Definition: dim.h:191

+ Here is the caller graph for this function: