You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 satır
575B

  1. //
  2. // Created by red on 05/12/19.
  3. //
  4. #include <stddef.h>
  5. #ifndef AOC2019_INTCODE_H
  6. #define AOC2019_INTCODE_H
  7. enum {IERR_BAD_OP, IERR_OUT_OF_BOUNDS};
  8. enum {IVAL_OUT, IVAL_ERR, IVAL_END, IVAL_CONT};
  9. typedef struct {
  10. int type;
  11. long num;
  12. int err;
  13. } ival;
  14. typedef struct {
  15. long* tape;
  16. size_t tape_l;
  17. size_t index;
  18. long* input_tape;
  19. long relative_base;
  20. } intcode;
  21. void ival_print(ival v);
  22. ival step (intcode* m);
  23. ival run (intcode* m);
  24. intcode* read_file(char* filename, size_t buf_size);
  25. intcode* clone(intcode* m, size_t buf_size);
  26. #endif //AOC2019_INTCODE_H