ui_stub.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #define HL_NAME(n) ui_##n
  2. #include <hl.h>
  3. #ifndef HL_WIN
  4. #include <unistd.h>
  5. #endif
  6. #define wref void
  7. #define vsentinel void
  8. HL_PRIM void HL_NAME(ui_init)() {
  9. }
  10. HL_PRIM int HL_NAME(ui_dialog)( const uchar *title, const uchar *message, int flags ) {
  11. uprintf(USTR("[DIALOG] [%s]"), title);
  12. uprintf(USTR(" %s\n"), title);
  13. return 0;
  14. }
  15. HL_PRIM wref *HL_NAME(ui_winlog_new)( const uchar *title, int width, int height ) {
  16. return NULL;
  17. }
  18. HL_PRIM wref *HL_NAME(ui_button_new)( wref *w, const uchar *txt, vclosure *callb ) {
  19. return NULL;
  20. }
  21. HL_PRIM void HL_NAME(ui_winlog_set_text)( wref *w, const uchar *txt, bool autoScroll ) {
  22. }
  23. HL_PRIM void HL_NAME(ui_win_set_text)( wref *w, const uchar *txt ) {
  24. }
  25. HL_PRIM void HL_NAME(ui_win_set_enable)( wref *w, bool enable ) {
  26. }
  27. HL_PRIM void HL_NAME(ui_win_destroy)( wref *w ) {
  28. }
  29. HL_PRIM int HL_NAME(ui_loop)( bool blocking ) {
  30. return 1;
  31. }
  32. HL_PRIM void HL_NAME(ui_stop_loop)() {
  33. // TODO ?
  34. }
  35. HL_PRIM vsentinel *HL_NAME(ui_start_sentinel)( double timeout, vclosure *c ) {
  36. return NULL;
  37. }
  38. HL_PRIM void HL_NAME(ui_sentinel_tick)( vsentinel *s ) {
  39. }
  40. HL_PRIM void HL_NAME(ui_sentinel_pause)( vsentinel *s, bool pause ) {
  41. }
  42. HL_PRIM bool HL_NAME(ui_sentinel_is_paused)( vsentinel *s ) {
  43. return false;
  44. }
  45. HL_PRIM void HL_NAME(ui_close_console)() {
  46. }
  47. HL_PRIM vbyte *HL_NAME(ui_choose_file)( bool forSave, vdynamic *options ) {
  48. return NULL;
  49. }
  50. #define _WIN _ABSTRACT(ui_window)
  51. #define _SENTINEL _ABSTRACT(ui_sentinel)
  52. DEFINE_PRIM(_VOID, ui_init, _NO_ARG);
  53. DEFINE_PRIM(_I32, ui_dialog, _BYTES _BYTES _I32);
  54. DEFINE_PRIM(_WIN, ui_winlog_new, _BYTES _I32 _I32);
  55. DEFINE_PRIM(_WIN, ui_button_new, _WIN _BYTES _FUN(_VOID,_NO_ARG));
  56. DEFINE_PRIM(_VOID, ui_winlog_set_text, _WIN _BYTES _BOOL);
  57. DEFINE_PRIM(_VOID, ui_win_set_text, _WIN _BYTES);
  58. DEFINE_PRIM(_VOID, ui_win_set_enable, _WIN _BOOL);
  59. DEFINE_PRIM(_VOID, ui_win_destroy, _WIN);
  60. DEFINE_PRIM(_I32, ui_loop, _BOOL);
  61. DEFINE_PRIM(_VOID, ui_stop_loop, _NO_ARG);
  62. DEFINE_PRIM(_VOID, ui_close_console, _NO_ARG);
  63. DEFINE_PRIM(_SENTINEL, ui_start_sentinel, _F64 _FUN(_VOID,_NO_ARG));
  64. DEFINE_PRIM(_VOID, ui_sentinel_tick, _SENTINEL);
  65. DEFINE_PRIM(_VOID, ui_sentinel_pause, _SENTINEL _BOOL);
  66. DEFINE_PRIM(_BOOL, ui_sentinel_is_paused, _SENTINEL);
  67. DEFINE_PRIM(_BYTES, ui_choose_file, _BOOL _DYN);