/[pspp]/pspp/src/pfm-write.c
ViewVC logotype

Diff of /pspp/src/pfm-write.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by blp, Sun Jul 31 21:42:46 2005 UTC revision 1.16 by blp, Sun Aug 7 04:39:28 2005 UTC
# Line 298  write_variables (struct pfm_writer *w, s Line 298  write_variables (struct pfm_writer *w, s
298    
299    for (i = 0; i < dict_get_var_cnt (dict); i++)    for (i = 0; i < dict_get_var_cnt (dict); i++)
300      {      {
       static const char *miss_types[MISSING_COUNT] =  
         {  
           "", "8", "88", "888", "B ", "9", "A", "B 8", "98", "A8",  
         };  
   
       const char *m;  
       int j;  
   
301        struct variable *v = dict_get_var (dict, i);        struct variable *v = dict_get_var (dict, i);
302          struct missing_values mv;
303                
304        if (!buf_write (w, "7", 1) || !write_int (w, v->width)        if (!buf_write (w, "7", 1) || !write_int (w, v->width)
305            || !write_string (w, v->short_name)            || !write_string (w, v->short_name)
306            || !write_format (w, &v->print) || !write_format (w, &v->write))            || !write_format (w, &v->print) || !write_format (w, &v->write))
307          return 0;          return 0;
308    
309        for (m = miss_types[v->miss_type], j = 0; j < (int) strlen (m); j++)        /* Write missing values. */
310          if ((m[j] != ' ' && !buf_write (w, &m[j], 1))        mv_copy (&mv, &v->miss);
311              || !write_value (w, &v->missing[j], v))        while (mv_has_range (&mv))
312            return 0;          {
313              double x, y;
314              mv_pop_range (&mv, &x, &y);
315              if (x == LOWEST)
316                {
317                  if (!buf_write (w, "9", 1) || !write_float (w, y))
318                    return 0;
319                }
320              else if (y == HIGHEST)
321                {
322                  if (!buf_write (w, "A", 1) || !write_float (w, y))
323                    return 0;
324                }
325              else {
326                if (!buf_write (w, "B", 1) || !write_float (w, x)
327                    || !write_float (w, y))
328                  return 0;
329              }
330            }
331          while (mv_has_value (&mv))
332            {
333              union value value;
334              mv_pop_value (&mv, &value);
335              if (!buf_write (w, "8", 1) || !write_value (w, &value, v))
336                return 0;
337            }
338    
339        if (v->label && (!buf_write (w, "C", 1) || !write_string (w, v->label)))        if (v->label && (!buf_write (w, "C", 1) || !write_string (w, v->label)))
340          return 0;          return 0;

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26