list.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /**
  2. * \file list.h
  3. *
  4. * \brief Implementation of a FIFO list of messages
  5. *
  6. * \author Porta Claudio
  7. *
  8. *
  9. * This program is free software under the GPL (>=v2)
  10. * Read the COPYING file that comes with GRASS for details.
  11. *
  12. * \version 1.0
  13. *
  14. * \include
  15. *
  16. */
  17. #include <stdio.h>
  18. #include <unistd.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include "ipc.h"
  22. /**
  23. * \brief node of FIFO list
  24. * \member prev the previous item in list
  25. * \member next the next item in list
  26. * \member m the content of list node
  27. */
  28. struct node
  29. {
  30. struct node *prev;
  31. struct node *next;
  32. msg *m;
  33. };
  34. /**
  35. * \brief FIFO list
  36. * \member head first item in list
  37. * \member tail last item in list
  38. * \member size number of items in list
  39. */
  40. struct list
  41. {
  42. struct node *head;
  43. struct node *tail;
  44. int size;
  45. };
  46. /**
  47. * \brief insert a item in list
  48. * \param l list where to put items
  49. * \param mess the message to insert
  50. */
  51. void insertNode(struct list *l, msg m);
  52. /**
  53. * \brief remove head item
  54. * \param l list where to remove
  55. */
  56. void removeNode(struct list *l);
  57. /**
  58. * \brief struct for runtime area generation
  59. * \param dist inter-area distance
  60. * \param add_row cell to add in rows
  61. * \param add_col cell to add in columns
  62. * \param rows area length in rows
  63. * \param cols area length in columns
  64. * \param x column offset of next area
  65. * \param y row offset of next area
  66. * \param rl sample area length in rows
  67. * \param cl sample area length in columns
  68. * \param count identifier of next area
  69. * \param sf_x column offset of sample frame
  70. * \param sf_y row offset of sample frame
  71. * \param maskname name of mask for the area
  72. */
  73. struct g_area
  74. {
  75. int dist;
  76. int add_row;
  77. int add_col;
  78. int rows;
  79. int cols;
  80. int x;
  81. int y;
  82. int rl;
  83. int cl;
  84. int count;
  85. int sf_x;
  86. int sf_y;
  87. char *maskname;
  88. };
  89. /**
  90. * \brief runtime area generation
  91. * \param gen area generator to use
  92. * \param msg next area message
  93. */
  94. int next(struct g_area *gen, msg *toReturn);