nullfe.c 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * nullfe.c: Null front-end code containing a bunch of boring stub
  3. * functions. Used to ensure successful linking when building the
  4. * various stand-alone solver binaries.
  5. */
  6. #include <stdarg.h>
  7. #include "puzzles.h"
  8. void frontend_default_colour(frontend *fe, float *output) {}
  9. void get_random_seed(void **randseed, int *randseedsize)
  10. { char *c = snewn(1, char); *c = 0; *randseed = c; *randseedsize = 1; }
  11. void deactivate_timer(frontend *fe) {}
  12. void activate_timer(frontend *fe) {}
  13. struct drawing { char dummy; };
  14. drawing *drawing_new(const drawing_api *api, midend *me, void *handle)
  15. { return snew(drawing); }
  16. void drawing_free(drawing *dr) { sfree(dr); }
  17. void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
  18. int align, int colour, const char *text) {}
  19. void draw_rect(drawing *dr, int x, int y, int w, int h, int colour) {}
  20. void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) {}
  21. void draw_thick_line(drawing *dr, float thickness,
  22. float x1, float y1, float x2, float y2, int colour) {}
  23. void draw_polygon(drawing *dr, const int *coords, int npoints,
  24. int fillcolour, int outlinecolour) {}
  25. void draw_circle(drawing *dr, int cx, int cy, int radius,
  26. int fillcolour, int outlinecolour) {}
  27. char *text_fallback(drawing *dr, const char *const *strings, int nstrings)
  28. { return dupstr(strings[0]); }
  29. void clip(drawing *dr, int x, int y, int w, int h) {}
  30. void unclip(drawing *dr) {}
  31. void start_draw(drawing *dr) {}
  32. void draw_update(drawing *dr, int x, int y, int w, int h) {}
  33. void end_draw(drawing *dr) {}
  34. struct blitter { char dummy; };
  35. blitter *blitter_new(drawing *dr, int w, int h) { return snew(blitter); }
  36. void blitter_free(drawing *dr, blitter *bl) { sfree(bl); }
  37. void blitter_save(drawing *dr, blitter *bl, int x, int y) {}
  38. void blitter_load(drawing *dr, blitter *bl, int x, int y) {}
  39. int print_mono_colour(drawing *dr, int grey) { return 0; }
  40. int print_grey_colour(drawing *dr, float grey) { return 0; }
  41. int print_hatched_colour(drawing *dr, int hatch) { return 0; }
  42. int print_rgb_mono_colour(drawing *dr, float r, float g, float b, int grey)
  43. { return 0; }
  44. int print_rgb_grey_colour(drawing *dr, float r, float g, float b, float grey)
  45. { return 0; }
  46. int print_rgb_hatched_colour(drawing *dr, float r, float g, float b, int hatch)
  47. { return 0; }
  48. void print_line_width(drawing *dr, int width) {}
  49. void print_line_dotted(drawing *dr, bool dotted) {}
  50. void status_bar(drawing *dr, const char *text) {}
  51. void document_add_puzzle(document *doc, const game *game, game_params *par,
  52. game_ui *ui, game_state *st, game_state *st2) {}
  53. void fatal(const char *fmt, ...)
  54. {
  55. va_list ap;
  56. fprintf(stderr, "fatal error: ");
  57. va_start(ap, fmt);
  58. vfprintf(stderr, fmt, ap);
  59. va_end(ap);
  60. fprintf(stderr, "\n");
  61. exit(1);
  62. }
  63. #ifdef DEBUGGING
  64. void debug_printf(const char *fmt, ...)
  65. {
  66. va_list ap;
  67. va_start(ap, fmt);
  68. vfprintf(stdout, fmt, ap);
  69. va_end(ap);
  70. }
  71. #endif