Advertisement
Guest User

4coder Mirror Buffers Draft 1

a guest
Feb 21st, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. /*
  2. 4coder_mirror.h - Types for the mirror buffer system.
  3. */
  4.  
  5. #if !defined(FCODER_MIRROR_H)
  6. #define FCODER_MIRROR_H
  7.  
  8. typedef int32_t Mirror_Mode;
  9. enum{
  10. MirrorMode_Constructing,
  11. MirrorMode_Reflecting,
  12. };
  13.  
  14. typedef uint32_t Mirror_Flag;
  15. enum{
  16. MirrorFlag_NoHighlight = 0x0,
  17. MirrorFlag_CharacterRangeHighlight = 0x1,
  18. MirrorFlag_LineRangeHighlight = 0x2,
  19. MirrorFlag_UnusedHighlight = 0x3,
  20. MirrorFlag_HighlightMask = 0x3,
  21. };
  22.  
  23. struct Mirror{
  24. Buffer_ID mirror_buffer_id;
  25. Mirror_Mode mode;
  26. Mirror_Flag flags;
  27. Managed_Scope mirror_scope;
  28. int32_t count;
  29. int32_t max;
  30. Managed_Object source_buffer_ids;
  31. Managed_Object mirror_ranges;
  32. Managed_Object source_ranges;
  33. };
  34.  
  35. ////////////////////////////////
  36.  
  37. // The primary API for mirrors.
  38.  
  39. static bool32 mirror_init(Application_Links *app, Buffer_ID buffer, Mirror_Flag flags, Managed_Object *mirror_object_out);
  40. static bool32 mirror_end(Application_Links *app, Managed_Object mirror);
  41. static bool32 mirror_add_range(Application_Links *app, Managed_Object mirror, Buffer_ID source,
  42. int32_t mirror_first, int32_t source_first, int32_t length);
  43. static bool32 mirror_set_mode(Application_Links *app, Managed_Object mirror, Mirror_Mode mode);
  44. static bool32 mirror_set_flags(Application_Links *app, Managed_Object mirror, Mirror_Flag flags);
  45.  
  46. ////////////////////////////////
  47.  
  48.  
  49. // Extra helpers for mirrors (all implemented on the primary API)
  50.  
  51. static bool32 mirror_buffer_create(Application_Links *app, String buffer_name, Buffer_ID *mirror_buffer_id_out);
  52. static bool32 mirror_buffer_add_range_exact(Application_Links *app, Buffer_ID mirror, Buffer_ID source,
  53. int32_t mirror_first, int32_t source_first, int32_t length);
  54. static bool32 mirror_buffer_add_range_loose(Application_Links *app, Buffer_ID mirror, Buffer_ID source,
  55. int32_t mirror_first, int32_t source_first, int32_t max_length);
  56. static bool32 mirror_buffer_insert_range(Application_Links *app, Buffer_ID mirror, Buffer_ID source,
  57. int32_t mirror_insert_pos, int32_t source_first, int32_t length);
  58. static bool32 mirror_buffer_set_mode(Application_Links *app, Buffer_ID mirror, Mirror_Mode mode);
  59. static bool32 mirror_buffer_get_mode(Application_Links *app, Buffer_ID mirror, Mirror_Mode *mode_out);
  60. static bool32 mirror_buffer_set_flags(Application_Links *app, Buffer_ID mirror, Mirror_Flag flags);
  61. static bool32 mirror_buffer_get_flags(Application_Links *app, Buffer_ID mirror, Mirror_Flag *flags_out);
  62. static bool32 mirror_buffer_refresh(Application_Links *app, Buffer_ID mirror);
  63.  
  64. #endif
  65.  
  66. // TOP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement