home *** CD-ROM | disk | FTP | other *** search
/ Acorn Risc Technologies StrongARM CD-ROM / Acorn Risc Technologies StrongARM CD-ROM.iso / software / amusing / macro / !MacroLife / Docs / Structures < prev    next >
Encoding:
Text File  |  1995-03-10  |  2.5 KB  |  95 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *       Title:    Structures.h                                           *
  4.  *       Purpose:  Desktop Life                                           *
  5.  *       Author:   Copyright © 1995 Chris Taylor                          *
  6.  *       Version:  1.0 (22 January 1995)                                  *
  7.  *       Comments: Slightly tweaked version of the source header file;    *
  8.  *                 neater and better commented than the real thing.       *
  9.  *                                                                        *
  10.  **************************************************************************/
  11.  
  12. /*********************************** STRUCTURES ***************************/
  13.  
  14. /* This is the bit-level structure: 16 rows of 16 bits. It serves double
  15.    duty, since it is also used to compress the other arrays onto disc.    */
  16.    
  17. typedef struct cell_array_struct
  18. {
  19.   int count;
  20.   unsigned short row[16];
  21. }cell_array;
  22.  
  23.  
  24. /* The cells level structure:
  25.    The 'next' array is only present during generation. */
  26.  
  27. typedef struct cells_struct
  28. {
  29.   cell_array *current;
  30.   cell_array *next;
  31. }cells;
  32.  
  33.  
  34. /* The local structure: 16 x 16 cells structures. */
  35.  
  36. typedef struct local_array_struct
  37. {
  38.   int count;
  39.   cells *c[16][16];
  40. }local_array;
  41.  
  42.  
  43. /* The regional structure: 16 x 16 local structures. */
  44.  
  45. typedef struct regional_array_struct
  46. {
  47.   int count;
  48.   local_array *l[16][16];
  49. }regional_array;
  50.  
  51.  
  52. /* The global structure: 16 x 16 regional structures. */
  53.  
  54. typedef struct global_array_struct
  55. {
  56.   regional_array *r[16][16];
  57. }global_array;
  58.  
  59.  
  60. /* The plane structure: two global structures and supporting variables.  
  61.    The real one has more elements; this just shows the important bits. */
  62.  
  63. struct plane_structure
  64. {
  65.   int                   x;
  66.   int                   y;
  67.   global_array          start;
  68.   int                   startpop;
  69.   global_array          base;
  70.   int                   gen;
  71.   int                   pop;
  72. };
  73.  
  74. /* The co-ordinates structure. */
  75.  
  76. struct coord_bits
  77. {
  78.   unsigned int c        :  4;
  79.   unsigned int l        :  4;
  80.   unsigned int r        :  4;
  81.   unsigned int g        :  4;
  82.   unsigned int          : 16;   /* unused */
  83. };
  84.  
  85. /* The union which ties the co-ordinates to their component parts.
  86.    Note that this only works on little-endian processors such as the ARM. 
  87.    A big-endian machine would need a reverse ordering. */
  88.  
  89. typedef union plane_coordinate
  90. {
  91.   int val;
  92.   struct coord_bits bits;
  93. }plane_coord;
  94.  
  95.