0a1,2
> #ifndef _AGGREGATE_H
> #define _AGGREGATE_H
2c4,6
< extern void	aggregate(int period);
---
> #include <stdio.h>
> #include <math.h>
> #include <string.h>
3a8,63
> //#include "list.h"
> #include "defs.h"
> #include "init.h"
> 
> /*extern*/ void	aggregate(int period);
> extern int compare_grouplists(TIMBER_CLASS *c1, TIMBER_CLASS *c21);
> extern TIMBER_CLASS* aggregate_find_match_class(LIST_PTR *l, TIMBER_CLASS *c);
> 
> extern inline int compare_grouplists(TIMBER_CLASS *c1, TIMBER_CLASS *c2) {
> 	GROUP	*g1, *g2;
> 
> 	/* for lists to match, there must be a one-to-one mapping
> 	   between grouplist of both classes; need to perform a
> 	   reciprocal check */
> 	/* Do not need to check match of float groups, since
> 	   these are clear at this point and will be reassessed later */
> 
> 	c1->staticgrouplist=(LIST_PTR *)list_reset(c1->staticgrouplist);
> 	g1 = (GROUP *)list_next(c1->staticgrouplist);
> 	while (g1!=NULL) {
> 		g2 = (GROUP *)list_find(c2->staticgrouplist, g1->id);
> 		if (g2==NULL) return(FALSE);
> 		g1 = (GROUP *)list_next(c1->staticgrouplist);
> 	}
> 	c2->staticgrouplist=(LIST_PTR *)list_reset(c2->staticgrouplist);
> 	g1 = (GROUP *)list_next(c2->staticgrouplist);
> 	while (g1!=NULL) {
> 		g2 = (GROUP *)list_find(c1->staticgrouplist, g1->id);
> 		if (g2==NULL) return(FALSE);
> 		g1 = (GROUP *)list_next(c2->staticgrouplist);
> 	}
> 	return(TRUE);
> }
> 
> extern inline TIMBER_CLASS* aggregate_find_match_class(LIST_PTR *l, TIMBER_CLASS *c) {
> 	TIMBER_CLASS	*test;
> 
> 	l = (LIST_PTR *)list_reset(l);
> 	test = (TIMBER_CLASS *)list_next(l);
> 	while (test!=NULL) {
> 		if ((test->parent_zone==c->parent_zone)&&
> 		    (test->parent_au==c->parent_au)&&
> 		    (test->parent_block==c->parent_block)&&
> 		    (test->age==c->age)&&
> 		    (test->width==c->width)&&
> 		    (test->roaded==c->roaded)&&
> 		    (test->class_type==c->class_type)&&
> 		    (test->reversion_age==c->reversion_age)) {
> 			if (compare_grouplists(test, c)==TRUE) return(test);
> 		}
> 		test = (TIMBER_CLASS *)list_next(l);
> 	}
> 	return(NULL);
> }
> 
> #endif
