6c6,8
< #include "list.h"
---
> 
> #include "data.h"
> //#include "list.h"
12,13c14
< void
< data_init_globals() {
---
> void data_init_globals() {
15c16
< 	GROUPDEF	*gd;
---
> //	GROUPDEF	*gd;
61c62,64
< 	fp = (FILE *)util_discard_header(fp, fname, "UnitType");
---
> 	char label[255];
> 	strcpy(label, "UnitType");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
84,85c87,91
< 		} else {
< 			sprintf(UnitTypeStr, "%s", util_to_lower(UnitTypeStr));
---
> 		} else
> 		{
> 		    char buffer[255];
> 		    strcpy(buffer, UnitTypeStr);
> 			sprintf(UnitTypeStr, "%s", util_to_lower(buffer));
170,171c176
< void
< data_read_neighbours(char *datadir) {
---
> void data_read_neighbours(char *datadir) {
183c188,190
< 	fp = (FILE *)util_discard_header(fp, fname, "Block");
---
> 	char label[255];
> 	strcpy(label, "Block");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
196c203
< 				printf("\nWARNING: %s(Line#:%d): Discarding invalid dataline", line_no);
---
> 				printf("\nWARNING: (Line#:%d): Discarding invalid dataline", line_no);
215,216c222
< void
< data_read_transfer(char *datadir) {
---
> void data_read_transfer(char *datadir) {
219c225
< 	TRANSFER	*transfer;
---
> //	TRANSFER	*transfer;
232c238,240
< 	fp = (FILE *)util_discard_header(fp, fname, "Group");
---
> 	char label[255];
> 	strcpy(label, "Group");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
266,268d273
< 			sprintf(inagestr, "%s", util_to_lower(inagestr));
< 			sprintf(inctypestr, "%s", util_to_lower(inctypestr));
< 			sprintf(inragestr, "%s", util_to_lower(inragestr));
269a275,279
>             // convert to lower case
> 			util_to_lower(inagestr);
> 			util_to_lower(inctypestr);
> 			util_to_lower(inragestr);
> 
284c294
< 			if ((strcmp(inagestr, util_to_lower(NULLSTR))==0)) {
---
> 			if ((strcmp(inagestr, /*util_to_lower(*/NULLSTR/*)*/)==0)) {
294c304
< 			if ((strcmp(inctypestr, util_to_lower(NULLSTR))==0)) {
---
> 			if ((strcmp(inctypestr, /*util_to_lower(*/NULLSTR/*)*/)==0)) {
311c321
< 			if ((strcmp(inragestr, util_to_lower(NULLSTR))==0)) {
---
> 			if ((strcmp(inragestr, /*util_to_lower(*/NULLSTR/*)*/)==0)) {
328,329c338,339
< void
< data_read_priorities(char *datadir) {
---
> void data_read_priorities(char *datadir)
> {
339c349,350
< 	if (fp == NULL) {
---
> 	if (fp == NULL)
> 	{
343d353
< 	fp = (FILE *)util_discard_header(fp, fname, "Zone");
344a355,359
> 
> 	char label[255];
> 	strcpy(label, "Zone");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
> 
457,458c472
< void
< data_implement_landoaf() {
---
> void data_implement_landoaf() {
461c475
< 	CLASS	*class;
---
> 	TIMBER_CLASS	*timber_class;
470,473c484,487
< 			class = (CLASS *)list_next(au->classlist);
< 			while (class != NULL) {
< 				class->area = class->area * au->landoaf;
< 				class = (CLASS *)list_next(au->classlist);
---
> 			timber_class = (TIMBER_CLASS *)list_next(au->classlist);
> 			while (timber_class != NULL) {
> 				timber_class->area = timber_class->area * au->landoaf;
> 				timber_class = (TIMBER_CLASS *)list_next(au->classlist);
481,482c495
< void
< data_read_landoaf(char *datadir) {
---
> void data_read_landoaf(char *datadir) {
496c509,511
< 	fp = (FILE *)util_discard_header(fp, fname, "Zone");
---
> 	char label[255];
> 	strcpy(label, "Zone");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
508d522
< 		count = sscanf(dataline, "%s %s %lf", &inzonestr, &inaustr, &inoaf);
509a524
> 		count = sscanf(dataline, "%s %s %lf", inzonestr, inaustr, &inoaf);
603,604c618
< void
< data_check_regen() {
---
> void data_check_regen() {
640,641c654
< void
< data_init_existing_roads() {
---
> void data_init_existing_roads() {
644c657
< 	CLASS	*class;
---
> 	TIMBER_CLASS	*timber_class;
654,657c667,670
< 				class = (CLASS *)list_next(au->classlist);
< 				while (class!=NULL) {
< 					if (class->age<au->RoadRec->age) {
< 						class->roaded=TRUE;
---
> 				timber_class = (TIMBER_CLASS *)list_next(au->classlist);
> 				while (timber_class!=NULL) {
> 					if (timber_class->age<au->RoadRec->age) {
> 						timber_class->roaded=TRUE;
659c672
< 					class = (CLASS *)list_next(au->classlist);
---
> 					timber_class = (TIMBER_CLASS *)list_next(au->classlist);
668,669c681
< void
< data_read_roads(char *datadir) {
---
> void data_read_roads(char *datadir) {
685c697,699
< 	fp = (FILE *)util_discard_header(fp, fname, "Zone");
---
> 	char label[255];
> 	strcpy(label, "Zone");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
722c736,739
< 			sprintf(intoagestr, "%s", util_to_lower(intoagestr));
---
> 
> 			// convert to lower case
> 			util_to_lower(intoagestr);
> 
752,753c769
< void
< data_read_regen(char *datadir) {
---
> void data_read_regen(char *datadir) {
759c775
< 	ZONE		*zone, *rzone;
---
> 	ZONE		*zone;//, *rzone;
769c785,787
< 	fp = (FILE *)util_discard_header(fp, fname, "Zone");
---
> 	char label[255];
> 	strcpy(label, "Zone");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
839,840c857
< void
< data_check_targets() {
---
> void data_check_targets() {
847,848c864
< void
< data_read_target(char *datadir) {
---
> void data_read_target(char *datadir) {
850,851c866,867
< 	ZONE		*zone;
< 	GROUP		*group;
---
> 	ZONE		*zone = 0;
> 	GROUP		*group = 0;
865c881,883
< 	fp = (FILE *)util_discard_header(fp, fname, "UnitType");
---
> 	char label[255];
> 	strcpy(label, "UnitType");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
891,892c909,910
< 			/* cast to lower case for ease of processing */
< 			sprintf(unittype, "%s", util_to_lower(unittype));
---
> 			/* convert to lower case */
> 			util_to_lower(unittype);
894c912
< 			if ((strcmp(inminareastr, util_to_lower(NULLSTR))==0)) {
---
> 			if ((strcmp(inminareastr, /*util_to_lower(*/NULLSTR/*)*/)==0)) {
903c921
< 			if ((strcmp(inmaxareastr, util_to_lower(NULLSTR))==0)) {
---
> 			if ((strcmp(inmaxareastr, /*util_to_lower(*/NULLSTR/*)*/)==0)) {
912c930
< 			if ((strcmp(inminvolstr, util_to_lower(NULLSTR))==0)) {
---
> 			if ((strcmp(inminvolstr, /*util_to_lower(*/NULLSTR/*)*/)==0)) {
921c939
< 			if ((strcmp(inmaxvolstr, util_to_lower(NULLSTR))==0)) {
---
> 			if ((strcmp(inmaxvolstr, /*util_to_lower(*/NULLSTR/*)*/)==0)) {
945c963
< 			if (strcmp(unittype, util_to_lower("ZONE"))==0) {
---
> 			if (strcmp(unittype, "zone")==0) {
955c973
< 			} else if (strcmp(unittype, util_to_lower("GROUP"))==0) {
---
> 			} else if (strcmp(unittype, "group")==0) {
1012,1013c1030
< void
< data_read_axs(char *datadir) {
---
> void data_read_axs(char *datadir) {
1019c1036,1037
< 			inAgestr[255], inPercentstr[255], inunit[255], inUnitsstr[255], inSignstr[255];
---
> 			inAgestr[255], inPercentstr[255], inunit[255], inSignstr[255];
> 			//inUnitsstr[255],
1021c1039
< 	int		Sign,active,Age,line_no,count,instart,inend;
---
> 	int		Sign,Age,line_no,count,instart,inend; //,active
1029c1047,1049
< 	fp = (FILE *)util_discard_header(fp, fname, "UnitType");
---
> 	char label[255];
> 	strcpy(label, "UnitType");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
1074,1075c1094,1096
< 			sprintf(unittype, "%s", util_to_lower(unittype));
< 			if (strcmp(unittype, util_to_lower("ZONE"))==0) {
---
> 			/* convert to lower case */
> 			util_to_lower(unittype);
> 			if (strcmp(unittype, "zone")==0) {
1082c1103
< 			} else if (strcmp(unittype, util_to_lower("GROUP"))==0) {
---
> 			} else if (strcmp(unittype, "group")==0) {
1098,1099c1119
< void
< data_read_group(char *datadir) {
---
> void data_read_group(char *datadir) {
1101c1121
< 	char		fname[255], dataline[255], inagelowstr[255], inagehighstr[255], ingtype, inrtype,
---
> 	char		fname[255], dataline[255], inagelowstr[255], inagehighstr[255], ingtype,// inrtype,
1116c1136,1138
< 	fp = (FILE *)util_discard_header(fp, fname, "Group");
---
> 	char label[255];
> 	strcpy(label, "Group");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
1147c1169,1172
< 			if ( strcmp( util_to_lower(inzonestr), NULLSTR) != 0 ) {
---
> 			char buffer[255];
> 			strcpy(buffer, inzonestr);
> 			if ( strcmp( util_to_lower(buffer), NULLSTR ) != 0 )
> 			{
1158c1183,1186
< 			if ( strcmp( util_to_lower(inaustr), NULLSTR) != 0 ) {
---
> 		    //char buffer[255];
> 		    strcpy(buffer, inaustr);
> 			if ( strcmp( util_to_lower(buffer), NULLSTR) != 0 )
> 			{
1169c1197,1198
< 			if ( strcmp( util_to_lower(inblockstr), NULLSTR) != 0 ) {
---
> 		    strcpy(buffer, inblockstr);
> 			if ( strcmp( util_to_lower(buffer), NULLSTR) != 0 ) {
1176,1179c1205,1209
< 			/* cast to lower case to ease processing */
< 			sprintf(inagelowstr, "%s", util_to_lower(inagelowstr));
< 			sprintf(inagehighstr, "%s", util_to_lower(inagehighstr));
< 			sprintf(inctypestr, "%s", util_to_lower(inctypestr));
---
> 			/* cast to lower case */
> 			util_to_lower(inagelowstr);
> 			util_to_lower(inagehighstr);
> 			util_to_lower(inctypestr);
> 
1189c1219
< 			if (strcmp(inagelowstr, util_to_lower(NULLSTR)) == 0) {
---
> 			if (strcmp(inagelowstr, /*util_to_lower(*/NULLSTR/*)*/) == 0) {
1198c1228
< 			if (strcmp(inagehighstr, util_to_lower(NULLSTR)) == 0) {
---
> 			if (strcmp(inagehighstr, /*util_to_lower(*/NULLSTR/*)*/) == 0) {
1222,1223c1252,1253
< 			/* class type */
< 			if (strcmp(inctypestr, util_to_lower(NULLSTR))==0) {
---
> 			/* timber_class type */
> 			if (strcmp(inctypestr, /*util_to_lower(*/NULLSTR/*)*/)==0) {
1251,1252c1281
< void
< data_implement_table_oafs() {
---
> void data_implement_table_oafs() {
1275,1276c1304
< void
< data_interpolate_tables() {
---
> void data_interpolate_tables() {
1304,1305c1332
< void
< data_read_oaf(char *datadir) {
---
> void data_read_oaf(char *datadir) {
1318c1345,1347
< 	fp = (FILE *)util_discard_header(fp, fname, "Table");
---
> 	char label[255];
> 	strcpy(label, "Table");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
1374c1403
< 				printf("\n\nERROR: %s(Line#:%d): Table: %s; ReferenceAge<0\n\n", fname, line_no, id, RefAge);
---
> 				printf("\n\nERROR: %s(Line#:%d): Table: %s; ReferenceAge: %d<0\n\n", fname, line_no, id, RefAge);
1384,1385c1413
< void
< data_read_table(char *datadir) {
---
> void data_read_table(char *datadir) {
1387c1415
< 	char		fname[255], dataline[255], instr[255], *ptr, *tstr;
---
> 	char		fname[255], /*dataline[255],*/ instr[255], /**ptr,*/ *tstr;
1390c1418
< 	int		age, got_vol, i, line_no, c;
---
> 	int		age, got_vol, line_no, c;
1403c1431,1433
< 		tstr = (char *)util_strip_label(fp, "Table:");
---
> 		char label[255];
> 		strcpy(label, "Table:");
> 		tstr = (char *)util_strip_label(fp, label);
1457,1458c1487
< static void
< data_read_class_error(int line_no, char *str) {
---
> static void data_read_class_error(int line_no, char *str) {
1463,1464c1492
< void
< data_read_class(char *datadir) {
---
> void data_read_class(char *datadir) {
1471,1472c1499,1500
< 	CLASS		*class;
< 	BLOCK		*block;
---
> 	TIMBER_CLASS		*timber_class;
> 	BLOCK		*block;
1482c1510,1512
< 	fp = (FILE *)util_discard_header(fp, fname, "Zone");
---
> 	char label[255];
> 	strcpy(label, "Zone");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
1526c1556,1557
< 			sprintf(testblockstr, "%s", util_to_lower(inblockstr));
---
> 			/* convert to lower case */
> 			util_to_lower(inblockstr);
1556c1587
< 					sprintf(errstr, "Invalid class type string (%s); MUST be one of [O,o,I,i,D,d,N,n] or blank", inctype);
---
> 					sprintf(errstr, "Invalid timber_class type string (%s); MUST be one of [O,o,I,i,D,d,N,n] or blank", inctype);
1589c1620
< 					data_read_class_error(line_no, "Invalid class type/reversion age");
---
> 					data_read_class_error(line_no, "Invalid timber_class type/reversion age");
1600c1631
< 			/* Reversion age; only applicable for deferred class types */
---
> 			/* Reversion age; only applicable for deferred timber_class types */
1626c1657
< 			class = (CLASS *)init_make_class(zone,
---
> 			timber_class = (TIMBER_CLASS *)init_make_class(zone,
1643,1644c1674
< void
< data_read_config(char *datadir) {
---
> void data_read_config(char *datadir) {
1647c1677
< 	int	i, pl;
---
> //	int	i, pl;
1674c1704,1706
< 	ptr = util_strip_label(fp, "Harvest Rule [1..4]:");
---
> 	char label[255];
> 	strcpy(label, "Harvest Rule [1..4]:");
> 	ptr = util_strip_label(fp, label);
1700c1732,1734
< 	ptr = util_strip_label(fp, "Initial Age Offset [years]:");
---
> 	//char label[255];
> 	strcpy(label, "Initial Age Offset [years]:");
> 	ptr = util_strip_label(fp, label);
1713c1747
< 	/* extract class splitting toggle */
---
> 	/* extract timber_class splitting toggle */
1715c1749,1751
< 	ptr = util_strip_label(fp, "Class Splitting [On/Off]:");
---
> 	//char label[255];
> 	strcpy(label, "Class Splitting [On/Off]:");
> 	ptr = util_strip_label(fp, label);
1735c1771
< 	/* extract class split threshold */
---
> 	/* extract timber_class split threshold */
1738c1774,1776
< 		ptr = util_strip_label(fp, "Class Split Threshold [ha]:");
---
>     	char label[255];
>     	strcpy(label, "Class Split Threshold [ha]:");
>     	ptr = util_strip_label(fp, label);
1755c1793,1795
< 	ptr = util_strip_label(fp, "Trace [On/Off]:");
---
> 	//char label[255];
> 	strcpy(label, "Trace [On/Off]:");
> 	ptr = util_strip_label(fp, label);
1775c1815,1817
< 	ptr = util_strip_label(fp, "Randomizer [On/Off]:");
---
> 	//char label[255];
> 	strcpy(label, "Randomizer [On/Off]:");
> 	ptr = util_strip_label(fp, label);
1798c1840,1842
< 		ptr = util_strip_label(fp, "Randomizer Seed [integer]:");
---
>     	char label[255];
>     	strcpy(label, "Randomizer Seed [integer]:");
>     	ptr = util_strip_label(fp, label);
1810c1854,1856
< 	ptr = util_strip_label(fp, "Reports [On/Off]:");
---
> 	//char label[255];
> 	strcpy(label, "Reports [On/Off]:");
> 	ptr = util_strip_label(fp, label);
1833c1879,1881
< 		ptr = util_strip_label(fp, "Report Headers [On/Off]:");
---
>     	char label[255];
>     	strcpy(label, "Report Headers [On/Off]:");
>     	ptr = util_strip_label(fp, label);
1856c1904,1906
< 	ptr = util_strip_label(fp, "Output Directory:");
---
> 	//char label[255];
> 	strcpy(label, "Output Directory:");
> 	ptr = util_strip_label(fp, label);
1867c1917,1919
< 	ptr = util_strip_label(fp, "LastPeriodTarget:");
---
>     //char label[255];
> 	strcpy(label, "LastPeriodTarget:");
> 	ptr = util_strip_label(fp, label);
1883c1935,1937
< 		ptr = util_strip_label(fp, "GSPercentTarget [%]:");
---
>         char label[255];
>     	strcpy(label, "GSPercentTarget [%]:");
>     	ptr = util_strip_label(fp, label);
1902,1903c1956,1957
< void
< data_read_time_parameters(char *datadir) {
---
> void data_read_time_parameters(char *datadir)
> {
1906c1960
< 	int	period, length, i, count, lookahead;
---
> 	int	period, length, i, count;//, lookahead;
1916c1970,1972
< 	ptr = util_strip_label(fp, "Plan Horizon:");
---
>     char label[255];
> 	strcpy(label, "Plan Horizon:");
> 	ptr = util_strip_label(fp, label);
1932c1988,1991
< 	fp = util_discard_header(fp, fname, "Period");
---
> 	//char label[255];
> 	strcpy(label, "Period");
> 	fp = (FILE *)util_discard_header(fp, fname, label);
> 
1940c1999,2001
< 		} else {
---
> 		}
> 		else
> 		{
1951c2012,2013
< 			for(i=period;i<=MAX_PLAN_HORIZON;i++) {
---
> 			for(i=period;i<=MAX_PLAN_HORIZON;i++)
> 			{
1959d2020
< 
