Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

74 rader
2.1 KiB

  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include "./types.hpp"
  6. #include "./hooks.hpp"
  7. #include "./error.hpp"
  8. #include "./print.hpp"
  9. int print_dots(FILE* f) {
  10. return print_to_file(f, "...");
  11. }
  12. void test_printer() {
  13. // u32 arr[] = {1,2,3,4,1,1,3};
  14. // f32 f_arr[] = {1.1,2.1,3.2};
  15. // init_printer();
  16. // register_printer("dots", print_dots, Printer_Function_Type::_void);
  17. // u32 u1 = -1;
  18. // u64 u2 = -1;
  19. // char* str;
  20. // print_to_string(&str, " - %{dots[5]} %{->} <> %{->,2}\n", &u1, &arr, nullptr);
  21. // print("---> %{->char}", str);
  22. // print(" - %{dots[3]}\n");
  23. // print(" - %{u32} %{u64}\n", u1, u2);
  24. // print(" - %{u32} %{u32} %{u32}\n", 2, 5, 7);
  25. // print(" - %{f32} %{f32} %{f32}\n", 2.0, 5.0, 7.0);
  26. // print(" - %{u32} %{bool} %{->char}\n", 2, true, "hello");
  27. // print(" - %{f32[3]}\n", f_arr);
  28. // print(" - %{f32,3}\n", 44.9, 55.1, 66.2);
  29. // print(" - %{u32[5]}\n", arr);
  30. // print(" - %{u32[*]}\n", arr, 4);
  31. // print(" - %{u32,5}\n", 1,2,3,4,1,2);
  32. // print(" - %{unknown%d}\n", 1);
  33. // print(" - %{s32,3}\n", -1,200,-300);
  34. // print(" - %{->} <> %{->,2}\n", &u1, &arr, nullptr);
  35. }
  36. s32 main(s32 argc, char* argv[]) {
  37. // test_printer();
  38. // init_printer();
  39. // create_generic_error("nothing to lex was found:\n"
  40. // " in %{color<}%{->char}%{>color}\n"
  41. // " at %{color<}%{->char}%{>color}\n"
  42. // "bottom text\n",
  43. // console_green,
  44. // "some file name",
  45. // console_cyan,
  46. // "yesssssss");
  47. create_error(__FUNCTION__, __FILE__, __LINE__,
  48. String("generic"),
  49. "nothing to lex was found:\n"
  50. " in %{color<}%{->char}%{>color}\n"
  51. " at %{color<}%{->char}%{>color}\n"
  52. "bottom text\n",
  53. console_green,
  54. "some file name",
  55. console_cyan,
  56. "yesssssss");
  57. return 0;
  58. }