axe_labels.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Andrea Di Biagio
  3. * Politecnico di Milano, 2007
  4. *
  5. * axe_labels.h
  6. * Formal Languages & Compilers Machine, 2007/2008
  7. *
  8. */
  9. #ifndef _AXE_LABELS_H
  10. #define _AXE_LABELS_H
  11. #include "axe_struct.h"
  12. struct t_axe_label_manager;
  13. /* Typedef for the struct t_axe_label_manager */
  14. typedef struct t_axe_label_manager t_axe_label_manager;
  15. /* reserve a new label identifier and return the identifier to the caller */
  16. extern t_axe_label * newLabelID(t_axe_label_manager *lmanager);
  17. /* assign the given label identifier to the next instruction. Returns
  18. * FALSE if an error occurred; otherwise true */
  19. extern t_axe_label * assignLabelID(t_axe_label_manager *lmanager, t_axe_label *label);
  20. /* initialize the memory structures for the label manager */
  21. extern t_axe_label_manager * initialize_label_manager();
  22. /* retrieve the label that will be assigned to the next instruction */
  23. extern t_axe_label * assign_label(t_axe_label_manager *lmanager);
  24. /* finalize an instance of `t_axe_label_manager' */
  25. extern void finalize_label_manager(t_axe_label_manager *lmanager);
  26. /* get the number of labels inside the list of labels */
  27. extern int get_number_of_labels(t_axe_label_manager *lmanager);
  28. /* return TRUE if the two labels hold the same identifier */
  29. extern int compareLabels(t_axe_label *labelA, t_axe_label *labelB);
  30. /* test if a label will be assigned to the next instruction */
  31. extern int isAssignedLabel(t_axe_label_manager *lmanager);
  32. #endif