Ignore:
Timestamp:
Apr 19, 2006, 11:07:55 AM (14 years ago)
Author:
Sam Hocevar
Message:
  • Added a new "caca" exporter.
  • Removed most code from the raw driver and replaced it with a call to the caca exporter.
  • Slightly changed the caca export format and updated code accordingly.
  • Improved cacaserver error reporting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_raw.c

    r811 r818  
    5454static void raw_display(caca_display_t *dp)
    5555{
    56     uint32_t *attr = dp->cv->attr;
    57     uint32_t *chars = dp->cv->chars;
    58     uint32_t w, h;
    59     unsigned int n;
     56    cucul_buffer_t *buffer;
    6057
    61     w = dp->cv->width;
    62     h = dp->cv->height;
    63 
    64     fprintf(stdout, "CACA%c%c%c%c%c%c%c%c",
    65                     (w >> 24), (w >> 16) & 0xff, (w >> 8) & 0xff, w & 0xff,
    66                     (h >> 24), (h >> 16) & 0xff, (h >> 8) & 0xff, h & 0xff);
    67 
    68     for(n = dp->cv->height * dp->cv->width; n--; )
    69     {
    70         uint32_t ch = *chars++;
    71         uint32_t a = *attr++;
    72 
    73         fprintf(stdout, "%c%c%c%c%c%c%c%c",
    74                 (ch >> 24), (ch >> 16) & 0xff, (ch >> 8) & 0xff, ch & 0xff,
    75                 (a >> 24), (a >> 16) & 0xff, (a >> 8) & 0xff, a & 0xff);
    76     }
    77 
    78     fprintf(stdout, "ACAC");
     58    buffer = cucul_create_export(dp->cv, "caca");
     59    fwrite(cucul_get_buffer_data(buffer),
     60           cucul_get_buffer_size(buffer), 1, stdout);
    7961    fflush(stdout);
     62    cucul_free_buffer(buffer);
    8063}
    8164
Note: See TracChangeset for help on using the changeset viewer.