FACT++  1.0
void did_prepare_command ( char *  str)

Definition at line 1936 of file didMarkus.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().

1937 {
1938 char type;
1939 int num;
1940 int size, full_size = 0;
1941 char *ptr;
1942 static int last_size = 0;
1943 static void *last_buffer = 0;
1944 void *buffer_ptr;
1945 char *str_ptr;
1946 void did_read_string(char, int, void **, char **);
1947 
1948  str_ptr = str;
1949  ptr = Curr_service_format;
1950  while(*ptr)
1951  {
1952  type = *ptr++;
1953  if(*ptr == ':')
1954  {
1955  ptr++;
1956  size = get_type_size(type);
1957  sscanf(ptr, "%d", &num);
1958  full_size += size * num;
1959  if( (ptr = strchr(ptr,';')) )
1960  ptr++;
1961  else
1962  break;
1963  }
1964  }
1965 
1966  full_size += 256;
1967  if(full_size > last_size)
1968  {
1969  if(last_size)
1970  free(last_buffer);
1971  last_buffer = malloc(full_size);
1972  last_size = full_size;
1973  }
1974  buffer_ptr = last_buffer;
1975  ptr = Curr_service_format;
1976  while(*ptr)
1977  {
1978  type = *ptr++;
1979  if(*ptr == ':')
1980  {
1981  ptr++;
1982  sscanf(ptr, "%d", &num);
1983  did_read_string(type, num, &buffer_ptr, &str_ptr);
1984  if(!str_ptr)
1985  break;
1986  if( (ptr = strchr(ptr,';')) )
1987  ptr++;
1988  else
1989  break;
1990  }
1991  else
1992  {
1993  did_read_string(type, 0, &buffer_ptr, &str_ptr);
1994  break;
1995  }
1996  }
1997  full_size = (int) ((char *)buffer_ptr - (char *)last_buffer);
1998  dic_cmnd_service(Curr_service_name,last_buffer,full_size);
1999 }
int get_type_size(char type)
Definition: didMarkus.c:1902
char str[80]
Definition: test_client.c:7
void did_read_string(char type, int num, void **buffer_ptr, char **str_ptr)
Definition: didMarkus.c:2027
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
char Curr_service_name[132]
Definition: didMarkus.c:12
int size
Definition: db_dim_server.c:17
void free(void *mem)
char Curr_service_format[256]
Definition: didMarkus.c:13

+ Here is the call graph for this function:

+ Here is the caller graph for this function: