Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

59 righe
1.4 KiB

  1. /*
  2. * text canvas text import/export
  3. * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #include "config.h"
  14. #include "common.h"
  15. #if !defined(__KERNEL__)
  16. # if defined(HAVE_INTTYPES_H)
  17. # include <inttypes.h>
  18. # endif
  19. # include <stdio.h>
  20. # include <string.h>
  21. #endif
  22. #include "cucul.h"
  23. #define STRING \
  24. "Hello world!\n" \
  25. " _,----._ \n" \
  26. " (/ @ @ \\) \n" \
  27. " | OO | \n" \
  28. " \\ `--' / \n" \
  29. " `----' \n"
  30. int main(int argc, char *argv[])
  31. {
  32. cucul_canvas_t *cv;
  33. cucul_buffer_t *buffer;
  34. buffer = cucul_load_memory(STRING, strlen(STRING));
  35. cv = cucul_import_canvas(buffer, "text");
  36. cucul_free_buffer(buffer);
  37. buffer = cucul_export_canvas(cv, "utf8");
  38. fwrite(cucul_get_buffer_data(buffer),
  39. cucul_get_buffer_size(buffer), 1, stdout);
  40. cucul_free_buffer(buffer);
  41. cucul_rotate(cv);
  42. buffer = cucul_export_canvas(cv, "utf8");
  43. fwrite(cucul_get_buffer_data(buffer),
  44. cucul_get_buffer_size(buffer), 1, stdout);
  45. cucul_free_buffer(buffer);
  46. cucul_free_canvas(cv);
  47. return 0;
  48. }