FACT++  1.0
void did_prepare_command ( char *  str)

Definition at line 1964 of file did.c.

References Curr_service_format, Curr_service_name, dic_cmnd_service(), did_read_string(), Memory::free(), get_type_size(), Memory::malloc(), size, str, and type.

Referenced by ok_pop_up().

1965 {
1966 char type;
1967 int num;
1968 int size, full_size = 0;
1969 char *ptr;
1970 static int last_size = 0;
1971 static void *last_buffer = 0;
1972 void *buffer_ptr;
1973 char *str_ptr;
1974 void did_read_string(char, int, void **, char **);
1975 
1976  str_ptr = str;
1977  ptr = Curr_service_format;
1978  while(*ptr)
1979  {
1980  type = *ptr++;
1981  if(*ptr == ':')
1982  {
1983  ptr++;
1984  size = get_type_size(type);
1985  sscanf(ptr, "%d", &num);
1986  full_size += size * num;
1987  if( (ptr = strchr(ptr,';')) )
1988  ptr++;
1989  else
1990  break;
1991  }
1992  }
1993 
1994  full_size += 256;
1995  if(full_size > last_size)
1996  {
1997  if(last_size)
1998  free(last_buffer);
1999  last_buffer = malloc((size_t)full_size);
2000  last_size = full_size;
2001  }
2002  buffer_ptr = last_buffer;
2003  ptr = Curr_service_format;
2004  while(*ptr)
2005  {
2006  type = *ptr++;
2007  if(*ptr == ':')
2008  {
2009  ptr++;
2010  sscanf(ptr, "%d", &num);
2011  did_read_string(type, num, &buffer_ptr, &str_ptr);
2012  if(!str_ptr)
2013  break;
2014  if( (ptr = strchr(ptr,';')) )
2015  ptr++;
2016  else
2017  break;
2018  }
2019  else
2020  {
2021  did_read_string(type, 0, &buffer_ptr, &str_ptr);
2022  break;
2023  }
2024  }
2025  full_size = (int) ((char *)buffer_ptr - (char *)last_buffer);
2026  dic_cmnd_service(Curr_service_name,last_buffer,full_size);
2027 }
char Curr_service_name[132]
Definition: did.c:12
char str[80]
Definition: test_client.c:7
void * malloc()
Definition: EventBuilder.cc:99
int dic_cmnd_service(char *serv_name, void *serv_address, int serv_size)
Definition: dic.c:694
int type
void did_read_string(char type, int num, void **buffer_ptr, char **str_ptr)
Definition: did.c:2055
int size
Definition: db_dim_server.c:17
char Curr_service_format[256]
Definition: did.c:13
void free(void *mem)
int get_type_size(char type)
Definition: did.c:1930

+ Here is the call graph for this function:

+ Here is the caller graph for this function: