code_editor.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*******************************************************************************
  2. * Emu51
  3. * code_editor.h:
  4. * Created by mlt on 22/03/23.
  5. ******************************************************************************/
  6. #ifndef EMU51_CODE_EDITOR_H
  7. #define EMU51_CODE_EDITOR_H
  8. #include <allegro.h>
  9. class code_editor
  10. {
  11. private:
  12. char *text_edit[65536];
  13. int lines;
  14. int cl, cp;
  15. int scl, scp;
  16. int _w, _h;
  17. public:
  18. code_editor(void);
  19. ~code_editor(void);
  20. bool alloc_new_line(void); // ret. true on success
  21. bool insert_new_line(int ln);
  22. void delete_last(void);
  23. void cut_line(int ln);
  24. void insert_char(int ln, char ch);
  25. void replace_char(int ln, char ch);
  26. void backspace(void);
  27. void del_ch(int ln);
  28. void draw_cr(void);
  29. void clear_cr(void);
  30. void load_source(char *filename);
  31. void save_source(char *filename);
  32. int compile(int *err); // out-num errors, in-table of int's
  33. // thet represtents lines with errors
  34. // (automactly allocated)
  35. int left, top;
  36. int tab_size;
  37. BITMAP *surface;
  38. void process(void);
  39. void disp(void);
  40. };
  41. #endif /* EMU51_CODE_EDITOR_H */