bundle.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*****************************************************************************
  2. * Project: dcc
  3. * File: bundle.h
  4. * Purpose: Module to handle the bundle type (array of pointers to strings).
  5. * (C) Cristina Cifuentes
  6. ****************************************************************************/
  7. #pragma once
  8. #include <stdio.h>
  9. #include <vector>
  10. #include <QtCore/QString>
  11. #include <QtCore/QIODevice>
  12. struct strTable : std::vector<QString>
  13. {
  14. /* Returns the next available index into the table */
  15. size_t nextIdx() {return size();}
  16. public:
  17. void addLabelBundle(int idx, int label);
  18. };
  19. struct bundle
  20. {
  21. public:
  22. void appendCode(const char *format, ...);
  23. void appendCode(const QString &s);
  24. void appendDecl(const char *format, ...);
  25. void appendDecl(const QString &);
  26. void init()
  27. {
  28. decl.clear();
  29. code.clear();
  30. }
  31. strTable decl; /* Declarations */
  32. strTable code; /* C code */
  33. int current_indent;
  34. };
  35. extern bundle cCode;
  36. #define lineSize 360 /* 3 lines in the mean time */
  37. //void newBundle (bundle *procCode);
  38. void writeBundle (QIODevice & ios, bundle procCode);
  39. void freeBundle (bundle *procCode);