head	8.7;
access;
symbols;
locks; strict;
comment	@ * @;


8.7
date	2026.05.11.12.01.10;	author mcalabre;	state Exp;
branches;
next	8.6;

8.6
date	2026.03.29.13.53.56;	author mcalabre;	state Exp;
branches
	8.6.1.1;
next	8.5;

8.5
date	2025.12.06.13.47.41;	author mcalabre;	state Exp;
branches
	8.5.1.1;
next	8.4;

8.4
date	2024.10.28.13.56.17;	author mcalabre;	state Exp;
branches
	8.4.1.1;
next	8.3;

8.3
date	2024.05.13.16.33.00;	author mcalabre;	state Exp;
branches
	8.3.1.1;
next	8.2;

8.2
date	2023.11.16.10.00.30;	author mcalabre;	state Exp;
branches
	8.2.1.1;
next	8.1;

8.1
date	2023.07.05.17.12.07;	author mcalabre;	state Exp;
branches
	8.1.1.1;
next	8.0;

8.0
date	2023.07.01.06.15.05;	author mcalabre;	state Exp;
branches
	8.0.1.1;
next	7.13;

7.13
date	2022.10.07.03.43.35;	author mcalabre;	state Exp;
branches
	7.13.1.1;
next	7.12;

7.12
date	2022.09.09.04.57.58;	author mcalabre;	state Exp;
branches
	7.12.1.1;
next	7.11;

7.11
date	2022.04.26.06.13.52;	author mcalabre;	state Exp;
branches
	7.11.1.1;
next	7.10;

7.10
date	2022.04.23.14.25.15;	author mcalabre;	state Exp;
branches
	7.10.1.1;
next	7.9;

7.9
date	2022.03.25.15.14.49;	author mcalabre;	state Exp;
branches
	7.9.1.1;
next	7.8;

7.8
date	2022.03.25.06.11.49;	author mcalabre;	state Exp;
branches
	7.8.1.1;
next	7.7;

7.7
date	2021.07.12.06.36.49;	author mcalabre;	state Exp;
branches
	7.7.1.1;
next	7.6;

7.6
date	2021.04.13.12.57.01;	author mcalabre;	state Exp;
branches
	7.6.1.1;
next	7.5;

7.5
date	2021.03.20.05.54.58;	author mcalabre;	state Exp;
branches
	7.5.1.1;
next	7.4;

7.4
date	2021.01.31.02.24.52;	author mcalabre;	state Exp;
branches
	7.4.1.1;
next	7.3;

7.3
date	2020.06.03.03.37.03;	author mcalabre;	state Exp;
branches
	7.3.1.1;
next	7.2;

7.2
date	2020.03.09.07.31.23;	author mcalabre;	state Exp;
branches
	7.2.1.1;
next	7.1;

7.1
date	2019.12.31.13.25.19;	author mcalabre;	state Exp;
branches
	7.1.1.1;
next	6.4;

6.4
date	2019.08.15.09.30.18;	author mcalabre;	state Exp;
branches
	6.4.1.1;
next	6.3;

6.3
date	2019.07.12.07.33.39;	author mcalabre;	state Exp;
branches
	6.3.1.1;
next	6.2;

6.2
date	2018.10.20.10.03.14;	author mcalabre;	state Exp;
branches
	6.2.1.1;
next	6.1;

6.1
date	2018.10.19.08.35.17;	author mcalabre;	state Exp;
branches
	6.1.1.1;
next	5.20;

5.20
date	2018.10.05.05.32.41;	author mcalabre;	state Exp;
branches
	5.20.1.1;
next	5.19;

5.19
date	2018.07.26.15.37.05;	author mcalabre;	state Exp;
branches
	5.19.1.1;
next	5.18;

5.18
date	2018.01.10.08.32.14;	author mcalabre;	state Exp;
branches
	5.18.1.1;
next	5.17;

5.17
date	2017.09.18.08.44.24;	author mcalabre;	state Exp;
branches
	5.17.1.1;
next	5.16;

5.16
date	2017.01.15.04.25.02;	author mcalabre;	state Exp;
branches
	5.16.1.1;
next	5.15;

5.15
date	2016.04.05.12.55.11;	author mcalabre;	state Exp;
branches
	5.15.1.1;
next	5.14;

5.14
date	2016.02.07.10.49.32;	author mcalabre;	state Exp;
branches
	5.14.1.1;
next	5.13;

5.13
date	2016.01.26.08.51.15;	author mcalabre;	state Exp;
branches
	5.13.1.1;
next	5.12;

5.12
date	2015.11.15.02.13.01;	author mcalabre;	state Exp;
branches
	5.12.1.1;
next	5.11;

5.11
date	2015.10.18.09.13.06;	author mcalabre;	state Exp;
branches
	5.11.1.1;
next	5.10;

5.10
date	2015.10.09.08.19.16;	author mcalabre;	state Exp;
branches
	5.10.1.1;
next	5.9;

5.9
date	2015.07.21.09.20.03;	author mcalabre;	state Exp;
branches
	5.9.1.1;
next	5.8;

5.8
date	2015.07.08.11.04.01;	author mcalabre;	state Exp;
branches
	5.8.1.1;
next	5.7;

5.7
date	2015.06.29.02.44.17;	author mcalabre;	state Exp;
branches
	5.7.1.1;
next	5.6;

5.6
date	2015.06.14.07.11.25;	author mcalabre;	state Exp;
branches
	5.6.1.1;
next	5.5;

5.5
date	2015.05.05.13.16.32;	author mcalabre;	state Exp;
branches
	5.5.1.1;
next	5.4;

5.4
date	2015.04.21.14.41.06;	author mcalabre;	state Exp;
branches
	5.4.1.1;
next	5.3;

5.3
date	2015.04.21.02.50.52;	author mcalabre;	state Exp;
branches
	5.3.1.1;
next	5.2;

5.2
date	2015.04.15.12.35.08;	author mcalabre;	state Exp;
branches
	5.2.1.1;
next	5.1;

5.1
date	2015.04.07.10.56.38;	author mcalabre;	state Exp;
branches
	5.1.1.1;
next	5.0;

5.0
date	2015.04.05.12.25.01;	author mcalabre;	state Exp;
branches
	5.0.1.1;
next	4.25;

4.25
date	2014.12.14.14.29.37;	author mcalabre;	state Exp;
branches
	4.25.1.1;
next	4.24;

4.24
date	2014.09.18.15.25.01;	author mcalabre;	state Exp;
branches
	4.24.1.1;
next	4.23;

4.23
date	2014.05.13.05.50.52;	author mcalabre;	state Exp;
branches
	4.23.1.1;
next	4.22;

4.22
date	2014.04.12.15.03.53;	author mcalabre;	state Exp;
branches
	4.22.1.1;
next	4.21;

4.21
date	2014.03.24.05.12.28;	author mcalabre;	state Exp;
branches
	4.21.1.1;
next	4.20;

4.20
date	2013.12.18.05.42.50;	author mcalabre;	state Exp;
branches
	4.20.1.1;
next	4.19;

4.19
date	2013.09.29.14.17.52;	author mcalabre;	state Exp;
branches
	4.19.1.1;
next	4.18;

4.18
date	2013.07.13.10.00.05;	author mcalabre;	state Exp;
branches
	4.18.1.1;
next	4.17;

4.17
date	2013.01.29.05.29.21;	author cal103;	state Exp;
branches
	4.17.1.1;
next	4.16;

4.16
date	2012.11.07.04.42.45;	author cal103;	state Exp;
branches
	4.16.1.1;
next	4.15;

4.15
date	2012.09.26.14.26.06;	author cal103;	state Exp;
branches
	4.15.1.1;
next	4.14;

4.14
date	2012.07.13.10.02.32;	author cal103;	state Exp;
branches
	4.14.1.1;
next	4.13;

4.13
date	2012.03.14.07.39.30;	author cal103;	state Exp;
branches
	4.13.1.1;
next	4.12;

4.12
date	2012.02.29.07.57.57;	author cal103;	state Exp;
branches
	4.12.1.1;
next	4.11;

4.11
date	2012.02.20.23.30.02;	author cal103;	state Exp;
branches
	4.11.1.1;
next	4.10;

4.10
date	2012.02.05.23.41.44;	author cal103;	state Exp;
branches
	4.10.1.1;
next	4.9;

4.9
date	2012.01.24.05.40.29;	author cal103;	state Exp;
branches
	4.9.1.1;
next	4.8;

4.8
date	2011.08.15.08.05.54;	author cal103;	state Exp;
branches
	4.8.1.1;
next	4.7;

4.7
date	2011.02.07.07.03.42;	author cal103;	state Exp;
branches
	4.7.1.1;
next	4.6;

4.6
date	2010.11.16.06.15.31;	author cal103;	state Exp;
branches
	4.6.1.1;
next	4.5;

4.5
date	2010.07.16.07.01.26;	author cal103;	state Exp;
branches
	4.5.1.1;
next	4.4;

4.4
date	2009.08.06.07.45.31;	author cal103;	state Exp;
branches
	4.4.1.1;
next	4.3;

4.3
date	2007.12.27.05.35.51;	author cal103;	state Exp;
branches
	4.3.1.1;
next	4.2;

4.2
date	2005.09.22.02.15.15;	author cal103;	state Exp;
branches
	4.2.1.1;
next	4.1;

4.1
date	2005.08.26.13.12.51;	author cal103;	state Exp;
branches;
next	4.0;

4.0
date	2005.02.04.06.26.16;	author cal103;	state Exp;
branches;
next	3.6;

3.6
date	2004.08.25.05.47.18;	author cal103;	state Exp;
branches;
next	3.5;

3.5
date	2004.06.28.01.07.15;	author mcalabre;	state Exp;
branches;
next	3.4;

3.4
date	2004.02.11.00.23.05;	author mcalabre;	state Exp;
branches;
next	3.3;

3.3
date	2003.10.21.08.10.05;	author mcalabre;	state Exp;
branches;
next	3.2;

3.2
date	2003.09.09.04.40.16;	author mcalabre;	state Exp;
branches;
next	3.1;

3.1
date	2003.04.28.04.27.07;	author mcalabre;	state Exp;
branches;
next	3.0;

3.0
date	2003.04.01.04.16.39;	author mcalabre;	state Exp;
branches;
next	2.14;

2.14
date	2002.04.03.01.25.29;	author mcalabre;	state Exp;
branches;
next	2.13;

2.13
date	2001.11.15.03.28.43;	author mcalabre;	state Exp;
branches;
next	2.12;

2.12
date	2001.09.05.05.07.17;	author mcalabre;	state Exp;
branches;
next	2.11;

2.11
date	2000.12.04.08.29.57;	author mcalabre;	state Exp;
branches;
next	2.10;

2.10
date	2000.05.10.04.44.05;	author mcalabre;	state Exp;
branches;
next	2.9;

2.9
date	2000.01.31.07.02.47;	author mcalabre;	state Exp;
branches;
next	2.8;

2.8
date	99.12.13.07.37.39;	author mcalabre;	state Exp;
branches;
next	2.7;

2.7
date	99.12.13.03.42.08;	author mcalabre;	state Exp;
branches;
next	2.6;

2.6
date	99.11.19.00.33.22;	author mcalabre;	state Exp;
branches;
next	2.5;

2.5
date	99.06.16.00.13.11;	author mcalabre;	state Exp;
branches;
next	2.4;

2.4
date	98.02.25.07.05.50;	author mcalabre;	state Exp;
branches;
next	2.3;

2.3
date	98.01.30.00.16.15;	author mcalabre;	state Exp;
branches;
next	2.2;

2.2
date	96.09.10.06.35.34;	author mcalabre;	state Exp;
branches;
next	2.1;

2.1
date	96.05.07.20.35.19;	author mcalabre;	state Exp;
branches;
next	;

4.2.1.1
date	2005.12.05.01.39.15;	author cal103;	state Exp;
branches;
next	4.2.1.2;

4.2.1.2
date	2005.12.16.03.48.31;	author cal103;	state Exp;
branches;
next	4.2.1.3;

4.2.1.3
date	2007.06.29.06.43.47;	author cal103;	state Exp;
branches;
next	4.2.1.4;

4.2.1.4
date	2007.08.02.05.58.54;	author cal103;	state Exp;
branches;
next	4.2.1.5;

4.2.1.5
date	2007.12.03.05.12.59;	author cal103;	state Exp;
branches;
next	4.2.1.6;

4.2.1.6
date	2007.12.27.05.18.47;	author cal103;	state Exp;
branches;
next	;

4.3.1.1
date	2007.12.27.13.24.32;	author cal103;	state Exp;
branches;
next	4.3.1.2;

4.3.1.2
date	2009.07.22.06.38.03;	author cal103;	state Exp;
branches;
next	4.3.1.3;

4.3.1.3
date	2009.08.06.02.55.04;	author cal103;	state Exp;
branches;
next	4.3.1.4;

4.3.1.4
date	2009.08.06.06.34.03;	author cal103;	state Exp;
branches;
next	;

4.4.1.1
date	2009.08.12.06.35.54;	author cal103;	state Exp;
branches;
next	4.4.1.2;

4.4.1.2
date	2010.01.19.03.44.00;	author cal103;	state Exp;
branches;
next	;

4.5.1.1
date	2010.07.16.07.05.32;	author cal103;	state Exp;
branches;
next	;

4.6.1.1
date	2010.11.16.06.16.19;	author cal103;	state Exp;
branches;
next	4.6.1.2;

4.6.1.2
date	2011.01.14.06.33.44;	author cal103;	state Exp;
branches;
next	;

4.7.1.1
date	2011.02.07.07.04.23;	author cal103;	state Exp;
branches;
next	4.7.1.2;

4.7.1.2
date	2011.07.21.04.10.13;	author cal103;	state Exp;
branches;
next	4.7.1.3;

4.7.1.3
date	2011.08.09.03.10.06;	author cal103;	state Exp;
branches;
next	4.7.1.4;

4.7.1.4
date	2011.08.10.07.23.43;	author cal103;	state Exp;
branches;
next	4.7.1.5;

4.7.1.5
date	2011.08.11.03.02.31;	author cal103;	state Exp;
branches;
next	4.7.1.6;

4.7.1.6
date	2011.08.12.02.54.42;	author cal103;	state Exp;
branches;
next	4.7.1.7;

4.7.1.7
date	2011.08.15.06.03.16;	author cal103;	state Exp;
branches;
next	;

4.8.1.1
date	2011.08.15.08.07.06;	author cal103;	state Exp;
branches;
next	4.8.1.2;

4.8.1.2
date	2012.01.24.05.23.30;	author cal103;	state Exp;
branches;
next	;

4.9.1.1
date	2012.01.24.05.41.46;	author cal103;	state Exp;
branches;
next	;

4.10.1.1
date	2012.02.05.23.42.47;	author cal103;	state Exp;
branches;
next	;

4.11.1.1
date	2012.02.20.23.31.13;	author cal103;	state Exp;
branches;
next	;

4.12.1.1
date	2012.02.29.07.59.11;	author cal103;	state Exp;
branches;
next	;

4.13.1.1
date	2012.03.14.07.40.38;	author cal103;	state Exp;
branches;
next	4.13.1.2;

4.13.1.2
date	2012.03.15.05.50.34;	author cal103;	state Exp;
branches;
next	4.13.1.3;

4.13.1.3
date	2012.07.13.03.37.00;	author cal103;	state Exp;
branches;
next	;

4.14.1.1
date	2012.07.13.10.04.50;	author cal103;	state Exp;
branches;
next	;

4.15.1.1
date	2012.09.26.14.27.52;	author cal103;	state Exp;
branches;
next	;

4.16.1.1
date	2012.11.07.04.45.57;	author cal103;	state Exp;
branches;
next	4.16.1.2;

4.16.1.2
date	2013.01.29.05.10.40;	author cal103;	state Exp;
branches;
next	;

4.17.1.1
date	2013.01.29.05.32.33;	author cal103;	state Exp;
branches;
next	;

4.18.1.1
date	2013.07.13.10.02.38;	author mcalabre;	state Exp;
branches;
next	;

4.19.1.1
date	2013.09.29.14.20.40;	author mcalabre;	state Exp;
branches;
next	;

4.20.1.1
date	2013.12.18.05.46.56;	author mcalabre;	state Exp;
branches;
next	4.20.1.2;

4.20.1.2
date	2014.03.21.06.26.03;	author mcalabre;	state Exp;
branches;
next	;

4.21.1.1
date	2014.03.24.05.15.29;	author mcalabre;	state Exp;
branches;
next	;

4.22.1.1
date	2014.04.12.15.06.33;	author mcalabre;	state Exp;
branches;
next	;

4.23.1.1
date	2014.05.13.05.53.51;	author mcalabre;	state Exp;
branches;
next	;

4.24.1.1
date	2014.09.18.15.28.11;	author mcalabre;	state Exp;
branches;
next	;

4.25.1.1
date	2014.12.14.14.32.46;	author mcalabre;	state Exp;
branches;
next	4.25.1.2;

4.25.1.2
date	2015.01.06.01.01.52;	author mcalabre;	state Exp;
branches;
next	4.25.1.3;

4.25.1.3
date	2015.03.05.08.22.06;	author mcalabre;	state Exp;
branches;
next	4.25.1.4;

4.25.1.4
date	2015.03.06.00.10.11;	author mcalabre;	state Exp;
branches;
next	4.25.1.5;

4.25.1.5
date	2015.04.03.03.21.31;	author mcalabre;	state Exp;
branches;
next	;

5.0.1.1
date	2015.04.05.12.28.02;	author mcalabre;	state Exp;
branches;
next	;

5.1.1.1
date	2015.04.07.11.01.11;	author mcalabre;	state Exp;
branches;
next	5.1.1.2;

5.1.1.2
date	2015.04.15.09.26.11;	author mcalabre;	state Exp;
branches;
next	;

5.2.1.1
date	2015.04.15.12.39.16;	author mcalabre;	state Exp;
branches;
next	;

5.3.1.1
date	2015.04.21.02.54.03;	author mcalabre;	state Exp;
branches;
next	;

5.4.1.1
date	2015.04.21.14.44.29;	author mcalabre;	state Exp;
branches;
next	;

5.5.1.1
date	2015.05.05.13.21.02;	author mcalabre;	state Exp;
branches;
next	;

5.6.1.1
date	2015.06.14.07.14.46;	author mcalabre;	state Exp;
branches;
next	;

5.7.1.1
date	2015.06.29.02.47.25;	author mcalabre;	state Exp;
branches;
next	;

5.8.1.1
date	2015.07.08.11.07.20;	author mcalabre;	state Exp;
branches;
next	;

5.9.1.1
date	2015.07.21.09.28.10;	author mcalabre;	state Exp;
branches;
next	;

5.10.1.1
date	2015.10.09.08.22.37;	author mcalabre;	state Exp;
branches;
next	;

5.11.1.1
date	2015.10.18.09.16.29;	author mcalabre;	state Exp;
branches;
next	;

5.12.1.1
date	2015.11.15.02.16.16;	author mcalabre;	state Exp;
branches;
next	5.12.1.2;

5.12.1.2
date	2016.01.25.05.17.40;	author mcalabre;	state Exp;
branches;
next	;

5.13.1.1
date	2016.01.26.08.54.34;	author mcalabre;	state Exp;
branches;
next	;

5.14.1.1
date	2016.02.07.10.52.46;	author mcalabre;	state Exp;
branches;
next	;

5.15.1.1
date	2016.04.05.12.58.37;	author mcalabre;	state Exp;
branches;
next	5.15.1.2;

5.15.1.2
date	2017.01.15.04.14.22;	author mcalabre;	state Exp;
branches;
next	;

5.16.1.1
date	2017.01.15.04.29.01;	author mcalabre;	state Exp;
branches;
next	;

5.17.1.1
date	2017.09.18.08.46.00;	author mcalabre;	state Exp;
branches;
next	5.17.1.2;

5.17.1.2
date	2018.01.10.08.26.04;	author mcalabre;	state Exp;
branches;
next	;

5.18.1.1
date	2018.01.10.08.33.04;	author mcalabre;	state Exp;
branches;
next	;

5.19.1.1
date	2018.07.26.15.41.41;	author mcalabre;	state Exp;
branches;
next	;

5.20.1.1
date	2018.10.05.05.33.33;	author mcalabre;	state Exp;
branches;
next	;

6.1.1.1
date	2018.10.19.08.36.15;	author mcalabre;	state Exp;
branches;
next	;

6.2.1.1
date	2018.10.20.10.04.15;	author mcalabre;	state Exp;
branches;
next	6.2.1.2;

6.2.1.2
date	2019.05.10.02.01.28;	author mcalabre;	state Exp;
branches;
next	;

6.3.1.1
date	2019.07.12.07.34.37;	author mcalabre;	state Exp;
branches;
next	;

6.4.1.1
date	2019.08.15.09.31.29;	author mcalabre;	state Exp;
branches;
next	6.4.1.2;

6.4.1.2
date	2019.12.31.02.38.22;	author mcalabre;	state Exp;
branches;
next	6.4.1.3;

6.4.1.3
date	2019.12.31.03.28.29;	author mcalabre;	state Exp;
branches;
next	;

7.1.1.1
date	2019.12.31.13.28.19;	author mcalabre;	state Exp;
branches;
next	;

7.2.1.1
date	2020.03.09.07.34.50;	author mcalabre;	state Exp;
branches;
next	;

7.3.1.1
date	2020.06.03.03.38.11;	author mcalabre;	state Exp;
branches;
next	7.3.1.2;

7.3.1.2
date	2020.08.17.11.20.48;	author mcalabre;	state Exp;
branches;
next	7.3.1.3;

7.3.1.3
date	2021.01.19.14.10.01;	author mcalabre;	state Exp;
branches;
next	7.3.1.4;

7.3.1.4
date	2021.01.28.12.31.20;	author mcalabre;	state Exp;
branches;
next	;

7.4.1.1
date	2021.01.31.02.26.24;	author mcalabre;	state Exp;
branches;
next	;

7.5.1.1
date	2021.03.20.05.56.42;	author mcalabre;	state Exp;
branches;
next	;

7.6.1.1
date	2021.04.13.13.00.36;	author mcalabre;	state Exp;
branches;
next	;

7.7.1.1
date	2021.07.12.06.38.27;	author mcalabre;	state Exp;
branches;
next	7.7.1.2;

7.7.1.2
date	2022.03.25.06.06.00;	author mcalabre;	state Exp;
branches;
next	;

7.8.1.1
date	2022.03.25.06.14.15;	author mcalabre;	state Exp;
branches;
next	;

7.9.1.1
date	2022.03.25.15.16.40;	author mcalabre;	state Exp;
branches;
next	;

7.10.1.1
date	2022.04.23.14.26.54;	author mcalabre;	state Exp;
branches;
next	;

7.11.1.1
date	2022.04.26.06.15.32;	author mcalabre;	state Exp;
branches;
next	;

7.12.1.1
date	2022.09.09.05.00.36;	author mcalabre;	state Exp;
branches;
next	;

7.13.1.1
date	2022.10.07.03.45.47;	author mcalabre;	state Exp;
branches;
next	7.13.1.2;

7.13.1.2
date	2023.06.15.04.17.20;	author mcalabre;	state Exp;
branches;
next	;

8.0.1.1
date	2023.07.01.06.22.44;	author mcalabre;	state Exp;
branches;
next	;

8.1.1.1
date	2023.07.05.17.15.00;	author mcalabre;	state Exp;
branches;
next	;

8.2.1.1
date	2023.11.16.10.05.58;	author mcalabre;	state Exp;
branches;
next	8.2.1.2;

8.2.1.2
date	2024.04.02.14.06.10;	author mcalabre;	state Exp;
branches;
next	8.2.1.3;

8.2.1.3
date	2024.05.10.05.03.54;	author mcalabre;	state Exp;
branches;
next	8.2.1.4;

8.2.1.4
date	2024.05.10.14.25.46;	author mcalabre;	state Exp;
branches;
next	8.2.1.5;

8.2.1.5
date	2024.05.10.15.24.18;	author mcalabre;	state Exp;
branches;
next	8.2.1.6;

8.2.1.6
date	2024.05.13.12.39.14;	author mcalabre;	state Exp;
branches;
next	;

8.3.1.1
date	2024.05.13.16.35.40;	author mcalabre;	state Exp;
branches;
next	8.3.1.2;

8.3.1.2
date	2024.07.09.09.33.42;	author mcalabre;	state Exp;
branches;
next	;

8.4.1.1
date	2024.10.28.13.58.41;	author mcalabre;	state Exp;
branches;
next	8.4.1.2;

8.4.1.2
date	2025.12.06.13.37.17;	author mcalabre;	state Exp;
branches;
next	;

8.5.1.1
date	2025.12.06.14.05.16;	author mcalabre;	state Exp;
branches;
next	8.5.1.2;

8.5.1.2
date	2026.03.29.13.36.17;	author mcalabre;	state Exp;
branches;
next	;

8.6.1.1
date	2026.03.29.14.19.27;	author mcalabre;	state Exp;
branches;
next	8.6.1.2;

8.6.1.2
date	2026.04.05.08.32.33;	author mcalabre;	state Exp;
branches;
next	8.6.1.3;

8.6.1.3
date	2026.04.25.09.00.53;	author mcalabre;	state Exp;
branches;
next	;


desc
@Program to test closure of the high-level WCSLIB coordinate transformation
routines.
@


8.7
log
@WCSLIB 8.7
@
text
@/*============================================================================
  WCSLIB 8.7 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2026, Mark Calabretta

  This file is part of WCSLIB.

  WCSLIB is free software: you can redistribute it and/or modify it under the
  terms of the GNU Lesser General Public License as published by the Free
  Software Foundation, either version 3 of the License, or (at your option)
  any later version.

  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
  more details.

  You should have received a copy of the GNU Lesser General Public License
  along with WCSLIB.  If not, see http://www.gnu.org/licenses.

  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO,
     and: Michael Droetboom, Space Telescope Science Institute
  http://www.atnf.csiro.au/computing/software/wcs
  $Id: twcs.c,v 8.6.1.3 2026/04/25 09:00:53 mcalabre Exp mcalabre $
*=============================================================================
*
* twcs tests wcss2p() and wcsp2s() for closure on an oblique 2-D slice through
* a 4-D image with celestial, spectral and logarithmic coordinate axes.
*
*---------------------------------------------------------------------------*/

// Must be included before anything else.
#include <wcsconfig_tests.h>

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <wcslib.h>


#define NELEM 9

void parser(struct wcsprm *);
int  check_error(struct wcsprm *, int, int, char *);
int  test_errors();

// Reporting tolerance.
const double tol = 1.0e-10;


// In real life these would be encoded as FITS header keyrecords.
const int NAXIS = 4;
const double CRPIX[4] =  {  513.0,  0.0,  0.0,  0.0};
const double PC[4][4] = {{    1.1,  0.0,  0.0,  0.0},
                         {    0.0,  1.0,  0.0,  0.1},
                         {    0.0,  0.0,  1.0,  0.0},
                         {    0.0,  0.2,  0.0,  1.0}};
const double CDELT[4] =  {-9.635265432e-6, 1.0, 0.1, -1.0};

char CTYPE[4][9] = {"WAVE-F2W", "XLAT-BON", "TIME-LOG", "XLON-BON"};

const double CRVAL[4] = {0.214982042, -30.0, 1.0, 150.0};
const double LONPOLE  = 150.0;
const double LATPOLE  = 999.0;
const double RESTFRQ  =   1.42040575e9;
const double RESTWAV  =   0.0;

int NPV = 3;
struct pvcard PV[3];		// Projection parameters are set in main().

int itest = 0;

int main()

{
  int ver[3];
  printf("WCSLIB version number: %s", wcslib_version(ver));
  printf(" (%d,%d,%d)\n\n", ver[0], ver[1], ver[2]);

  printf("Testing closure of WCSLIB world coordinate transformation "
         "routines (twcs.c)\n"
         "----------------------------------------------------------"
         "-----------------\n");

  // List status return messages.
  int status;
  printf("\nList of wcs status return values:\n");
  for (status = 1; status <= 13; status++) {
    printf("%4d: %s.\n", status, wcs_errmsg[status]);
  }

  printf("\nSize of data types (bytes):\n");
  printf("           char:%5"MODZ"u\n", sizeof(char));
  printf("      short int:%5"MODZ"u\n", sizeof(short int));
  printf("            int:%5"MODZ"u\n", sizeof(int));
  printf("       long int:%5"MODZ"u\n", sizeof(long int));
  printf("  long long int:%5"MODZ"u\n", sizeof(long long int));
  printf("          float:%5"MODZ"u\n", sizeof(float));
  printf("         double:%5"MODZ"u\n", sizeof(double));
  printf("         char *:%5"MODZ"u\n", sizeof(char *));
  printf("   char (*)[72]:%5"MODZ"u\n", sizeof(char (*)[72]));
  printf("          int *:%5"MODZ"u\n", sizeof(int *));
  printf("        float *:%5"MODZ"u\n", sizeof(float *));
  printf("       double *:%5"MODZ"u\n", sizeof(double *));
  printf("struct  dpkey *:%5"MODZ"u\n", sizeof(struct dpkey *));
  printf("struct pvcard *:%5"MODZ"u\n", sizeof(struct pvcard *));
  printf("struct pscard *:%5"MODZ"u\n", sizeof(struct pscard *));

  printf("\nSize of structs (bytes/ints):\n");

  char ok[] = "", mismatch[] = " (WARNING, mismatch)";
  char *s = (sizeof(struct auxprm) == sizeof(int)*AUXLEN) ? ok : mismatch;
  printf("         auxprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct auxprm),
         AUXLEN, s);

  s = (sizeof(struct celprm) == sizeof(int)*CELLEN) ? ok : mismatch;
  printf("         celprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct celprm),
         CELLEN, s);

  s = (sizeof(struct disprm) == sizeof(int)*DISLEN) ? ok : mismatch;
  printf("         disprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct disprm),
         DISLEN, s);

  s = (sizeof(struct dpkey)  == sizeof(int)*DPLEN)  ? ok : mismatch;
  printf("          dpkey:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct dpkey),
         DPLEN, s);

  s = (sizeof(struct fitskey) == sizeof(int)*KEYLEN) ? ok : mismatch;
  printf("        fitskey:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct fitskey),
         KEYLEN, s);

  s = (sizeof(struct fitskeyid) == sizeof(int)*KEYIDLEN) ? ok : mismatch;
  printf("      fitskeyid:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct fitskeyid),
         KEYIDLEN, s);

  s = (sizeof(struct linprm) == sizeof(int)*LINLEN) ? ok : mismatch;
  printf("         linprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct linprm),
         LINLEN, s);

  s = (sizeof(struct prjprm) == sizeof(int)*PRJLEN) ? ok : mismatch;
  printf("         prjprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct prjprm),
         PRJLEN, s);

  s = (sizeof(struct pscard) == sizeof(int)*PSLEN)  ? ok : mismatch;
  printf("         pscard:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct pscard),
         PSLEN, s);

  s = (sizeof(struct pvcard) == sizeof(int)*PVLEN)  ? ok : mismatch;
  printf("         pvcard:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct pvcard),
         PVLEN, s);

  s = (sizeof(struct spcprm) == sizeof(int)*SPCLEN) ? ok : mismatch;
  printf("         spcprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct spcprm),
         SPCLEN, s);

  s = (sizeof(struct spxprm) == sizeof(int)*SPXLEN) ? ok : mismatch;
  printf("         spxprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct spxprm),
         SPXLEN, s);

  s = (sizeof(struct tabprm) == sizeof(int)*TABLEN) ? ok : mismatch;
  printf("         tabprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct tabprm),
         TABLEN, s);

  s = (sizeof(struct wcserr) == sizeof(int)*ERRLEN) ? ok : mismatch;
  printf("         wcserr:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct wcserr),
         ERRLEN, s);

  s = (sizeof(struct wcsprm) == sizeof(int)*WCSLEN) ? ok : mismatch;
  printf("         wcsprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct wcsprm),
         WCSLEN, s);

  printf("\n");


  // Set the PVi_ma keyvalues for the longitude axis.
  //------------------------------------------------------------
  // For test purposes, these are set so that the fiducial
  // native coordinates are at the native pole, i.e. so that
  // (phi0,theta0) = (0,90), but without any fiducial offset,
  // i.e. iwith PVi_0a == 0 (by default).
  //------------------------------------------------------------
  PV[0].i = 4;			// Longitude is on axis 4.
  PV[0].m = 1;			// Parameter number 1.
  PV[0].value =  0.0;		// Fiducial native longitude.

  PV[1].i = 4;			// Longitude is on axis 4.
  PV[1].m = 2;			// Parameter number 2.
  PV[1].value = 90.0;		// Fiducial native latitude.

  // Set the PVi_m keyvaluess for the latitude axis.
  PV[2].i = 2;			// Latitude is on axis 2.
  PV[2].m = 1;			// Parameter number 1.
  PV[2].value = -30.0;		// PVi_1.


  // The following routine simulates the actions of a FITS header parser.
  struct wcsprm *wcs = malloc(sizeof(struct wcsprm));
  wcs->flag = -1;
  parser(wcs);

  // Test wcsenq() - note that the struct is unset.
  int nFail0 = 0;
  if (!wcsenq(wcs, WCSENQ_MEM)) {
    nFail0++;
    printf("Unexpected result from wcsenq(): memory.\n");
  }

  // Enable error messaging.
  wcserr_enable(1);

  // Put the struct in bypass mode (as a test).
  wcs->flag = 1;
  if (wcsset(wcs)) {
    wcsperr(wcs, "");
  }

  // Tidy up the wcsprm struct.
  wcstrim(wcs);

  // Test wcsenq().
  if (!wcsenq(wcs, WCSENQ_SET | WCSENQ_BYP)) {
    nFail0++;
    printf("Unexpected result from wcsenq(): set and bypass.\n");
  }

  if (!wcsenq(wcs, WCSENQ_CHK)) {
    nFail0++;
    printf("Unexpected result from wcsenq(): checksum (a).\n");
  }

  // Further test for wcsenq() - an inconsequential change.
  wcs->latpole = 999.001;
  if (wcsenq(wcs, WCSENQ_CHK)) {
    nFail0++;
    printf("Unexpected result from wcsenq(): checksum (b).\n");
  }


  if (nFail0) printf("\n");
  printf("Reporting tolerance %5.1g pixel.\n", tol);

  // Initialize non-celestial world coordinates.
  double time = 1.0;
  double freq = 1.42040595e9 - 180.0 * 62500.0;
  double world1[361][NELEM], world2[361][NELEM];
  for (int k = 0; k < 361; k++) {
    world1[k][0] = 0.0;
    world1[k][1] = 0.0;
    world1[k][2] = 0.0;
    world1[k][3] = 0.0;

    world1[k][2] = time;
    time *= 1.01;

    world1[k][wcs->spec] = 2.99792458e8 / freq;
    freq += 62500.0;
  }

  int nFail1 = 0, stat[361];
  double residmax = 0.0;
  double img[361][NELEM], pixel1[361][NELEM], pixel2[361][NELEM];
  double phi[361], theta[361];
  for (int lat = 90; lat >= -90; lat--) {
    double lat1 = (double)lat;

    int k, lng;
    for (lng = -180, k = 0; lng <= 180; lng++, k++) {
      double lng1 = (double)lng;

      world1[k][wcs->lng] = lng1;
      world1[k][wcs->lat] = lat1;
    }

    if (wcss2p(wcs, 361, NELEM, world1[0], phi, theta, img[0], pixel1[0],
               stat)) {
      printf("  At wcss2p#1 with lat1 == %f\n", lat1);
      wcsperr(wcs, "  ");
      continue;
    }

    if (wcsp2s(wcs, 361, NELEM, pixel1[0], img[0], phi, theta, world2[0],
               stat)) {
      printf("  At wcsp2s with lat1 == %f\n", lat1);
      wcsperr(wcs, "  ");
      continue;
    }

    if (wcss2p(wcs, 361, NELEM, world2[0], phi, theta, img[0], pixel2[0],
               stat)) {
      printf("  At wcss2p#2 with lat1 == %f\n", lat1);
      wcsperr(wcs, "  ");
      continue;
    }

    for (k = 0; k < 361; k++) {
      double resid = 0.0;
      for (int i = 0; i < NAXIS; i++) {
        double r = pixel2[k][i] - pixel1[k][i];
        resid += r*r;
      }

      resid = sqrt(resid);
      if (resid > residmax) residmax = resid;

      if (resid > tol) {
        nFail1++;
        printf("\nClosure error:\n"
               "world1:%18.12f%18.12f%18.12f%18.12f\n"
               "pixel1:%18.12f%18.12f%18.12f%18.12f\n"
               "world2:%18.12f%18.12f%18.12f%18.12f\n"
               "pixel2:%18.12f%18.12f%18.12f%18.12f\n",
          world1[k][0], world1[k][1], world1[k][2], world1[k][3],
          pixel1[k][0], pixel1[k][1], pixel1[k][2], pixel1[k][3],
          world2[k][0], world2[k][1], world2[k][2], world2[k][3],
          pixel2[k][0], pixel2[k][1], pixel2[k][2], pixel2[k][3]);
       }
    }
  }

  printf("wcsp2s/wcss2p: Maximum closure residual = %.1e pixel.\n", residmax);


  // The wcsprm is set in bypass mode (above), so wcsset() should return
  // immediately and hence not fail.
  int nFail2 = 0;
  wcs->pv[2].value = UNDEFINED;
  if ((status = wcsset(wcs))) {
    nFail2 = 1;
    printf("\nBypass mode failure in wcsset().\n");
  }


  // Test wcserr and wcsprintf() as well.
  wcsprintf_set(stdout);
  wcsprintf("\nIGNORE messages marked with 'OK', they test wcserr "
    "(and wcsprintf):\n");

  // Test 1 - take it out of bypass mode, so now wcsset() should fail.
  int nFail3 = 0;
  wcs->pv[2].value = UNDEFINED;
  wcs->flag = 0;
  status = wcsset(wcs);
  nFail3 += check_error(wcs, status, WCSERR_BAD_PARAM,
                        "Invalid parameter value");

  nFail3 += test_errors();


  printf("\n");
  int success = 1;
  if (nFail0) {
    success = 0;
    printf("FAIL: Unexpected result%s from wcsenq().\n",
           (nFail0 = 1) ? "" : "s");
  }

  if (nFail1) {
    success = 0;
    printf("FAIL: %d closure residuals exceed reporting tolerance.\n",
      nFail1);
  }

  if (nFail2) {
    success = 0;
    printf("FAIL: Bypass mode failure in wcsset().\n");
  }

  if (nFail3) {
    success = 0;
    printf("FAIL: %d error messages differ from that expected.\n", nFail3);
  }

  if (success) {
    printf("PASS: All enquiry results returned as expected.\n");
    printf("PASS: All closure residuals are within reporting tolerance.\n");
    printf("PASS: wcsset() in bypass mode operated as expected.\n");
    printf("PASS: All error messages reported as expected.\n");
  }


  // Clean up.
  wcsfree(wcs);
  free(wcs);

  return nFail0 + nFail1 + nFail2 + nFail3;
}

//----------------------------------------------------------------------------

void parser(wcs)

struct wcsprm *wcs;

{
  // In practice a parser would read the FITS header until it encountered
  // the NAXIS keyword which must occur near the start, before any of the
  // WCS keywords.  It would then use wcsini() to allocate memory for
  // arrays in the wcsprm struct and set default values.  In this
  // simulation the header keyvalues are set as global variables.
  wcsini(1, NAXIS, wcs);


  // Now the parser scans the FITS header, identifying WCS keywords and
  // loading their values into the appropriate elements of the wcsprm
  // struct.

  for (int j = 0; j < NAXIS; j++) {
    wcs->crpix[j] = CRPIX[j];
  }

  double *pcij = wcs->pc;
  for (int i = 0; i < NAXIS; i++) {
    for (int j = 0; j < NAXIS; j++) {
      *(pcij++) = PC[i][j];
    }
  }

  for (int i = 0; i < NAXIS; i++) {
    wcs->cdelt[i] = CDELT[i];
  }

  for (int i = 0; i < NAXIS; i++) {
    strncpy(wcs->ctype[i], &CTYPE[i][0], 72);
  }

  for (int i = 0; i < NAXIS; i++) {
    wcs->crval[i] = CRVAL[i];
  }

  wcs->lonpole = LONPOLE;
  wcs->latpole = LATPOLE;

  wcs->restfrq = RESTFRQ;
  wcs->restwav = RESTWAV;

  wcs->npv = NPV;
  for (int i = 0; i < NPV; i++) {
    wcs->pv[i] = PV[i];
  }

  return;
}

//----------------------------------------------------------------------------

int check_error(struct wcsprm *wcs, int status, int exstatus, char *exmsg)
{
  wcsprintf("\nTest %d...\n", ++itest);

  const char *errmsg = (status ? (wcs->err)->msg : "");
  if (status == exstatus && strcmp(errmsg, exmsg) == 0) {
    wcsperr(wcs, "OK: ");
    wcsprintf("...succeeded.\n");
  } else {
    wcsprintf("Expected error %d: '%s', got\n", exstatus, exmsg);
    wcsperr(wcs, "");
    wcsprintf("...failed.\n");
    return 1;
  }

  return 0;
}

//----------------------------------------------------------------------------

int test_errors()

{
  int nFail = 0, status;
  struct wcsprm wcs;

  // Test 2.
  wcs.flag = -1;
  status = wcsini(1, -32, &wcs);
  nFail += check_error(&wcs, status, WCSERR_BAD_PARAM,
             "naxis must not be negative (got -32)");

  // Test 3.
  wcs.flag = 0;
  status = wcsini(1, 2, &wcs);
  nFail += check_error(&wcs, status, WCSERR_SUCCESS, "");

  // Test 4.
  const char *(multiple_cubeface[2]) = {"CUBEFACE", "CUBEFACE"};
  for (int i = 0; i < 2; i++) {
    strncpy(wcs.ctype[i], &multiple_cubeface[i][0], 72);
  }
  status = wcsset(&wcs);
  nFail += check_error(&wcs, status, WCSERR_BAD_CTYPE,
             "Multiple CUBEFACE axes (in CTYPE1 and CTYPE2)");

  // Test 5.
  const char *(projection_code[2])   = {"RA---FOO", "DEC--BAR"};
  wcs.flag = 0;
  status = wcsini(1, 2, &wcs);
  for (int i = 0; i < 2; i++) {
    strncpy(wcs.ctype[i], &projection_code[i][0], 72);
  }
  status = wcsset(&wcs);
  nFail += check_error(&wcs, status, WCSERR_BAD_CTYPE,
             "Unrecognized projection code (FOO in CTYPE1)");

  // Test 6.
  const char *(unmatched[2])         = {"RA---TAN", "FREQ-LOG"};
  wcs.flag = 0;
  status = wcsini(1, 2, &wcs);
  for (int i = 0; i < 2; i++) {
    strncpy(wcs.ctype[i], &unmatched[i][0], 72);
  }
  status = wcsset(&wcs);
  nFail += check_error(&wcs, status, WCSERR_BAD_CTYPE,
             "Unmatched celestial axes");

  wcsfree(&wcs);

  return nFail;
}
@


8.6
log
@WCSLIB 8.6
@
text
@d2 1
a2 1
  WCSLIB 8.6 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 8.5.1.2 2026/03/29 13:36:17 mcalabre Exp mcalabre $
d31 3
a39 1
#include <wcsconfig_tests.h>
d424 1
a424 1
    strcpy(wcs->ctype[i], &CTYPE[i][0]);
d476 1
a476 1
  nFail += check_error(&wcs, status, WCSERR_MEMORY,
d487 1
a487 1
    strcpy(wcs.ctype[i], &multiple_cubeface[i][0]);
d498 1
a498 1
    strcpy(wcs.ctype[i], &projection_code[i][0]);
d509 1
a509 1
    strcpy(wcs.ctype[i], &unmatched[i][0]);
@


8.6.1.1
log
@WCSLIB 8.6 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.6 2026/03/29 13:53:56 mcalabre Exp $
@


8.6.1.2
log
@wcsinit() now returns WCSERR_BAD_PARAM instead of WCSERR_MEMORY if naxis is
negative.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.6.1.1 2026/03/29 14:19:27 mcalabre Exp mcalabre $
d474 1
a474 1
  nFail += check_error(&wcs, status, WCSERR_BAD_PARAM,
@


8.6.1.3
log
@Inconsequential changes prompted by clang-tidy:
 - Replaced use of strcpy() with strncpy()
   (clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling).
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.6.1.3 2026/04/11 15:16:07 mcalabre Exp mcalabre $
a30 3
// Must be included before anything else.
#include <wcsconfig_tests.h>

d37 1
d422 1
a422 1
    strncpy(wcs->ctype[i], &CTYPE[i][0], 72);
d485 1
a485 1
    strncpy(wcs.ctype[i], &multiple_cubeface[i][0], 72);
d496 1
a496 1
    strncpy(wcs.ctype[i], &projection_code[i][0], 72);
d507 1
a507 1
    strncpy(wcs.ctype[i], &unmatched[i][0], 72);
@


8.5
log
@WCSLIB 8.5
@
text
@d2 2
a3 2
  WCSLIB 8.5 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2025, Mark Calabretta
d22 2
a23 2
  http://www.atnf.csiro.au/people/Mark.Calabretta
  $Id: twcs.c,v 8.4.1.2 2025/12/06 13:37:17 mcalabre Exp mcalabre $
@


8.5.1.1
log
@WCSLIB 8.5 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.5 2025/12/06 13:47:41 mcalabre Exp $
@


8.5.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1995-2026, Mark Calabretta
d22 2
a23 2
  http://www.atnf.csiro.au/computing/software/wcs
  $Id: twcs.c,v 8.5.1.1 2025/12/06 14:05:16 mcalabre Exp mcalabre $
@


8.4
log
@WCSLIB 8.4
@
text
@d2 2
a3 2
  WCSLIB 8.4 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2024, Mark Calabretta
d23 1
a23 1
  $Id: twcs.c,v 8.3.1.2 2024/07/09 09:33:42 mcalabre Exp mcalabre $
@


8.4.1.1
log
@WCSLIB 8.4 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.4 2024/10/28 13:56:17 mcalabre Exp $
@


8.4.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1995-2025, Mark Calabretta
d23 1
a23 1
  $Id: twcs.c,v 8.4.1.1 2024/10/28 13:58:41 mcalabre Exp mcalabre $
@


8.3
log
@WCSLIB 8.3
@
text
@d2 1
a2 1
  WCSLIB 8.3 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 8.2.1.6 2024/05/13 12:39:14 mcalabre Exp mcalabre $
d207 3
a335 2

  wcserr_enable(1);
@


8.3.1.1
log
@WCSLIB 8.3 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.3 2024/05/13 16:33:00 mcalabre Exp $
@


8.3.1.2
log
@Move the call to wcserr_enable() to before the first potential use
of wcsperr().
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.3.1.1 2024/05/13 16:35:40 mcalabre Exp mcalabre $
a206 3
  // Enable error messaging.
  wcserr_enable(1);

d333 2
@


8.2
log
@WCSLIB 8.2
@
text
@d2 2
a3 2
  WCSLIB 8.2 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2023, Mark Calabretta
d23 1
a23 1
  $Id: twcs.c,v 8.1.1.1 2023/07/05 17:15:00 mcalabre Exp mcalabre $
d40 2
d75 1
a75 10
#define NELEM 9

  char   ok[] = "", mismatch[] = " (WARNING, mismatch)", *s;
  int    i, k, lat, lng, nFail1 = 0, nFail2 = 0, stat[361], status, ver[3];
  double freq, img[361][NELEM], lat1, lng1, phi[361], pixel1[361][NELEM],
         pixel2[361][NELEM], r, resid, residmax, theta[361], time,
         world1[361][NELEM], world2[361][NELEM];
  struct wcsprm *wcs;


d85 1
d110 2
a111 1
  s = (sizeof(struct auxprm) == sizeof(int)*AUXLEN) ? ok : mismatch;
d171 2
d196 1
a196 1
  wcs = malloc(sizeof(struct wcsprm));
d200 34
a233 1
  printf("\nReporting tolerance %5.1g pixel.\n", tol);
d235 2
d239 4
a242 3
  time = 1.0;
  freq = 1.42040595e9 - 180.0 * 62500.0;
  for (k = 0; k < 361; k++) {
d255 6
a260 3
  residmax = 0.0;
  for (lat = 90; lat >= -90; lat--) {
    lat1 = (double)lat;
d262 1
d264 1
a264 1
      lng1 = (double)lng;
d292 3
a294 3
      resid = 0.0;
      for (i = 0; i < NAXIS; i++) {
        r = pixel2[k][i] - pixel1[k][i];
d319 10
a329 1
  nFail2 = 0;
d331 1
a331 1
  wcsprintf("\n\nIGNORE messages marked with 'OK', they test wcserr "
d336 2
a337 1
  // Test 1.
d339 1
d341 1
a341 1
  nFail2 += check_error(wcs, status, WCSERR_BAD_PARAM,
d344 1
a344 1
  nFail2 += test_errors();
d347 23
a369 5
  if (nFail1 || nFail2) {
    if (nFail1) {
      printf("\nFAIL: %d closure residuals exceed reporting tolerance.\n",
        nFail1);
    }
d371 4
a374 5
    if (nFail2) {
      printf("FAIL: %d error messages differ from that expected.\n", nFail2);
    }
  } else {
    printf("\nPASS: All closure residuals are within reporting tolerance.\n");
d383 1
a383 1
  return nFail1 + nFail2;
a392 3
  int i, j;
  double *pcij;

d405 1
a405 1
  for (j = 0; j < NAXIS; j++) {
d409 3
a411 3
  pcij = wcs->pc;
  for (i = 0; i < NAXIS; i++) {
    for (j = 0; j < NAXIS; j++) {
d416 1
a416 1
  for (i = 0; i < NAXIS; i++) {
d420 1
a420 1
  for (i = 0; i < NAXIS; i++) {
d424 1
a424 1
  for (i = 0; i < NAXIS; i++) {
d435 1
a435 1
  for (i = 0; i < NPV; i++) {
a438 5
  // Extract information from the FITS header.
  if (wcsset(wcs)) {
    wcsperr(wcs, "");
  }

a445 2
  const char *errmsg = (status ? (wcs->err)->msg : "");

d448 1
d467 1
a467 4
  const char *(multiple_cubeface[2]) = {"CUBEFACE", "CUBEFACE"};
  const char *(projection_code[2])   = {"RA---FOO", "DEC--BAR"};
  const char *(unmatched[2])         = {"RA---TAN", "FREQ-LOG"};
  int i, nFail = 0, status;
d482 2
a483 1
  for (i = 0; i < 2; i++) {
d491 1
d494 1
a494 1
  for (i = 0; i < 2; i++) {
d502 1
d505 1
a505 1
  for (i = 0; i < 2; i++) {
@


8.2.1.1
log
@WCSLIB 8.2 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.2 2023/11/16 10:00:30 mcalabre Exp $
@


8.2.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1995-2024, Mark Calabretta
d23 1
a23 1
  $Id: twcs.c,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $
@


8.2.1.3
log
@Converted to C99-style intermingled variable declarations.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.2.1.2 2024/04/02 14:06:10 mcalabre Exp mcalabre $
a39 2
#define NELEM 9

d73 10
a82 1
  int ver[3];
a91 1
  int status;
d116 1
a116 2
  char ok[] = "", mismatch[] = " (WARNING, mismatch)";
  char *s = (sizeof(struct auxprm) == sizeof(int)*AUXLEN) ? ok : mismatch;
d199 1
a199 1
  struct wcsprm *wcs = malloc(sizeof(struct wcsprm));
d207 3
a209 4
  double time = 1.0;
  double freq = 1.42040595e9 - 180.0 * 62500.0;
  double world1[361][NELEM], world2[361][NELEM];
  for (int k = 0; k < 361; k++) {
d222 3
a224 6
  int nFail1 = 0, nFail2 = 0, stat[361];
  double residmax = 0.0;
  double img[361][NELEM], pixel1[361][NELEM], pixel2[361][NELEM];
  double phi[361], theta[361];
  for (int lat = 90; lat >= -90; lat--) {
    double lat1 = (double)lat;
a225 1
    int k, lng;
d227 1
a227 1
      double lng1 = (double)lng;
d255 3
a257 3
      double resid = 0.0;
      for (int i = 0; i < NAXIS; i++) {
        double r = pixel2[k][i] - pixel1[k][i];
d328 3
d343 1
a343 1
  for (int j = 0; j < NAXIS; j++) {
d347 3
a349 3
  double *pcij = wcs->pc;
  for (int i = 0; i < NAXIS; i++) {
    for (int j = 0; j < NAXIS; j++) {
d354 1
a354 1
  for (int i = 0; i < NAXIS; i++) {
d358 1
a358 1
  for (int i = 0; i < NAXIS; i++) {
d362 1
a362 1
  for (int i = 0; i < NAXIS; i++) {
d373 1
a373 1
  for (int i = 0; i < NPV; i++) {
d389 2
a392 1
  const char *errmsg = (status ? (wcs->err)->msg : "");
d411 4
a414 1
  int nFail = 0, status;
d429 1
a429 2
  const char *(multiple_cubeface[2]) = {"CUBEFACE", "CUBEFACE"};
  for (int i = 0; i < 2; i++) {
a436 1
  const char *(projection_code[2])   = {"RA---FOO", "DEC--BAR"};
d439 1
a439 1
  for (int i = 0; i < 2; i++) {
a446 1
  const char *(unmatched[2])         = {"RA---TAN", "FREQ-LOG"};
d449 1
a449 1
  for (int i = 0; i < 2; i++) {
@


8.2.1.4
log
@Test wcsenq() and also test wcsset() in bypass mode.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.2.1.3 2024/05/10 05:03:54 mcalabre Exp mcalabre $
a170 2
  printf("\n");

d198 1
a198 6
  // Test wcsenq() - note that the struct is unset.
  int nFail0 = 0;
  if (!wcsenq(wcs, WCSENQ_MEM)) {
    nFail0++;
    printf("Unexpected result from wcsenq(): memory.\n");
  }
a199 15
  // Put the struct in bypass mode (as a test).
  wcs->flag = 1;
  if (wcsset(wcs)) {
    wcsperr(wcs, "");
  }

  // Test wcsenq().
  if (!wcsenq(wcs, WCSENQ_SET | WCSENQ_BYP)) {
    nFail0++;
    printf("Unexpected result from wcsenq(): set and bypass.\n");
  }


  if (nFail0) printf("\n");
  printf("Reporting tolerance %5.1g pixel.\n", tol);
d218 1
a218 1
  int nFail1 = 0, stat[361];
a281 10
  // The wcsprm is set in bypass mode (above), so wcsset() should return
  // immediately and hence not fail.
  int nFail2 = 0;
  wcs->pv[2].value = UNDEFINED;
  if (status = wcsset(wcs)) {
    nFail2 = 1;
    printf("\nBypass mode failure in wcsset().\n");
  }


d283 1
d285 1
a285 1
  wcsprintf("\nIGNORE messages marked with 'OK', they test wcserr "
d290 1
a290 2
  // Test 1 - take it out of bypass mode, so now wcsset() should fail.
  int nFail3 = 0;
a291 1
  wcs->flag = 0;
d293 1
a293 1
  nFail3 += check_error(wcs, status, WCSERR_BAD_PARAM,
d296 1
a296 1
  nFail3 += test_errors();
d299 5
a303 7
  printf("\n");
  int success = 1;
  if (nFail0) {
    success = 0;
    printf("FAIL: Unexpected result%s from wcsenq().\n",
           (nFail0 = 1) ? "" : "s");
  }
d305 5
a309 20
  if (nFail1) {
    success = 0;
    printf("FAIL: %d closure residuals exceed reporting tolerance.\n",
      nFail1);
  }

  if (nFail2) {
    success = 0;
    printf("FAIL: Bypass mode failure in wcsset().\n");
  }

  if (nFail3) {
    success = 0;
    printf("FAIL: %d error messages differ from that expected.\n", nFail3);
  }

  if (success) {
    printf("PASS: Enquiry results returned as expected.\n");
    printf("PASS: All closure residuals are within reporting tolerance.\n");
    printf("PASS: wcsset() in bypass mode operated as expected.\n");
d318 1
a318 1
  return nFail0 + nFail1 + nFail2 + nFail3;
d372 5
@


8.2.1.5
log
@Compiler balm.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.2.1.4 2024/05/10 14:25:46 mcalabre Exp mcalabre $
d308 1
a308 1
  if ((status = wcsset(wcs))) {
@


8.2.1.6
log
@Invoke wcstrim() after wcsset().  Added tests for wcsenq() with WCSENQ_CHK.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.2.1.5 2024/05/10 15:24:18 mcalabre Exp mcalabre $
a212 3
  // Tidy up the wcsprm struct.
  wcstrim(wcs);

a218 12
  if (!wcsenq(wcs, WCSENQ_CHK)) {
    nFail0++;
    printf("Unexpected result from wcsenq(): checksum (a).\n");
  }

  // Further test for wcsenq() - an inconsequential change.
  wcs->latpole = 999.001;
  if (wcsenq(wcs, WCSENQ_CHK)) {
    nFail0++;
    printf("Unexpected result from wcsenq(): checksum (b).\n");
  }

d357 1
a357 1
    printf("PASS: All enquiry results returned as expected.\n");
@


8.1
log
@WCSLIB 8.1
@
text
@d2 1
a2 1
  WCSLIB 8.1 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 8.0.1.1 2023/07/01 06:22:44 mcalabre Exp mcalabre $
@


8.1.1.1
log
@WCSLIB 8.1 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $
@


8.0
log
@WCSLIB 8.0
@
text
@d2 1
a2 1
  WCSLIB 8.0 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.13.1.2 2023/06/15 04:17:20 mcalabre Exp mcalabre $
@


8.0.1.1
log
@WCSLIB 8.0 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 8.0 2023/07/01 06:15:05 mcalabre Exp $
@


7.13
log
@WCSLIB 7.13
@
text
@d2 2
a3 2
  WCSLIB 7.13 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2022, Mark Calabretta
d23 1
a23 1
  $Id: twcs.c,v 7.12.1.1 2022/09/09 05:00:36 mcalabre Exp mcalabre $
@


7.13.1.1
log
@WCSLIB 7.13 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.13 2022/10/07 03:43:35 mcalabre Exp $
@


7.13.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1995-2023, Mark Calabretta
d23 1
a23 1
  $Id: twcs.c,v 7.13.1.1 2022/10/07 03:45:47 mcalabre Exp mcalabre $
@


7.12
log
@WCSLIB 7.12
@
text
@d2 1
a2 1
  WCSLIB 7.12 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.11.1.1 2022/04/26 06:15:32 mcalabre Exp mcalabre $
@


7.12.1.1
log
@WCSLIB 7.12 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.12 2022/09/09 04:57:58 mcalabre Exp $
@


7.11
log
@WCSLIB 7.11
@
text
@d2 1
a2 1
  WCSLIB 7.11 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.10.1.1 2022/04/23 14:26:54 mcalabre Exp mcalabre $
@


7.11.1.1
log
@WCSLIB 7.11 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.11 2022/04/26 06:13:52 mcalabre Exp $
@


7.10
log
@WCSLIB 7.10
@
text
@d2 1
a2 1
  WCSLIB 7.10 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.9.1.1 2022/03/25 15:16:40 mcalabre Exp mcalabre $
@


7.10.1.1
log
@WCSLIB 7.10 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.10 2022/04/23 14:25:15 mcalabre Exp $
@


7.9
log
@WCSLIB 7.9
@
text
@d2 1
a2 1
  WCSLIB 7.9 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.8.1.1 2022/03/25 06:14:15 mcalabre Exp mcalabre $
@


7.9.1.1
log
@WCSLIB 7.9 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.9 2022/03/25 15:14:49 mcalabre Exp $
@


7.8
log
@WCSLIB 7.8
@
text
@d2 1
a2 1
  WCSLIB 7.8 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.7.1.2 2022/03/25 06:06:00 mcalabre Exp mcalabre $
@


7.8.1.1
log
@WCSLIB 7.8 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.8 2022/03/25 06:11:49 mcalabre Exp $
@


7.7
log
@WCSLIB 7.7
@
text
@d2 2
a3 2
  WCSLIB 7.7 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2021, Mark Calabretta
d23 1
a23 1
  $Id: twcs.c,v 7.6.1.1 2021/04/13 13:00:36 mcalabre Exp mcalabre $
@


7.7.1.1
log
@WCSLIB 7.7 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $
@


7.7.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1995-2022, Mark Calabretta
d23 1
a23 1
  $Id: twcs.c,v 7.7.1.1 2021/07/12 06:38:27 mcalabre Exp mcalabre $
@


7.6
log
@WCSLIB 7.6
@
text
@d2 1
a2 1
  WCSLIB 7.6 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.5.1.1 2021/03/20 05:56:42 mcalabre Exp mcalabre $
@


7.6.1.1
log
@WCSLIB 7.6 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $
@


7.5
log
@WCSLIB 7.5
@
text
@d2 1
a2 1
  WCSLIB 7.5 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.4.1.1 2021/01/31 02:26:24 mcalabre Exp mcalabre $
@


7.5.1.1
log
@WCSLIB 7.5 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.5 2021/03/20 05:54:58 mcalabre Exp $
@


7.4
log
@WCSLIB 7.4
@
text
@d2 1
a2 1
  WCSLIB 7.4 - an implementation of the FITS WCS standard.
d23 1
a23 1
  $Id: twcs.c,v 7.3.1.4 2021/01/28 12:31:20 mcalabre Exp mcalabre $
@


7.4.1.1
log
@WCSLIB 7.4 development branch.
@
text
@d23 1
a23 1
  $Id: twcs.c,v 7.4 2021/01/31 02:24:52 mcalabre Exp $
@


7.3
log
@WCSLIB 7.3
@
text
@d2 2
a3 3

  WCSLIB 7.3 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2020, Mark Calabretta
a19 2
  Direct correspondence concerning WCSLIB to mark@@calabretta.id.au

d23 1
a23 1
  $Id: twcs.c,v 7.2.1.1 2020/03/09 07:34:50 mcalabre Exp mcalabre $
d44 1
a44 1
/* Reporting tolerance. */
d48 1
a48 1
/* In real life these would be encoded as FITS header keyrecords. */
d66 1
a66 1
struct pvcard PV[3];		/* Projection parameters are set in main(). */
d91 1
a91 1
  /* List status return messages. */
d177 19
a195 19
  /* Set the PVi_ma keyvalues for the longitude axis.         */
  /*----------------------------------------------------------*/
  /* For test purposes, these are set so that the fiducial    */
  /* native coordinates are at the native pole, i.e. so that  */
  /* (phi0,theta0) = (0,90), but without any fiducial offset, */
  /* i.e. iwith PVi_0a == 0 (by default).                     */
  /*----------------------------------------------------------*/
  PV[0].i = 4;			/* Longitude is on axis 4.     */
  PV[0].m = 1;			/* Parameter number 1.         */
  PV[0].value =  0.0;		/* Fiducial native longitude.  */

  PV[1].i = 4;			/* Longitude is on axis 4.     */
  PV[1].m = 2;			/* Parameter number 2.         */
  PV[1].value = 90.0;		/* Fiducial native latitude.   */

  /* Set the PVi_m keyvaluess for the latitude axis.          */
  PV[2].i = 2;			/* Latitude is on axis 2.      */
  PV[2].m = 1;			/* Parameter number 1.         */
  PV[2].value = -30.0;		/* PVi_1.                      */
d198 1
a198 1
  /* The following routine simulates the actions of a FITS header parser. */
d206 1
a206 1
  /* Initialize non-celestial world coordinates. */
d282 1
a282 1
  /* Test wcserr and wcsprintf() as well. */
d290 1
a290 1
  /* Test 1. */
d314 1
a314 1
  /* Clean up. */
d321 1
a321 1
/*--------------------------------------------------------------------------*/
d331 5
a335 5
  /* In practice a parser would read the FITS header until it encountered  */
  /* the NAXIS keyword which must occur near the start, before any of the  */
  /* WCS keywords.  It would then use wcsini() to allocate memory for      */
  /* arrays in the wcsprm struct and set default values.  In this          */
  /* simulation the header keyvalues are set as global variables.          */
d339 3
a341 3
  /* Now the parser scans the FITS header, identifying WCS keywords and    */
  /* loading their values into the appropriate elements of the wcsprm      */
  /* struct.                                                               */
d377 1
a377 1
  /* Extract information from the FITS header. */
d385 1
a385 1
/*--------------------------------------------------------------------------*/
d406 1
a406 1
/*--------------------------------------------------------------------------*/
d417 1
a417 1
  /* Test 2. */
d423 1
a423 1
  /* Test 3. */
d428 1
a428 1
  /* Test 4. */
d436 1
a436 1
  /* Test 5. */
d446 1
a446 1
  /* Test 6. */
@


7.3.1.1
log
@WCSLIB 7.3 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 7.3 2020/06/03 03:37:03 mcalabre Exp $
@


7.3.1.2
log
@Switched to C99 style commenting (i.e. using //) within the code.
@
text
@d2 1
d26 1
a26 1
  $Id: twcs.c,v 7.3.1.1 2020/06/03 03:38:11 mcalabre Exp mcalabre $
d47 1
a47 1
// Reporting tolerance.
d51 1
a51 1
// In real life these would be encoded as FITS header keyrecords.
d69 1
a69 1
struct pvcard PV[3];		// Projection parameters are set in main().
d94 1
a94 1
  // List status return messages.
d180 19
a198 19
  // Set the PVi_ma keyvalues for the longitude axis.
  //------------------------------------------------------------
  // For test purposes, these are set so that the fiducial
  // native coordinates are at the native pole, i.e. so that
  // (phi0,theta0) = (0,90), but without any fiducial offset,
  // i.e. iwith PVi_0a == 0 (by default).
  //------------------------------------------------------------
  PV[0].i = 4;			// Longitude is on axis 4.
  PV[0].m = 1;			// Parameter number 1.
  PV[0].value =  0.0;		// Fiducial native longitude.

  PV[1].i = 4;			// Longitude is on axis 4.
  PV[1].m = 2;			// Parameter number 2.
  PV[1].value = 90.0;		// Fiducial native latitude.

  // Set the PVi_m keyvaluess for the latitude axis.
  PV[2].i = 2;			// Latitude is on axis 2.
  PV[2].m = 1;			// Parameter number 1.
  PV[2].value = -30.0;		// PVi_1.
d201 1
a201 1
  // The following routine simulates the actions of a FITS header parser.
d209 1
a209 1
  // Initialize non-celestial world coordinates.
d285 1
a285 1
  // Test wcserr and wcsprintf() as well.
d293 1
a293 1
  // Test 1.
d317 1
a317 1
  // Clean up.
d324 1
a324 1
//----------------------------------------------------------------------------
d334 5
a338 5
  // In practice a parser would read the FITS header until it encountered
  // the NAXIS keyword which must occur near the start, before any of the
  // WCS keywords.  It would then use wcsini() to allocate memory for
  // arrays in the wcsprm struct and set default values.  In this
  // simulation the header keyvalues are set as global variables.
d342 3
a344 3
  // Now the parser scans the FITS header, identifying WCS keywords and
  // loading their values into the appropriate elements of the wcsprm
  // struct.
d380 1
a380 1
  // Extract information from the FITS header.
d388 1
a388 1
//----------------------------------------------------------------------------
d409 1
a409 1
//----------------------------------------------------------------------------
d420 1
a420 1
  // Test 2.
d426 1
a426 1
  // Test 3.
d431 1
a431 1
  // Test 4.
d439 1
a439 1
  // Test 5.
d449 1
a449 1
  // Test 6.
@


7.3.1.3
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1995-2021, Mark Calabretta
d25 1
a25 1
  $Id: twcs.c,v 7.3.1.2 2020/08/17 11:20:48 mcalabre Exp mcalabre $
@


7.3.1.4
log
@Removed my email address from the copyright notice.
@
text
@d20 2
d25 1
a25 1
  $Id: twcs.c,v 7.3.1.3 2021/01/19 14:10:01 mcalabre Exp mcalabre $
@


7.2
log
@WCSLIB 7.2
@
text
@d3 1
a3 1
  WCSLIB 7.2 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 7.1.1.1 2019/12/31 13:28:19 mcalabre Exp mcalabre $
@


7.2.1.1
log
@WCSLIB 7.2 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 7.2 2020/03/09 07:31:23 mcalabre Exp $
@


7.1
log
@WCSLIB 7.1
@
text
@d3 1
a3 1
  WCSLIB 7.1 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 6.4.1.3 2019/12/31 03:28:29 mcalabre Exp mcalabre $
@


7.1.1.1
log
@WCSLIB 7.1 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 7.1 2019/12/31 13:25:19 mcalabre Exp $
@


6.4
log
@WCSLIB 6.4
@
text
@d3 2
a4 2
  WCSLIB 6.4 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2019, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 6.3.1.1 2019/07/12 07:34:37 mcalabre Exp mcalabre $
d105 1
d118 4
@


6.4.1.1
log
@WCSLIB 6.4 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 6.4 2019/08/15 09:30:18 mcalabre Exp $
@


6.4.1.2
log
@Print sizeof long long int and struct auxprm.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 6.4.1.1 2019/08/15 09:31:29 mcalabre Exp mcalabre $
a104 1
  printf("  long long int:%5"MODZ"u\n", sizeof(long long int));
a116 4

  s = (sizeof(struct auxprm) == sizeof(int)*AUXLEN) ? ok : mismatch;
  printf("         auxprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct auxprm),
         AUXLEN, s);
@


6.4.1.3
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2020, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 6.4.1.2 2019/12/31 02:38:22 mcalabre Exp mcalabre $
@


6.3
log
@WCSLIB 6.3
@
text
@d3 1
a3 1
  WCSLIB 6.3 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 6.2.1.2 2019/05/10 02:01:28 mcalabre Exp mcalabre $
@


6.3.1.1
log
@WCSLIB 6.3 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 6.3 2019/07/12 07:33:39 mcalabre Exp $
@


6.2
log
@WCSLIB 6.2
@
text
@d3 2
a4 2
  WCSLIB 6.2 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2018, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 6.1.1.1 2018/10/19 08:36:15 mcalabre Exp mcalabre $
@


6.2.1.1
log
@WCSLIB 6.2 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 6.2 2018/10/20 10:03:14 mcalabre Exp $
@


6.2.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2019, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 6.2.1.1 2018/10/20 10:04:15 mcalabre Exp mcalabre $
@


6.1
log
@WCSLIB 6.1
@
text
@d3 1
a3 1
  WCSLIB 6.1 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.20.1.1 2018/10/05 05:33:33 mcalabre Exp mcalabre $
@


6.1.1.1
log
@WCSLIB 6.1 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 6.1 2018/10/19 08:35:17 mcalabre Exp $
@


5.20
log
@WCSLIB 5.20
@
text
@d3 1
a3 1
  WCSLIB 5.20 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.19.1.1 2018/07/26 15:41:41 mcalabre Exp mcalabre $
@


5.20.1.1
log
@WCSLIB 5.20 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.20 2018/10/05 05:32:41 mcalabre Exp $
@


5.19
log
@WCSLIB 5.19
@
text
@d3 1
a3 1
  WCSLIB 5.19 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.18.1.1 2018/01/10 08:33:04 mcalabre Exp mcalabre $
@


5.19.1.1
log
@WCSLIB 5.19 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.19 2018/07/26 15:37:05 mcalabre Exp $
@


5.18
log
@WCSLIB 5.18
@
text
@d3 1
a3 1
  WCSLIB 5.18 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.17.1.2 2018/01/10 08:26:04 mcalabre Exp mcalabre $
@


5.18.1.1
log
@WCSLIB 5.18 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.18 2018/01/10 08:32:14 mcalabre Exp $
@


5.17
log
@WCSLIB 5.17
@
text
@d3 2
a4 2
  WCSLIB 5.17 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2017, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 5.16.1.1 2017/01/15 04:29:01 mcalabre Exp mcalabre $
@


5.17.1.1
log
@WCSLIB 5.17 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.17 2017/09/18 08:44:24 mcalabre Exp $
@


5.17.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2018, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 5.17.1.1 2017/09/18 08:46:00 mcalabre Exp mcalabre $
@


5.16
log
@WCSLIB 5.16
@
text
@d3 1
a3 1
  WCSLIB 5.16 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.15.1.2 2017/01/15 04:14:22 mcalabre Exp mcalabre $
@


5.16.1.1
log
@WCSLIB 5.16 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.16 2017/01/15 04:25:02 mcalabre Exp $
@


5.15
log
@WCSLIB 5.15
@
text
@d3 2
a4 2
  WCSLIB 5.15 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2016, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 5.14.1.1 2016/02/07 10:52:46 mcalabre Exp mcalabre $
@


5.15.1.1
log
@WCSLIB 5.15 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.15 2016/04/05 12:55:11 mcalabre Exp $
@


5.15.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2017, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 5.15.1.1 2016/04/05 12:58:37 mcalabre Exp mcalabre $
@


5.14
log
@WCSLIB 5.14
@
text
@d3 1
a3 1
  WCSLIB 5.14 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.13.1.1 2016/01/26 08:54:34 mcalabre Exp mcalabre $
@


5.14.1.1
log
@WCSLIB 5.14 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.14 2016/02/07 10:49:32 mcalabre Exp $
@


5.13
log
@WCSLIB 5.13
@
text
@d3 1
a3 1
  WCSLIB 5.13 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.12.1.2 2016/01/25 05:17:40 mcalabre Exp mcalabre $
@


5.13.1.1
log
@WCSLIB 5.13 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.13 2016/01/26 08:51:15 mcalabre Exp $
@


5.12
log
@WCSLIB 5.12
@
text
@d3 2
a4 2
  WCSLIB 5.12 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2015, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 5.11.1.1 2015/10/18 09:16:29 mcalabre Exp mcalabre $
@


5.12.1.1
log
@WCSLIB 5.12 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.12 2015/11/15 02:13:01 mcalabre Exp $
@


5.12.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2016, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 5.12.1.1 2015/11/15 02:16:16 mcalabre Exp mcalabre $
@


5.11
log
@WCSLIB 5.11
@
text
@d3 1
a3 1
  WCSLIB 5.11 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.10.1.1 2015/10/09 08:22:37 mcalabre Exp mcalabre $
@


5.11.1.1
log
@WCSLIB 5.11 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.11 2015/10/18 09:13:06 mcalabre Exp $
@


5.10
log
@WCSLIB 5.10
@
text
@d3 1
a3 1
  WCSLIB 5.10 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.9.1.1 2015/07/21 09:28:10 mcalabre Exp mcalabre $
@


5.10.1.1
log
@WCSLIB 5.10 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.10 2015/10/09 08:19:16 mcalabre Exp $
@


5.9
log
@WCSLIB 5.9
@
text
@d3 1
a3 1
  WCSLIB 5.9 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.8.1.1 2015/07/08 11:07:20 mcalabre Exp mcalabre $
@


5.9.1.1
log
@WCSLIB 5.9 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.9 2015/07/21 09:20:03 mcalabre Exp $
@


5.8
log
@WCSLIB 5.8
@
text
@d3 1
a3 1
  WCSLIB 5.8 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.7.1.1 2015/06/29 02:47:25 mcalabre Exp mcalabre $
@


5.8.1.1
log
@WCSLIB 5.8 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.8 2015/07/08 11:04:01 mcalabre Exp $
@


5.7
log
@WCSLIB 5.7
@
text
@d3 1
a3 1
  WCSLIB 5.7 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.6.1.1 2015/06/14 07:14:46 mcalabre Exp mcalabre $
@


5.7.1.1
log
@WCSLIB 5.7 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.7 2015/06/29 02:44:17 mcalabre Exp $
@


5.6
log
@WCSLIB 5.6
@
text
@d3 1
a3 1
  WCSLIB 5.6 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.5.1.1 2015/05/05 13:21:02 mcalabre Exp mcalabre $
@


5.6.1.1
log
@WCSLIB 5.6 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.6 2015/06/14 07:11:25 mcalabre Exp $
@


5.5
log
@WCSLIB 5.5
@
text
@d3 1
a3 1
  WCSLIB 5.5 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.4.1.1 2015/04/21 14:44:29 mcalabre Exp mcalabre $
@


5.5.1.1
log
@WCSLIB 5.5 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.5 2015/05/05 13:16:32 mcalabre Exp $
@


5.4
log
@WCSLIB 5.4
@
text
@d3 1
a3 1
  WCSLIB 5.4 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.3.1.1 2015/04/21 02:54:03 mcalabre Exp mcalabre $
@


5.4.1.1
log
@WCSLIB 5.4 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.4 2015/04/21 14:41:06 mcalabre Exp $
@


5.3
log
@WCSLIB 5.3
@
text
@d3 1
a3 1
  WCSLIB 5.3 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.2.1.1 2015/04/15 12:39:16 mcalabre Exp mcalabre $
@


5.3.1.1
log
@WCSLIB 5.3 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.3 2015/04/21 02:50:52 mcalabre Exp $
@


5.2
log
@WCSLIB 5.2
@
text
@d3 1
a3 1
  WCSLIB 5.2 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.1.1.2 2015/04/15 09:26:11 mcalabre Exp mcalabre $
@


5.2.1.1
log
@WCSLIB 5.2 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.2 2015/04/15 12:35:08 mcalabre Exp $
@


5.1
log
@WCSLIB 5.1
@
text
@d3 1
a3 1
  WCSLIB 5.1 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 5.0.1.1 2015/04/05 12:28:02 mcalabre Exp mcalabre $
d112 1
d126 4
d145 8
@


5.1.1.1
log
@WCSLIB 5.1 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.1 2015/04/07 10:56:38 mcalabre Exp $
@


5.1.1.2
log
@Print the size of the dpkey struct, and check dpkey, pvcard, and pscard.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.1.1.1 2015/04/07 11:01:11 mcalabre Exp mcalabre $
a111 1
  printf("struct  dpkey *:%5"MODZ"u\n", sizeof(struct dpkey *));
a124 4
  s = (sizeof(struct dpkey)  == sizeof(int)*DPLEN)  ? ok : mismatch;
  printf("          dpkey:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct dpkey),
         DPLEN, s);

a139 8

  s = (sizeof(struct pscard) == sizeof(int)*PSLEN)  ? ok : mismatch;
  printf("         pscard:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct pscard),
         PSLEN, s);

  s = (sizeof(struct pvcard) == sizeof(int)*PVLEN)  ? ok : mismatch;
  printf("         pvcard:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct pvcard),
         PVLEN, s);
@


5.0
log
@WCSLIB 5.0
@
text
@d3 1
a3 1
  WCSLIB 5.0 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.25.1.5 2015/04/03 03:21:31 mcalabre Exp mcalabre $
@


5.0.1.1
log
@WCSLIB 5.0 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 5.0 2015/04/05 12:25:01 mcalabre Exp $
@


4.25
log
@WCSLIB 4.25
@
text
@d3 2
a4 2
  WCSLIB 4.25 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2014, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 4.24.1.1 2014/09/18 15:28:11 mcalabre Exp mcalabre $
d79 1
a79 1
  int    i, k, lat, lng, nFail1 = 0, nFail2 = 0, stat[361], status;
d86 3
d121 4
d440 2
@


4.25.1.1
log
@WCSLIB 4.25 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.25 2014/12/14 14:29:37 mcalabre Exp $
@


4.25.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2015, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 4.25.1.1 2014/12/14 14:32:46 mcalabre Exp mcalabre $
@


4.25.1.3
log
@Exercise wcslib_version().
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.25.1.2 2015/01/06 01:01:52 mcalabre Exp mcalabre $
d79 1
a79 1
  int    i, k, lat, lng, nFail1 = 0, nFail2 = 0, stat[361], status, ver[3];
a84 3

  printf("WCSLIB version number: %s", wcslib_version(ver));
  printf(" (%d,%d,%d)\n\n", ver[0], ver[1], ver[2]);
@


4.25.1.4
log
@In test_errors(), call wcsfree() at the end to avoid reports of memory
leaks from valgrind.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.25.1.3 2015/03/05 08:22:06 mcalabre Exp mcalabre $
a435 2

  wcsfree(&wcs);
@


4.25.1.5
log
@Report the size of the disprm struct.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.25.1.4 2015/03/06 00:10:11 mcalabre Exp mcalabre $
a119 4

  s = (sizeof(struct disprm) == sizeof(int)*DISLEN) ? ok : mismatch;
  printf("         disprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct disprm),
         DISLEN, s);
@


4.24
log
@WCSLIB 4.24
@
text
@d3 1
a3 1
  WCSLIB 4.24 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.23.1.1 2014/05/13 05:53:51 mcalabre Exp mcalabre $
@


4.24.1.1
log
@WCSLIB 4.24 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.24 2014/09/18 15:25:01 mcalabre Exp $
@


4.23
log
@WCSLIB 4.23
@
text
@d3 1
a3 1
  WCSLIB 4.23 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.22.1.1 2014/04/12 15:06:33 mcalabre Exp mcalabre $
@


4.23.1.1
log
@WCSLIB 4.23 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.23 2014/05/13 05:50:52 mcalabre Exp $
@


4.22
log
@WCSLIB 4.22
@
text
@d3 1
a3 1
  WCSLIB 4.22 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.21.1.1 2014/03/24 05:15:29 mcalabre Exp mcalabre $
@


4.22.1.1
log
@WCSLIB 4.22 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.22 2014/04/12 15:03:53 mcalabre Exp $
@


4.21
log
@WCSLIB 4.21
@
text
@d3 1
a3 1
  WCSLIB 4.21 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.20.1.2 2014/03/21 06:26:03 mcalabre Exp mcalabre $
@


4.21.1.1
log
@WCSLIB 4.21 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.21 2014/03/24 05:12:28 mcalabre Exp $
@


4.20
log
@WCSLIB 4.20
@
text
@d3 2
a4 2
  WCSLIB 4.20 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2013, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 4.19.1.1 2013/09/29 14:20:40 mcalabre Exp mcalabre $
@


4.20.1.1
log
@WCSLIB 4.20 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.20 2013/12/18 05:42:50 mcalabre Exp $
@


4.20.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2014, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 4.20.1.1 2013/12/18 05:46:56 mcalabre Exp mcalabre $
@


4.19
log
@WCSLIB 4.19
@
text
@d3 1
a3 1
  WCSLIB 4.19 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.18.1.1 2013/07/13 10:02:38 mcalabre Exp mcalabre $
@


4.19.1.1
log
@WCSLIB 4.19 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $
@


4.18
log
@WCSLIB 4.18
@
text
@d3 1
a3 1
  WCSLIB 4.18 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.17.1.1 2013/01/29 05:32:33 cal103 Exp cal103 $
@


4.18.1.1
log
@WCSLIB 4.18 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.18 2013/07/13 10:00:05 mcalabre Exp $
@


4.17
log
@WCSLIB 4.17
@
text
@d3 1
a3 1
  WCSLIB 4.17 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.16.1.2 2013/01/29 05:10:40 cal103 Exp cal103 $
@


4.17.1.1
log
@WCSLIB 4.17 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.17 2013/01/29 05:29:21 cal103 Exp $
@


4.16
log
@WCSLIB 4.16
@
text
@d3 2
a4 2
  WCSLIB 4.16 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2012, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 4.15.1.1 2012/09/26 14:27:52 cal103 Exp cal103 $
@


4.16.1.1
log
@WCSLIB 4.16 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.16 2012/11/07 04:42:45 cal103 Exp $
@


4.16.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2013, Mark Calabretta
d26 1
a26 1
  $Id: twcs.c,v 4.16.1.1 2012/11/07 04:45:57 cal103 Exp cal103 $
@


4.15
log
@WCSLIB 4.15
@
text
@d3 1
a3 1
  WCSLIB 4.15 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.14.1.1 2012/07/13 10:04:50 cal103 Exp cal103 $
@


4.15.1.1
log
@WCSLIB 4.15 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.15 2012/09/26 14:26:06 cal103 Exp $
@


4.14
log
@WCSLIB 4.14
@
text
@d3 1
a3 1
  WCSLIB 4.14 - an implementation of the FITS WCS standard.
d26 1
a26 1
  $Id: twcs.c,v 4.13.1.3 2012/07/13 03:37:00 cal103 Exp cal103 $
@


4.14.1.1
log
@WCSLIB 4.14 development branch.
@
text
@d26 1
a26 1
  $Id: twcs.c,v 4.14 2012/07/13 10:02:32 cal103 Exp $
@


4.13
log
@WCSLIB 4.13
@
text
@d3 1
a3 1
  WCSLIB 4.13 - an implementation of the FITS WCS standard.
d19 1
a19 1
  along with WCSLIB.  If not, see <http://www.gnu.org/licenses/>.
d21 1
a21 7
  Correspondence concerning WCSLIB may be directed to:
    Internet email: mcalabre@@atnf.csiro.au
    Postal address: Dr. Mark Calabretta
                    Australia Telescope National Facility, CSIRO
                    PO Box 76
                    Epping NSW 1710
                    AUSTRALIA
d23 1
a23 1
  Author: Mark Calabretta, Australia Telescope National Facility
d25 2
a26 2
  http://www.atnf.csiro.au/~mcalabre/index.html
  $Id: twcs.c,v 4.12.1.1 2012/02/29 07:59:11 cal103 Exp cal103 $
d399 1
a399 1
             "naxis must be positive (got -32)");
@


4.13.1.1
log
@WCSLIB 4.13 development branch.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.13 2012/03/14 07:39:30 cal103 Exp $
@


4.13.1.2
log
@Updated to reflect the changed error message from wcsini().
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.13.1.1 2012/03/14 07:40:38 cal103 Exp cal103 $
d405 1
a405 1
             "naxis must not be negative (got -32)");
@


4.13.1.3
log
@Changed contact details.
@
text
@d19 1
a19 1
  along with WCSLIB.  If not, see http://www.gnu.org/licenses.
d21 7
a27 1
  Direct correspondence concerning WCSLIB to mark@@calabretta.id.au
d29 1
a29 1
  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO,
d31 2
a32 2
  http://www.atnf.csiro.au/people/Mark.Calabretta
  $Id: twcs.c,v 4.13.1.2 2012/03/15 05:50:34 cal103 Exp cal103 $
@


4.12
log
@WCSLIB 4.12
@
text
@d3 1
a3 1
  WCSLIB 4.12 - an implementation of the FITS WCS standard.
d32 1
a32 1
  $Id: twcs.c,v 4.11.1.1 2012/02/20 23:31:13 cal103 Exp cal103 $
@


4.12.1.1
log
@WCSLIB 4.12 development branch.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.12 2012/02/29 07:57:57 cal103 Exp $
@


4.11
log
@WCSLIB 4.11
@
text
@d3 1
a3 1
  WCSLIB 4.11 - an implementation of the FITS WCS standard.
d32 1
a32 1
  $Id: twcs.c,v 4.10.1.1 2012/02/05 23:42:47 cal103 Exp cal103 $
@


4.11.1.1
log
@WCSLIB 4.11 development branch.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.11 2012/02/20 23:30:02 cal103 Exp $
@


4.10
log
@WCSLIB 4.10
@
text
@d3 1
a3 1
  WCSLIB 4.10 - an implementation of the FITS WCS standard.
d32 1
a32 1
  $Id: twcs.c,v 4.9.1.1 2012/01/24 05:41:46 cal103 Exp cal103 $
@


4.10.1.1
log
@WCSLIB 4.10 development branch.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.10 2012/02/05 23:41:44 cal103 Exp $
@


4.9
log
@WCSLIB 4.9
@
text
@d3 1
a3 1
  WCSLIB 4.9 - an implementation of the FITS WCS standard.
d32 1
a32 1
  $Id: twcs.c,v 4.8.1.2 2012/01/24 05:23:30 cal103 Exp cal103 $
@


4.9.1.1
log
@WCSLIB 4.9 development branch.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.9 2012/01/24 05:40:29 cal103 Exp $
@


4.8
log
@WCSLIB 4.8
@
text
@d3 2
a4 2
  WCSLIB 4.8 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2011, Mark Calabretta
d32 1
a32 1
  $Id: twcs.c,v 4.7.1.7 2011/08/15 06:03:16 cal103 Exp cal103 $
@


4.8.1.1
log
@WCSLIB 4.8 development branch.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.8 2011/08/15 08:05:54 cal103 Exp $
@


4.8.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2012, Mark Calabretta
d32 1
a32 1
  $Id: twcs.c,v 4.8.1.1 2011/08/15 08:07:06 cal103 Exp cal103 $
@


4.7
log
@WCSLIB 4.7
@
text
@d3 1
a3 1
  WCSLIB 4.7 - an implementation of the FITS WCS standard.
d30 1
d32 1
a32 1
  $Id: twcs.c,v 4.6.1.2 2011/01/14 06:33:44 cal103 Exp cal103 $
d50 2
d77 1
d85 1
a85 1
  int    i, k, lat, lng, stat[361], status;
d144 4
d152 4
d217 4
a220 3
    if ((status = wcss2p(wcs, 361, NELEM, world1[0], phi, theta, img[0],
                         pixel1[0], stat))) {
      printf("   wcss2p(1) ERROR %2d (lat1 = %f)\n", status, lat1);
d224 4
a227 3
    if ((status = wcsp2s(wcs, 361, NELEM, pixel1[0], img[0], phi, theta,
                         world2[0], stat))) {
      printf("   wcsp2s ERROR %2d (lat1 = %f)\n", status, lat1);
d231 4
a234 3
    if ((status = wcss2p(wcs, 361, NELEM, world2[0], phi, theta, img[0],
                         pixel2[0], stat))) {
      printf("   wcss2p(2) ERROR %2d (lat1 = %f)\n", status, lat1);
d249 1
d263 34
a296 1
  printf("Maximum closure residual: %10.3e pixel.\n", residmax);
d298 1
d302 1
a302 1
  return 0;
d312 1
a312 1
  int i, j, status;
d362 2
a363 2
  if ((status = wcsset(wcs))) {
    printf("wcsset ERROR%3d\n", status);
d368 74
@


4.7.1.1
log
@WCSLIB 4.7 development branch.
@
text
@d31 1
a31 1
  $Id: twcs.c,v 4.7 2011/02/07 07:03:42 cal103 Exp $
@


4.7.1.2
log
@Test error messaging based on wcserr.  Changes supplied by Michael
Droettboom (STScI) with respect to the released WCSLIB 4.7 sources.
@
text
@a48 1
void test_errors();
a174 3
  /* The following tests that error messages are generated */
  test_errors();
  
a317 80

int check_error(struct wcsprm *wcs, char *name, int status, int exstatus, char *exmessage)
{
  if (status == exstatus && strcmp(wcs->err.msg, exmessage) == 0) {
    return 0;
  } else {
    printf("%s ERROR Expected %d:'%s', got %d:'%s'\n",
           name, exstatus, exmessage, status, wcs->err.msg);
    return 1;
  }
}

void test_errors()
{

  struct wcsprm wcs;
  int status;
  int i;
  char multiple_cubeface[2][9] = {
    "CUBEFACE", "CUBEFACE"
  };
  char projection_code[2][9] = {
    "RA---FOO", "DEC--BAR"
  };
  char unmatched[2][9] = {
    "RA---TAN", "FREQ-LOG"
  };
  
  wcs.flag = -1;
  status = wcsini(1, -32, &wcs);
  if (check_error(
        &wcs, "wcsini", status,
        WCSERR_MEMORY, "naxis must be positive (got -32)"))
    return;

  wcs.flag = -1;
  status = wcsini(1, 1 << 30, &wcs);
  if (check_error(
        &wcs, "wcsini", status,
        WCSERR_MEMORY, "Memory allocation failed"))
    return;

  wcs.flag = -1;
  status = wcsini(1, 2, &wcs);
  if (check_error(
        &wcs, "wcsini", status,
        WCSERR_SUCCESS, ""))
    return;

  for (i = 0; i < 2; i++) {
    strcpy(wcs.ctype[i], &multiple_cubeface[i][0]);
  }
  status = wcsset(&wcs);
  if (check_error(
        &wcs, "wcsset", status,
        WCSERR_BAD_CTYPE, "Multiple CUBEFACE axes (in CTYPE0  and CTYPE1 )"))
    return;

  wcs.flag = -1;
  status = wcsini(1, 2, &wcs);
  for (i = 0; i < 2; i++) {
    strcpy(wcs.ctype[i], &projection_code[i][0]);
  }
  status = wcsset(&wcs);
  if (check_error(
        &wcs, "wcsset", status,
        WCSERR_BAD_CTYPE, "Unrecognized projection code (FOO in CTYPE0 )"))
    return;
  
  wcs.flag = -1;
  status = wcsini(1, 2, &wcs);
  for (i = 0; i < 2; i++) {
    strcpy(wcs.ctype[i], &unmatched[i][0]);
  }
  status = wcsset(&wcs);
  if (check_error(
        &wcs, "wcsset", status,
        WCSERR_BAD_CTYPE, "Unmatched celestial axes"))
    return;
}
@


4.7.1.3
log
@Revised implementation of Michael Droettboom's error messaging system.
Added a new test for wcserr.  Also now tests wcsprintf().
@
text
@a29 1
     and: Michael Droetboom, Space Telescope Science Institute
d31 1
a31 1
  $Id: twcs.c,v 4.7.1.1 2011/02/07 07:04:23 cal103 Exp cal103 $
a48 1
int  check_error(struct wcsprm *, int, int, char *);
a74 1
int itest = 0;
a144 4
  s = (sizeof(struct wcserr) == sizeof(int)*ERRLEN) ? ok : mismatch;
  printf("         wcserr:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct wcserr),
         ERRLEN, s);

d176 3
d209 3
a211 4
    if (wcss2p(wcs, 361, NELEM, world1[0], phi, theta, img[0], pixel1[0],
               stat)) {
      printf("  At wcss2p#1 with lat1 == %f\n", lat1);
      wcsperr(wcs, "  ");
d215 3
a217 4
    if (wcsp2s(wcs, 361, NELEM, pixel1[0], img[0], phi, theta, world2[0],
               stat)) {
      printf("  At wcsp2s with lat1 == %f\n", lat1);
      wcsperr(wcs, "  ");
d221 3
a223 4
    if (wcss2p(wcs, 361, NELEM, world2[0], phi, theta, img[0], pixel2[0],
               stat)) {
      printf("  At wcss2p#2 with lat1 == %f\n", lat1);
      wcsperr(wcs, "  ");
a252 17

  /* Test wcserr and wcsprintf() as well. */
  wcsprintf_set(stderr);
  wcsprintf("\n\nIGNORE messages marked with 'OK', they test wcserr "
    "(and wcsprintf):\n");

  wcserr_enable(1);

  /* Test 1. */
  wcs->pv[2].value = UNDEFINED;
  status = wcsset(wcs);
  check_error(wcs, status, WCSERR_BAD_PARAM, "Invalid parameter value");

  test_errors();


  /* Clean up. */
d266 1
a266 1
  int i, j;
d316 2
a317 2
  if (wcsset(wcs)) {
    wcsperr(wcs, "");
d323 1
a323 3
/*--------------------------------------------------------------------------*/

int check_error(struct wcsprm *wcs, int status, int exstatus, char *exmsg)
d325 2
a326 7
  const char *errmsg = (status ? (wcs->err)->msg : "");

  wcsprintf("\nTest %d...\n", ++itest);

  if (status == exstatus && strcmp(errmsg, exmsg) == 0) {
    wcsperr(wcs, "OK: ");
    wcsprintf("...succeeded.\n");
d328 2
a329 3
    wcsprintf("Expected error %d: '%s', got\n", exstatus, exmsg);
    wcsperr(wcs, "");
    wcsprintf("...failed.\n");
a331 2

  return 0;
a333 2
/*--------------------------------------------------------------------------*/

d335 1
a336 1
{
d349 1
a349 2

  /* Test 2. */
d352 4
a355 2
  check_error(&wcs, status, WCSERR_MEMORY,
    "naxis must be positive (got -32)");
d357 1
a357 2
  /* Test 3. */
  wcs.flag = 0;
d359 4
a362 1
  check_error(&wcs, status, WCSERR_MEMORY, "Memory allocation failed");
d364 1
a364 2
  /* Test 4. */
  wcs.flag = 0;
d366 4
a369 1
  check_error(&wcs, status, WCSERR_SUCCESS, "");
a370 1
  /* Test 5. */
d375 4
a378 2
  check_error(&wcs, status, WCSERR_BAD_CTYPE,
    "Multiple CUBEFACE axes (in CTYPE0 and CTYPE1)");
d380 1
a380 2
  /* Test 6. */
  wcs.flag = 0;
d386 6
a391 5
  check_error(&wcs, status, WCSERR_BAD_CTYPE,
    "Unrecognized projection code (FOO in CTYPE0)");

  /* Test 7. */
  wcs.flag = 0;
d397 4
a400 1
  check_error(&wcs, status, WCSERR_BAD_CTYPE, "Unmatched celestial axes");
@


4.7.1.4
log
@In test_errors(), error messages now correctly report 1-relative FITS
axis numbers.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.7.1.3 2011/08/09 03:10:06 cal103 Exp cal103 $
d408 1
a408 1
    "Multiple CUBEFACE axes (in CTYPE1 and CTYPE2)");
d418 1
a418 1
    "Unrecognized projection code (FOO in CTYPE1)");
@


4.7.1.5
log
@Removed the memory allocation test from test_errors() - it doesn't
actually fail on Macs!
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.7.1.4 2011/08/10 07:23:43 cal103 Exp cal103 $
d394 5
d402 1
a402 1
  /* Test 4. */
d410 1
a410 1
  /* Test 5. */
d420 1
a420 1
  /* Test 6. */
@


4.7.1.6
log
@Report PASS/FAIL and return the number of failures.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.7.1.5 2011/08/11 03:02:31 cal103 Exp cal103 $
d51 1
a51 1
int  test_errors();
d85 1
a85 1
  int    i, k, lat, lng, nFail1 = 0, nFail2 = 0, stat[361], status;
a244 1
        nFail1++;
d258 1
a258 1
  printf("wcsp2s/wcss2p: Maximum closure residual = %.1e pixel.\n", residmax);
d262 1
a262 2
  nFail2 = 0;
  wcsprintf_set(stdout);
d271 1
a271 2
  nFail2 += check_error(wcs, status, WCSERR_BAD_PARAM,
                        "Invalid parameter value");
d273 1
a273 16
  nFail2 += test_errors();


  if (nFail1 || nFail2) {
    if (nFail1) {
      printf("\nFAIL: %d closure residuals exceed reporting tolerance.\n",
        nFail1);
    }

    if (nFail2) {
      printf("FAIL: %d error messages differ from that expected.\n", nFail2);
    }
  } else {
    printf("\nPASS: All closure residuals are within reporting tolerance.\n");
    printf("PASS: All error messages reported as expected.\n");
  }
d280 1
a280 1
  return nFail1 + nFail2;
d370 1
a370 1
int test_errors()
a372 4
  const char *(multiple_cubeface[2]) = {"CUBEFACE", "CUBEFACE"};
  const char *(projection_code[2])   = {"RA---FOO", "DEC--BAR"};
  const char *(unmatched[2])         = {"RA---TAN", "FREQ-LOG"};
  int i, nFail = 0, status;
d374 11
d389 2
a390 2
  nFail += check_error(&wcs, status, WCSERR_MEMORY,
             "naxis must be positive (got -32)");
d395 1
a395 1
  nFail += check_error(&wcs, status, WCSERR_SUCCESS, "");
d402 2
a403 2
  nFail += check_error(&wcs, status, WCSERR_BAD_CTYPE,
             "Multiple CUBEFACE axes (in CTYPE1 and CTYPE2)");
d412 2
a413 2
  nFail += check_error(&wcs, status, WCSERR_BAD_CTYPE,
             "Unrecognized projection code (FOO in CTYPE1)");
d422 1
a422 4
  nFail += check_error(&wcs, status, WCSERR_BAD_CTYPE,
             "Unmatched celestial axes");

  return nFail;
@


4.7.1.7
log
@Report the size of the spxprm struct.
@
text
@d32 1
a32 1
  $Id: twcs.c,v 4.7.1.6 2011/08/12 02:54:42 cal103 Exp cal103 $
a143 4
  s = (sizeof(struct spxprm) == sizeof(int)*SPXLEN) ? ok : mismatch;
  printf("         spxprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct spxprm),
         SPXLEN, s);

@


4.6
log
@WCSLIB 4.6
@
text
@d3 2
a4 2
  WCSLIB 4.6 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2010, Mark Calabretta
d31 1
a31 1
  $Id: twcs.c,v 4.5.1.1 2010/07/16 07:05:32 cal103 Exp cal103 $
@


4.6.1.1
log
@WCSLIB 4.6 development branch.
@
text
@d31 1
a31 1
  $Id: twcs.c,v 4.6 2010/11/16 06:15:31 cal103 Exp $
@


4.6.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2011, Mark Calabretta
d31 1
a31 1
  $Id: twcs.c,v 4.6.1.1 2010/11/16 06:16:19 cal103 Exp cal103 $
@


4.5
log
@WCSLIB 4.5
@
text
@d3 1
a3 1
  WCSLIB 4.5 - an implementation of the FITS WCS standard.
d31 1
a31 1
  $Id: twcs.c,v 4.4.1.2 2010/01/19 03:44:00 cal103 Exp cal103 $
@


4.5.1.1
log
@WCSLIB 4.5 development branch.
@
text
@d31 1
a31 1
  $Id: twcs.c,v 4.5 2010/07/16 07:01:26 cal103 Exp $
@


4.4
log
@WCSLIB 4.4
@
text
@d3 2
a4 2
  WCSLIB 4.4 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2009, Mark Calabretta
d31 1
a31 1
  $Id: twcs.c,v 4.3.1.4 2009/08/06 06:34:03 cal103 Exp cal103 $
@


4.4.1.1
log
@WCSLIB 4.3 development branch.
@
text
@d31 1
a31 1
  $Id: twcs.c,v 4.4 2009/08/06 07:45:31 cal103 Exp $
@


4.4.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1995-2010, Mark Calabretta
d31 1
a31 1
  $Id: twcs.c,v 4.4.1.1 2009/08/12 06:35:54 cal103 Exp cal103 $
@


4.3
log
@WCSLIB 4.3
@
text
@d3 2
a4 2
    WCSLIB 4.3 - an implementation of the FITS WCS standard.
    Copyright (C) 1995-2007, Mark Calabretta
d6 1
a6 1
    This file is part of WCSLIB.
d8 24
a31 24
    WCSLIB is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License as published by the
    Free Software Foundation, either version 3 of the License, or (at your
    option) any later version.

    WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    more details.

    You should have received a copy of the GNU Lesser General Public License
    along with WCSLIB.  If not, see <http://www.gnu.org/licenses/>.

    Correspondence concerning WCSLIB may be directed to:
       Internet email: mcalabre@@atnf.csiro.au
       Postal address: Dr. Mark Calabretta
                       Australia Telescope National Facility, CSIRO
                       PO Box 76
                       Epping NSW 1710
                       AUSTRALIA

    Author: Mark Calabretta, Australia Telescope National Facility
    http://www.atnf.csiro.au/~mcalabre/index.html
    $Id: twcs.c,v 4.2.1.6 2007/12/27 05:18:47 cal103 Exp $
d34 2
a35 3
*   twcs tests wcss2p() and wcsp2s() for closure on an oblique 2-D slice
*   through a 4-D image with celestial, spectral and logarithmic coordinate
*   axes.
d44 2
a45 1
#include <wcs.h>
d80 148
a227 115
   char   ok[] = "", mismatch[] = " (WARNING, mismatch)", *s;
   int    i, k, lat, lng, stat[361], status;
   double freq, img[361][NELEM], lat1, lng1, phi[361], pixel1[361][NELEM],
          pixel2[361][NELEM], r, resid, residmax, theta[361], time,
          world1[361][NELEM], world2[361][NELEM];
   struct wcsprm *wcs;


   printf("Testing closure of WCSLIB world coordinate transformation "
          "routines (twcs.c)\n"
          "----------------------------------------------------------"
          "-----------------\n");

   /* List status return messages. */
   printf("\nList of wcs status return values:\n");
   for (status = 1; status <= 13; status++) {
      printf("%4d: %s.\n", status, wcs_errmsg[status]);
   }

   printf("\nSize of data types (bytes):\n");
   printf("           char:%5zd\n", sizeof(char));
   printf("      short int:%5zd\n", sizeof(short int));
   printf("            int:%5zd\n", sizeof(int));
   printf("       long int:%5zd\n", sizeof(long int));
   printf("          float:%5zd\n", sizeof(float));
   printf("         double:%5zd\n", sizeof(double));
   printf("         char *:%5zd\n", sizeof(char *));
   printf("   char (*)[72]:%5zd\n", sizeof(char (*)[72]));
   printf("          int *:%5zd\n", sizeof(int *));
   printf("        float *:%5zd\n", sizeof(float *));
   printf("       double *:%5zd\n", sizeof(double *));
   printf("struct pvcard *:%5zd\n", sizeof(struct pvcard *));
   printf("struct pscard *:%5zd\n", sizeof(struct pscard *));

   printf("\nSize of structs (bytes/ints):\n");

   s = (sizeof(struct linprm) == sizeof(int)*LINLEN) ? ok : mismatch;
   printf("         linprm:%5zd /%4zd%s\n", sizeof(struct linprm), LINLEN, s);

   s = (sizeof(struct celprm) == sizeof(int)*CELLEN) ? ok : mismatch;
   printf("         celprm:%5zd /%4zd%s\n", sizeof(struct celprm), CELLEN, s);

   s = (sizeof(struct prjprm) == sizeof(int)*PRJLEN) ? ok : mismatch;
   printf("         prjprm:%5zd /%4zd%s\n", sizeof(struct prjprm), PRJLEN, s);

   s = (sizeof(struct spcprm) == sizeof(int)*SPCLEN) ? ok : mismatch;
   printf("         spcprm:%5zd /%4zd%s\n", sizeof(struct spcprm), SPCLEN, s);

   s = (sizeof(struct tabprm) == sizeof(int)*TABLEN) ? ok : mismatch;
   printf("         tabprm:%5zd /%4zd%s\n", sizeof(struct tabprm), TABLEN, s);

   s = (sizeof(struct wcsprm) == sizeof(int)*WCSLEN) ? ok : mismatch;
   printf("         wcsprm:%5zd /%4zd%s\n", sizeof(struct wcsprm), WCSLEN, s);


   /* Set the PVi_ma keyvalues for the longitude axis.         */
   /*----------------------------------------------------------*/
   /* For test purposes, these are set so that the fiducial    */
   /* native coordinates are at the native pole, i.e. so that  */
   /* (phi0,theta0) = (0,90), but without any fiducial offset, */
   /* i.e. iwith PVi_0a == 0 (by default).                     */
   /*----------------------------------------------------------*/
   PV[0].i = 4;			/* Longitude is on axis 4.     */
   PV[0].m = 1;			/* Parameter number 1.         */
   PV[0].value =  0.0;		/* Fiducial native longitude.  */

   PV[1].i = 4;			/* Longitude is on axis 4.     */
   PV[1].m = 2;			/* Parameter number 2.         */
   PV[1].value = 90.0;		/* Fiducial native latitude.   */

   /* Set the PVi_m keyvaluess for the latitude axis.          */
   PV[2].i = 2;			/* Latitude is on axis 2.      */
   PV[2].m = 1;			/* Parameter number 1.         */
   PV[2].value = -30.0;		/* PVi_1.                      */


   /* The following routine simulates the actions of a FITS header parser. */
   wcs = malloc(sizeof(struct wcsprm));
   wcs->flag = -1;
   parser(wcs);

   printf("\nReporting tolerance %5.1g pixel.\n", tol);


   /* Initialize non-celestial world coordinates. */
   time = 1.0;
   freq = 1.42040595e9 - 180.0 * 62500.0;
   for (k = 0; k < 361; k++) {
      world1[k][0] = 0.0;
      world1[k][1] = 0.0;
      world1[k][2] = 0.0;
      world1[k][3] = 0.0;

      world1[k][2] = time;
      time *= 1.01;

      world1[k][wcs->spec] = 2.99792458e8 / freq;
      freq += 62500.0;
   }

   residmax = 0.0;
   for (lat = 90; lat >= -90; lat--) {
      lat1 = (double)lat;

      for (lng = -180, k = 0; lng <= 180; lng++, k++) {
         lng1 = (double)lng;

         world1[k][wcs->lng] = lng1;
         world1[k][wcs->lat] = lat1;
      }

      if ((status = wcss2p(wcs, 361, NELEM, world1[0], phi, theta, img[0],
                           pixel1[0], stat))) {
         printf("   wcss2p(1) ERROR %2d (lat1 = %f)\n", status, lat1);
         continue;
d230 2
a231 11
      if ((status = wcsp2s(wcs, 361, NELEM, pixel1[0], img[0], phi, theta,
                           world2[0], stat))) {
         printf("   wcsp2s ERROR %2d (lat1 = %f)\n", status, lat1);
         continue;
      }

      if ((status = wcss2p(wcs, 361, NELEM, world2[0], phi, theta, img[0],
                           pixel2[0], stat))) {
         printf("   wcss2p(2) ERROR %2d (lat1 = %f)\n", status, lat1);
         continue;
      }
d233 13
a245 23
      for (k = 0; k < 361; k++) {
         resid = 0.0;
         for (i = 0; i < NAXIS; i++) {
           r = pixel2[k][i] - pixel1[k][i];
           resid += r*r;
         }

         resid = sqrt(resid);
         if (resid > residmax) residmax = resid;

         if (resid > tol) {
            printf("\nClosure error:\n"
                   "world1:%18.12f%18.12f%18.12f%18.12f\n"
                   "pixel1:%18.12f%18.12f%18.12f%18.12f\n"
                   "world2:%18.12f%18.12f%18.12f%18.12f\n"
                   "pixel2:%18.12f%18.12f%18.12f%18.12f\n",
               world1[k][0], world1[k][1], world1[k][2], world1[k][3],
               pixel1[k][0], pixel1[k][1], pixel1[k][2], pixel1[k][3],
               world2[k][0], world2[k][1], world2[k][2], world2[k][3],
               pixel2[k][0], pixel2[k][1], pixel2[k][2], pixel2[k][3]);
         }
      }
   }
d247 1
a247 1
   printf("Maximum closure residual: %10.3e pixel.\n", residmax);
d249 2
a250 2
   wcsfree(wcs);
   free(wcs);
d252 1
a252 1
   return 0;
d262 2
a263 48
   int i, j, status;
   double *pcij;

   /* In practice a parser would read the FITS header until it encountered  */
   /* the NAXIS keyword which must occur near the start, before any of the  */
   /* WCS keywords.  It would then use wcsini() to allocate memory for      */
   /* arrays in the wcsprm struct and set default values.  In this          */
   /* simulation the header keyvalues are set as global variables.          */
   wcsini(1, NAXIS, wcs);


   /* Now the parser scans the FITS header, identifying WCS keywords and    */
   /* loading their values into the appropriate elements of the wcsprm      */
   /* struct.                                                               */

   for (j = 0; j < NAXIS; j++) {
      wcs->crpix[j] = CRPIX[j];
   }

   pcij = wcs->pc;
   for (i = 0; i < NAXIS; i++) {
      for (j = 0; j < NAXIS; j++) {
         *(pcij++) = PC[i][j];
      }
   }

   for (i = 0; i < NAXIS; i++) {
      wcs->cdelt[i] = CDELT[i];
   }

   for (i = 0; i < NAXIS; i++) {
      strcpy(wcs->ctype[i], &CTYPE[i][0]);
   }

   for (i = 0; i < NAXIS; i++) {
      wcs->crval[i] = CRVAL[i];
   }

   wcs->lonpole = LONPOLE;
   wcs->latpole = LATPOLE;

   wcs->restfrq = RESTFRQ;
   wcs->restwav = RESTWAV;

   wcs->npv = NPV;
   for (i = 0; i < NPV; i++) {
      wcs->pv[i] = PV[i];
   }
d265 50
a314 4
   /* Extract information from the FITS header. */
   if ((status = wcsset(wcs))) {
      printf("wcsset ERROR%3d\n", status);
   }
d316 1
a316 1
   return;
@


4.3.1.1
log
@WCSLIB 4.3 development branch.
@
text
@d3 2
a4 2
    WCSLIB 4.4 - an implementation of the FITS WCS standard.
    Copyright (C) 1995-2008, Mark Calabretta
d31 1
a31 1
    $Id: twcs.c,v 4.3 2007/12/27 05:35:51 cal103 Exp cal103 $
@


4.3.1.2
log
@Changed indentation.
@
text
@d3 2
a4 2
  WCSLIB 4.4 - an implementation of the FITS WCS standard.
  Copyright (C) 1995-2009, Mark Calabretta
d6 1
a6 1
  This file is part of WCSLIB.
d8 24
a31 24
  WCSLIB is free software: you can redistribute it and/or modify it under the
  terms of the GNU Lesser General Public License as published by the Free
  Software Foundation, either version 3 of the License, or (at your option)
  any later version.

  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
  more details.

  You should have received a copy of the GNU Lesser General Public License
  along with WCSLIB.  If not, see <http://www.gnu.org/licenses/>.

  Correspondence concerning WCSLIB may be directed to:
    Internet email: mcalabre@@atnf.csiro.au
    Postal address: Dr. Mark Calabretta
                    Australia Telescope National Facility, CSIRO
                    PO Box 76
                    Epping NSW 1710
                    AUSTRALIA

  Author: Mark Calabretta, Australia Telescope National Facility
  http://www.atnf.csiro.au/~mcalabre/index.html
  $Id: twcs.c,v 4.3.1.1 2007/12/27 13:24:32 cal103 Exp cal103 $
d34 3
a36 2
* twcs tests wcss2p() and wcsp2s() for closure on an oblique 2-D slice through
* a 4-D image with celestial, spectral and logarithmic coordinate axes.
d80 115
a194 134
  char   ok[] = "", mismatch[] = " (WARNING, mismatch)", *s;
  int    i, k, lat, lng, stat[361], status;
  double freq, img[361][NELEM], lat1, lng1, phi[361], pixel1[361][NELEM],
         pixel2[361][NELEM], r, resid, residmax, theta[361], time,
         world1[361][NELEM], world2[361][NELEM];
  struct wcsprm *wcs;


  printf("Testing closure of WCSLIB world coordinate transformation "
         "routines (twcs.c)\n"
         "----------------------------------------------------------"
         "-----------------\n");

  /* List status return messages. */
  printf("\nList of wcs status return values:\n");
  for (status = 1; status <= 13; status++) {
    printf("%4d: %s.\n", status, wcs_errmsg[status]);
  }

  printf("\nSize of data types (bytes):\n");
  printf("           char:%5zd\n", sizeof(char));
  printf("      short int:%5zd\n", sizeof(short int));
  printf("            int:%5zd\n", sizeof(int));
  printf("       long int:%5zd\n", sizeof(long int));
  printf("          float:%5zd\n", sizeof(float));
  printf("         double:%5zd\n", sizeof(double));
  printf("         char *:%5zd\n", sizeof(char *));
  printf("   char (*)[72]:%5zd\n", sizeof(char (*)[72]));
  printf("          int *:%5zd\n", sizeof(int *));
  printf("        float *:%5zd\n", sizeof(float *));
  printf("       double *:%5zd\n", sizeof(double *));
  printf("struct pvcard *:%5zd\n", sizeof(struct pvcard *));
  printf("struct pscard *:%5zd\n", sizeof(struct pscard *));

  printf("\nSize of structs (bytes/ints):\n");

  s = (sizeof(struct linprm) == sizeof(int)*LINLEN) ? ok : mismatch;
  printf("         linprm:%5zd /%4zd%s\n", sizeof(struct linprm), LINLEN, s);

  s = (sizeof(struct celprm) == sizeof(int)*CELLEN) ? ok : mismatch;
  printf("         celprm:%5zd /%4zd%s\n", sizeof(struct celprm), CELLEN, s);

  s = (sizeof(struct prjprm) == sizeof(int)*PRJLEN) ? ok : mismatch;
  printf("         prjprm:%5zd /%4zd%s\n", sizeof(struct prjprm), PRJLEN, s);

  s = (sizeof(struct spcprm) == sizeof(int)*SPCLEN) ? ok : mismatch;
  printf("         spcprm:%5zd /%4zd%s\n", sizeof(struct spcprm), SPCLEN, s);

  s = (sizeof(struct tabprm) == sizeof(int)*TABLEN) ? ok : mismatch;
  printf("         tabprm:%5zd /%4zd%s\n", sizeof(struct tabprm), TABLEN, s);

  s = (sizeof(struct wcsprm) == sizeof(int)*WCSLEN) ? ok : mismatch;
  printf("         wcsprm:%5zd /%4zd%s\n", sizeof(struct wcsprm), WCSLEN, s);


  /* Set the PVi_ma keyvalues for the longitude axis.         */
  /*----------------------------------------------------------*/
  /* For test purposes, these are set so that the fiducial    */
  /* native coordinates are at the native pole, i.e. so that  */
  /* (phi0,theta0) = (0,90), but without any fiducial offset, */
  /* i.e. iwith PVi_0a == 0 (by default).                     */
  /*----------------------------------------------------------*/
  PV[0].i = 4;			/* Longitude is on axis 4.     */
  PV[0].m = 1;			/* Parameter number 1.         */
  PV[0].value =  0.0;		/* Fiducial native longitude.  */

  PV[1].i = 4;			/* Longitude is on axis 4.     */
  PV[1].m = 2;			/* Parameter number 2.         */
  PV[1].value = 90.0;		/* Fiducial native latitude.   */

  /* Set the PVi_m keyvaluess for the latitude axis.          */
  PV[2].i = 2;			/* Latitude is on axis 2.      */
  PV[2].m = 1;			/* Parameter number 1.         */
  PV[2].value = -30.0;		/* PVi_1.                      */


  /* The following routine simulates the actions of a FITS header parser. */
  wcs = malloc(sizeof(struct wcsprm));
  wcs->flag = -1;
  parser(wcs);

  printf("\nReporting tolerance %5.1g pixel.\n", tol);


  /* Initialize non-celestial world coordinates. */
  time = 1.0;
  freq = 1.42040595e9 - 180.0 * 62500.0;
  for (k = 0; k < 361; k++) {
    world1[k][0] = 0.0;
    world1[k][1] = 0.0;
    world1[k][2] = 0.0;
    world1[k][3] = 0.0;

    world1[k][2] = time;
    time *= 1.01;

    world1[k][wcs->spec] = 2.99792458e8 / freq;
    freq += 62500.0;
  }

  residmax = 0.0;
  for (lat = 90; lat >= -90; lat--) {
    lat1 = (double)lat;

    for (lng = -180, k = 0; lng <= 180; lng++, k++) {
      lng1 = (double)lng;

      world1[k][wcs->lng] = lng1;
      world1[k][wcs->lat] = lat1;
    }

    if ((status = wcss2p(wcs, 361, NELEM, world1[0], phi, theta, img[0],
                         pixel1[0], stat))) {
      printf("   wcss2p(1) ERROR %2d (lat1 = %f)\n", status, lat1);
      continue;
    }

    if ((status = wcsp2s(wcs, 361, NELEM, pixel1[0], img[0], phi, theta,
                         world2[0], stat))) {
      printf("   wcsp2s ERROR %2d (lat1 = %f)\n", status, lat1);
      continue;
    }

    if ((status = wcss2p(wcs, 361, NELEM, world2[0], phi, theta, img[0],
                         pixel2[0], stat))) {
      printf("   wcss2p(2) ERROR %2d (lat1 = %f)\n", status, lat1);
      continue;
    }

    for (k = 0; k < 361; k++) {
      resid = 0.0;
      for (i = 0; i < NAXIS; i++) {
        r = pixel2[k][i] - pixel1[k][i];
        resid += r*r;
d197 11
a207 2
      resid = sqrt(resid);
      if (resid > residmax) residmax = resid;
d209 23
a231 13
      if (resid > tol) {
        printf("\nClosure error:\n"
               "world1:%18.12f%18.12f%18.12f%18.12f\n"
               "pixel1:%18.12f%18.12f%18.12f%18.12f\n"
               "world2:%18.12f%18.12f%18.12f%18.12f\n"
               "pixel2:%18.12f%18.12f%18.12f%18.12f\n",
          world1[k][0], world1[k][1], world1[k][2], world1[k][3],
          pixel1[k][0], pixel1[k][1], pixel1[k][2], pixel1[k][3],
          world2[k][0], world2[k][1], world2[k][2], world2[k][3],
          pixel2[k][0], pixel2[k][1], pixel2[k][2], pixel2[k][3]);
       }
    }
  }
d233 1
a233 1
  printf("Maximum closure residual: %10.3e pixel.\n", residmax);
d235 2
a236 2
  wcsfree(wcs);
  free(wcs);
d238 1
a238 1
  return 0;
d248 48
a295 2
  int i, j, status;
  double *pcij;
d297 4
a300 50
  /* In practice a parser would read the FITS header until it encountered  */
  /* the NAXIS keyword which must occur near the start, before any of the  */
  /* WCS keywords.  It would then use wcsini() to allocate memory for      */
  /* arrays in the wcsprm struct and set default values.  In this          */
  /* simulation the header keyvalues are set as global variables.          */
  wcsini(1, NAXIS, wcs);


  /* Now the parser scans the FITS header, identifying WCS keywords and    */
  /* loading their values into the appropriate elements of the wcsprm      */
  /* struct.                                                               */

  for (j = 0; j < NAXIS; j++) {
    wcs->crpix[j] = CRPIX[j];
  }

  pcij = wcs->pc;
  for (i = 0; i < NAXIS; i++) {
    for (j = 0; j < NAXIS; j++) {
      *(pcij++) = PC[i][j];
    }
  }

  for (i = 0; i < NAXIS; i++) {
    wcs->cdelt[i] = CDELT[i];
  }

  for (i = 0; i < NAXIS; i++) {
    strcpy(wcs->ctype[i], &CTYPE[i][0]);
  }

  for (i = 0; i < NAXIS; i++) {
    wcs->crval[i] = CRVAL[i];
  }

  wcs->lonpole = LONPOLE;
  wcs->latpole = LATPOLE;

  wcs->restfrq = RESTFRQ;
  wcs->restwav = RESTWAV;

  wcs->npv = NPV;
  for (i = 0; i < NPV; i++) {
    wcs->pv[i] = PV[i];
  }

  /* Extract information from the FITS header. */
  if ((status = wcsset(wcs))) {
    printf("wcsset ERROR%3d\n", status);
  }
d302 1
a302 1
  return;
@


4.3.1.3
log
@Report KEYLEN and KEYIDLEN; include wcslib.h rather than just wcs.h.
@
text
@d31 1
a31 1
  $Id: twcs.c,v 4.3.1.2 2009/07/22 06:38:03 cal103 Exp cal103 $
d44 1
a44 1
#include <wcslib.h>
d115 3
d119 1
a119 14
  printf("         celprm:%5zd /%4zd%s\n", sizeof(struct celprm),
         CELLEN, s);

  s = (sizeof(struct fitskey) == sizeof(int)*KEYLEN) ? ok : mismatch;
  printf("        fitskey:%5zd /%4zd%s\n", sizeof(struct fitskey),
         KEYLEN, s);

  s = (sizeof(struct fitskeyid) == sizeof(int)*KEYIDLEN) ? ok : mismatch;
  printf("      fitskeyid:%5zd /%4zd%s\n", sizeof(struct fitskeyid),
         KEYIDLEN, s);

  s = (sizeof(struct linprm) == sizeof(int)*LINLEN) ? ok : mismatch;
  printf("         linprm:%5zd /%4zd%s\n", sizeof(struct linprm),
         LINLEN, s);
d122 1
a122 2
  printf("         prjprm:%5zd /%4zd%s\n", sizeof(struct prjprm),
         PRJLEN, s);
d125 1
a125 2
  printf("         spcprm:%5zd /%4zd%s\n", sizeof(struct spcprm),
         SPCLEN, s);
d128 1
a128 2
  printf("         tabprm:%5zd /%4zd%s\n", sizeof(struct tabprm),
         TABLEN, s);
d131 1
a131 2
  printf("         wcsprm:%5zd /%4zd%s\n", sizeof(struct wcsprm),
         WCSLEN, s);
@


4.3.1.4
log
@Use the MODZ preprocessor define to select the correct printf() modifier
for the size_t data type.
@
text
@d31 1
a31 1
  $Id: twcs.c,v 4.3.1.3 2009/08/06 02:55:04 cal103 Exp cal103 $
a44 1
#include <wcsconfig_tests.h>
d99 13
a111 13
  printf("           char:%5"MODZ"u\n", sizeof(char));
  printf("      short int:%5"MODZ"u\n", sizeof(short int));
  printf("            int:%5"MODZ"u\n", sizeof(int));
  printf("       long int:%5"MODZ"u\n", sizeof(long int));
  printf("          float:%5"MODZ"u\n", sizeof(float));
  printf("         double:%5"MODZ"u\n", sizeof(double));
  printf("         char *:%5"MODZ"u\n", sizeof(char *));
  printf("   char (*)[72]:%5"MODZ"u\n", sizeof(char (*)[72]));
  printf("          int *:%5"MODZ"u\n", sizeof(int *));
  printf("        float *:%5"MODZ"u\n", sizeof(float *));
  printf("       double *:%5"MODZ"u\n", sizeof(double *));
  printf("struct pvcard *:%5"MODZ"u\n", sizeof(struct pvcard *));
  printf("struct pscard *:%5"MODZ"u\n", sizeof(struct pscard *));
d116 1
a116 1
  printf("         celprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct celprm),
d120 1
a120 1
  printf("        fitskey:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct fitskey),
d124 1
a124 1
  printf("      fitskeyid:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct fitskeyid),
d128 1
a128 1
  printf("         linprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct linprm),
d132 1
a132 1
  printf("         prjprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct prjprm),
d136 1
a136 1
  printf("         spcprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct spcprm),
d140 1
a140 1
  printf("         tabprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct tabprm),
d144 1
a144 1
  printf("         wcsprm:%5"MODZ"u /%4"MODZ"u%s\n", sizeof(struct wcsprm),
@


4.2
log
@WCSLIB 4.2: identify the name of the program in the output; removed
#include <malloc.h>, non-ANSI (stdlib.h is the correct ANSI-C header).
@
text
@d2 30
a31 29
*
*   WCSLIB 4.2 - an implementation of the FITS WCS convention.
*   Copyright (C) 1995-2005, Mark Calabretta
*
*   WCSLIB is free software; you can redistribute it and/or modify it under
*   the terms of the GNU General Public License as published by the Free
*   Software Foundation; either version 2 of the License, or (at your option)
*   any later version.
*
*   WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
*   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
*   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
*   details.
*
*   You should have received a copy of the GNU General Public License along
*   with WCSLIB; if not, write to the Free Software Foundation, Inc.,
*   59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
*
*   Correspondence concerning WCSLIB may be directed to:
*      Internet email: mcalabre@@atnf.csiro.au
*      Postal address: Dr. Mark Calabretta
*                      Australia Telescope National Facility, CSIRO
*                      PO Box 76
*                      Epping NSW 1710
*                      AUSTRALIA
*
*   Author: Mark Calabretta, Australia Telescope National Facility
*   http://www.atnf.csiro.au/~mcalabre/index.html
*   $Id: twcs.c,v 4.1 2005/08/26 13:12:51 cal103 Exp cal103 $
d54 1
a54 1
/* In real life these would be encoded as FITS header cards. */
a86 7
   /* Uncomment the following two lines to raise SIGFPE on floating point
    * exceptions for the Sun FORTRAN compiler.  This signal can be caught
    * within 'dbx' by issuing the command "catch FPE".
    */
/* #include <floatingpoint.h> */
/* ieee_handler("set", "common", SIGFPE_ABORT); */

d100 13
a112 13
   printf("           char:%5d\n", sizeof(char));
   printf("      short int:%5d\n", sizeof(short int));
   printf("            int:%5d\n", sizeof(int));
   printf("       long int:%5d\n", sizeof(long int));
   printf("          float:%5d\n", sizeof(float));
   printf("         double:%5d\n", sizeof(double));
   printf("         char *:%5d\n", sizeof(char *));
   printf("   char (*)[72]:%5d\n", sizeof(char (*)[72]));
   printf("          int *:%5d\n", sizeof(int *));
   printf("        float *:%5d\n", sizeof(float *));
   printf("       double *:%5d\n", sizeof(double *));
   printf("struct pvcard *:%5d\n", sizeof(struct pvcard *));
   printf("struct pscard *:%5d\n", sizeof(struct pscard *));
d117 1
a117 1
   printf("         linprm:%5d /%4d%s\n", sizeof(struct linprm), LINLEN, s);
d120 1
a120 1
   printf("         celprm:%5d /%4d%s\n", sizeof(struct celprm), CELLEN, s);
d123 1
a123 1
   printf("         prjprm:%5d /%4d%s\n", sizeof(struct prjprm), PRJLEN, s);
d126 1
a126 1
   printf("         spcprm:%5d /%4d%s\n", sizeof(struct spcprm), SPCLEN, s);
d129 1
a129 1
   printf("         tabprm:%5d /%4d%s\n", sizeof(struct tabprm), TABLEN, s);
d132 1
a132 1
   printf("         wcsprm:%5d /%4d%s\n", sizeof(struct wcsprm), WCSLEN, s);
d135 1
a135 1
   /* Set the PVi_ma cards for the longitude axis.             */
d150 1
a150 1
   /* Set the PVi_m cards for the latitude axis.               */
d191 2
a192 2
      if (status = wcss2p(wcs, 361, NELEM, world1[0], phi, theta, img[0],
                          pixel1[0], stat)) {
d197 2
a198 2
      if (status = wcsp2s(wcs, 361, NELEM, pixel1[0], img[0], phi, theta,
                          world2[0], stat)) {
d203 2
a204 2
      if (status = wcss2p(wcs, 361, NELEM, world2[0], phi, theta, img[0],
                          pixel2[0], stat)) {
d252 4
a255 4
   /* the NAXIS card which must occur near the start of the header before   */
   /* any of the WCS keywords.  It would then use wcsini() to allocate      */
   /* memory for arrays in the wcsprm struct and set default values.        */
   /* In this simulation the header keyvalues are set as global variables.  */
d298 1
a298 1
   if (status = wcsset(wcs)) {
@


4.2.1.1
log
@WCSLIB 4.2 development branch.
@
text
@d3 1
a3 1
*   WCSLIB 4.3 - an implementation of the FITS WCS convention.
d30 1
a30 1
*   $Id: twcs.c,v 4.2 2005/09/22 02:15:15 cal103 Exp cal103 $
@


4.2.1.2
log
@Removed comment re catching floating point exceptions in SunOS.
@
text
@d30 1
a30 1
*   $Id: twcs.c,v 4.2.1.1 2005/12/05 01:39:15 cal103 Exp cal103 $
d85 7
@


4.2.1.3
log
@Parenthesised assignments used as truth values.
@
text
@d4 1
a4 1
*   Copyright (C) 1995-2007, Mark Calabretta
d30 1
a30 1
*   $Id: twcs.c,v 4.2.1.2 2005/12/16 03:48:31 cal103 Exp cal103 $
d190 2
a191 2
      if ((status = wcss2p(wcs, 361, NELEM, world1[0], phi, theta, img[0],
                           pixel1[0], stat))) {
d196 2
a197 2
      if ((status = wcsp2s(wcs, 361, NELEM, pixel1[0], img[0], phi, theta,
                           world2[0], stat))) {
d202 2
a203 2
      if ((status = wcss2p(wcs, 361, NELEM, world2[0], phi, theta, img[0],
                           pixel2[0], stat))) {
d297 1
a297 1
   if ((status = wcsset(wcs))) {
@


4.2.1.4
log
@Replaced use of the obsolete term "card".
@
text
@d30 1
a30 1
*   $Id: twcs.c,v 4.2.1.3 2007/06/29 06:43:47 cal103 Exp cal103 $
d53 1
a53 1
/* In real life these would be encoded as FITS header keyrecords. */
d134 1
a134 1
   /* Set the PVi_ma keyvalues for the longitude axis.         */
d149 1
a149 1
   /* Set the PVi_m keyvaluess for the latitude axis.          */
d251 4
a254 4
   /* the NAXIS keyword which must occur near the start, before any of the  */
   /* WCS keywords.  It would then use wcsini() to allocate memory for      */
   /* arrays in the wcsprm struct and set default values.  In this          */
   /* simulation the header keyvalues are set as global variables.          */
@


4.2.1.5
log
@Switched to LGPL 3.0.
@
text
@d2 29
a30 30

    WCSLIB 4.3 - an implementation of the FITS WCS standard.
    Copyright (C) 1995-2007, Mark Calabretta

    This file is part of WCSLIB.

    WCSLIB is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License as published by the
    Free Software Foundation, either version 3 of the License, or (at your
    option) any later version.

    WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    more details.

    You should have received a copy of the GNU Lesser General Public License
    along with WCSLIB.  If not, see <http://www.gnu.org/licenses/>.

    Correspondence concerning WCSLIB may be directed to:
       Internet email: mcalabre@@atnf.csiro.au
       Postal address: Dr. Mark Calabretta
                       Australia Telescope National Facility, CSIRO
                       PO Box 76
                       Epping NSW 1710
                       AUSTRALIA

    Author: Mark Calabretta, Australia Telescope National Facility
    http://www.atnf.csiro.au/~mcalabre/index.html
    $Id: twcs.c,v 4.2.1.4 2007/08/02 05:58:54 cal103 Exp cal103 $
@


4.2.1.6
log
@Use %zd printf descriptors for size_t integer types returned by sizeof().
@
text
@d31 1
a31 1
    $Id: twcs.c,v 4.2.1.5 2007/12/03 05:12:59 cal103 Exp cal103 $
d100 13
a112 13
   printf("           char:%5zd\n", sizeof(char));
   printf("      short int:%5zd\n", sizeof(short int));
   printf("            int:%5zd\n", sizeof(int));
   printf("       long int:%5zd\n", sizeof(long int));
   printf("          float:%5zd\n", sizeof(float));
   printf("         double:%5zd\n", sizeof(double));
   printf("         char *:%5zd\n", sizeof(char *));
   printf("   char (*)[72]:%5zd\n", sizeof(char (*)[72]));
   printf("          int *:%5zd\n", sizeof(int *));
   printf("        float *:%5zd\n", sizeof(float *));
   printf("       double *:%5zd\n", sizeof(double *));
   printf("struct pvcard *:%5zd\n", sizeof(struct pvcard *));
   printf("struct pscard *:%5zd\n", sizeof(struct pscard *));
d117 1
a117 1
   printf("         linprm:%5zd /%4zd%s\n", sizeof(struct linprm), LINLEN, s);
d120 1
a120 1
   printf("         celprm:%5zd /%4zd%s\n", sizeof(struct celprm), CELLEN, s);
d123 1
a123 1
   printf("         prjprm:%5zd /%4zd%s\n", sizeof(struct prjprm), PRJLEN, s);
d126 1
a126 1
   printf("         spcprm:%5zd /%4zd%s\n", sizeof(struct spcprm), SPCLEN, s);
d129 1
a129 1
   printf("         tabprm:%5zd /%4zd%s\n", sizeof(struct tabprm), TABLEN, s);
d132 1
a132 1
   printf("         wcsprm:%5zd /%4zd%s\n", sizeof(struct wcsprm), WCSLEN, s);
@


4.1
log
@WCSLIB 4.1: substantially changed this from testing closure on the 1 degree
celestial graticule for a number of selected projections to testing closure
for an oblique 2-D slice through a 4-D image with celestial, spectral and
logarithmic coordinate axes; check for anomalies when reporting struct sizes.
@
text
@d3 1
a3 1
*   WCSLIB 4.1 - an implementation of the FITS WCS convention.
d30 1
a30 1
*   $Id: twcs.c,v 4.0 2005/02/04 06:26:16 cal103 Exp cal103 $
a38 1
#include <malloc.h>
d94 4
a97 3
   printf("\nTesting closure of WCSLIB world coordinate transformation "
          "routines\n--------------------------------------------------"
          "----------------\n");
@


4.0
log
@WCSLIB 4.0: changed from LGPL to GPL.
@
text
@d3 1
a3 1
*   WCSLIB 4.0 - an implementation of the FITS WCS convention.
d30 1
a30 1
*   $Id: twcs.c,v 3.6 2004/08/25 05:47:18 cal103 Exp cal103 $
d33 3
a35 2
*   twcs tests wcss2p() and wcsp2s() for closure on the 1 degree celestial
*   graticule for a number of selected projections.
a47 1
void wcsex();
d50 2
a51 2
/* Reporting tolerance for wcsex(). */
const double tol = 1.0e-9;
d61 1
a61 1
const double CDELT[4] =  {-9.635265432e-6, 1.0, 1.0, -1.0};
d63 1
a63 2
				/* The "xxx" is reset in main(). */
char CTYPE[4][9] = {"WAVE-F2W", "XLAT-xxx", "TIME    ", "XLON-xxx"};
d65 1
a65 1
const double CRVAL[4] = {0.214982042, -30.0, -2e3, 150.0};
d71 2
a72 2
int NPV;
struct pvcard PV[10];		/* Projection parameters are set in main(). */
d78 8
a85 1
   register int j;
d101 2
a102 2
   for (j = 1; j <= 11 ; j++) {
      printf("   %2d: %s.\n", j, wcs_errmsg[j]);
d107 1
d109 1
a120 5
   printf("         linprm:%5d /%4d\n", sizeof(struct linprm), LINLEN);
   printf("         celprm:%5d /%4d\n", sizeof(struct celprm), CELLEN);
   printf("         prjprm:%5d /%4d\n", sizeof(struct prjprm), PRJLEN);
   printf("         spcprm:%5d /%4d\n", sizeof(struct spcprm), SPCLEN);
   printf("         wcsprm:%5d /%4d\n", sizeof(struct wcsprm), WCSLEN);
d122 17
d140 2
d143 4
a146 5
   /* Set the PVi_m cards for the longitude axis so that the   */
   /* fiducial native coordinates are at the native pole, i.e. */
   /* (phi0,theta0) = (0,90), but without any fiducial offset. */
   /* We do this as a test, and also so that all projections   */
   /* will be exercised with the same obliquity parameters.    */
d159 1
a159 122
   PV[2].value = 0.0;		/* PVi_1 (set below).          */

   PV[3].i = 2;			/* Latitude is on axis 2.      */
   PV[3].m = 2;			/* Parameter number 2.         */
   PV[3].value = 0.0;		/* PVi_2 (set below).          */

   /* ARC: zenithal/azimuthal equidistant. */
   strncpy(&CTYPE[1][5], "ARC", 3);
   strncpy(&CTYPE[3][5], "ARC", 3);
   NPV = 2;
   wcsex();

   /* ZEA: zenithal/azimuthal equal area. */
   strncpy(&CTYPE[1][5], "ZEA", 3);
   strncpy(&CTYPE[3][5], "ZEA", 3);
   NPV = 2;
   wcsex();

   /* CYP: cylindrical perspective. */
   strncpy(&CTYPE[1][5], "CYP", 3);
   strncpy(&CTYPE[3][5], "CYP", 3);
   NPV = 4;
   PV[2].value = 3.0;
   PV[3].value = 0.8;
   wcsex();

   /* CEA: cylindrical equal area. */
   strncpy(&CTYPE[1][5], "CEA", 3);
   strncpy(&CTYPE[3][5], "CEA", 3);
   NPV = 3;
   PV[2].value = 0.75;
   wcsex();

   /* CAR: plate carree. */
   strncpy(&CTYPE[1][5], "CAR", 3);
   strncpy(&CTYPE[3][5], "CAR", 3);
   NPV = 2;
   wcsex();

   /* SFL: Sanson-Flamsteed. */
   strncpy(&CTYPE[1][5], "SFL", 3);
   strncpy(&CTYPE[3][5], "SFL", 3);
   NPV = 2;
   wcsex();

   /* PAR: parabolic. */
   strncpy(&CTYPE[1][5], "PAR", 3);
   strncpy(&CTYPE[3][5], "PAR", 3);
   NPV = 2;
   wcsex();

   /* MOL: Mollweide's projection. */
   strncpy(&CTYPE[1][5], "MOL", 3);
   strncpy(&CTYPE[3][5], "MOL", 3);
   NPV = 2;
   wcsex();

   /* AIT: Hammer-Aitoff. */
   strncpy(&CTYPE[1][5], "AIT", 3);
   strncpy(&CTYPE[3][5], "AIT", 3);
   NPV = 2;
   wcsex();

   /* COE: conic equal area. */
   strncpy(&CTYPE[1][5], "COE", 3);
   strncpy(&CTYPE[3][5], "COE", 3);
   NPV = 4;
   PV[2].value = 60.0;
   PV[3].value = 15.0;
   wcsex();

   /* COD: conic equidistant. */
   strncpy(&CTYPE[1][5], "COD", 3);
   strncpy(&CTYPE[3][5], "COD", 3);
   NPV = 4;
   PV[2].value = 60.0;
   PV[3].value = 15.0;
   wcsex();

   /* BON: Bonne's projection. */
   strncpy(&CTYPE[1][5], "BON", 3);
   strncpy(&CTYPE[3][5], "BON", 3);
   NPV = 3;
   PV[2].value = 30.0;
   wcsex();

   /* PCO: polyconic. */
   strncpy(&CTYPE[1][5], "PCO", 3);
   strncpy(&CTYPE[3][5], "PCO", 3);
   NPV = 2;
   wcsex();

   /* TSC: tangential spherical cube. */
   strncpy(&CTYPE[1][5], "TSC", 3);
   strncpy(&CTYPE[3][5], "TSC", 3);
   NPV = 2;
   wcsex();

   /* QSC: quadrilateralized spherical cube. */
   strncpy(&CTYPE[1][5], "QSC", 3);
   strncpy(&CTYPE[3][5], "QSC", 3);
   NPV = 2;
   wcsex();

   return 0;
}


/*----------------------------------------------------------------------------
*   wcsex() tests closure of wcss2p() and wcsp2s().
*---------------------------------------------------------------------------*/

void wcsex()

{
#define NELEM 9

   int k, lat, lng, stat[361], status;
   double dlat, dlatmx, dlng, dlngmx, freq, img1[361][NELEM],
          img2[361][NELEM], lat1, lng1, phi1[361], phi2[361], pix[361][NELEM],
          theta1[361], theta2[361], world[361][NELEM];
   struct wcsprm *wcs;
d163 1
a163 1
   wcs = (struct wcsprm *)malloc(sizeof(struct wcsprm));
d167 1
a167 2
   printf("\nTesting %s; reporting tolerance %5.1g deg.\n", wcs->cel.prj.code,
      tol);
d171 1
d174 7
a180 4
      world[k][0] = 0.0;
      world[k][1] = 0.0;
      world[k][2] = 0.0;
      world[k][3] = 0.0;
d182 1
a182 1
      world[k][wcs->spec] = 2.99792458e8 / freq;
d186 1
a186 3

   dlngmx = 0.0;
   dlatmx = 0.0;
d193 8
a200 2
         world[k][wcs->lng] = lng1;
         world[k][wcs->lat] = lat1;
d203 3
a205 4
      if (status = wcss2p(wcs, 361, NELEM, world[0], phi1, theta1, img1[0],
                       pix[0], stat)) {
         printf("   %3s(s2x): lat1 =%20.15f  ERROR %3d\n",
            wcs->cel.prj.code, lat1, status);
d209 3
a211 4
      if (status = wcsp2s(wcs, 361, NELEM, pix[0], img2[0], phi2, theta2,
                       world[0], stat)) {
         printf("   %3s(x2s): lat1 =%20.15f  ERROR%3d\n",
            wcs->cel.prj.code, lat1, status);
d215 9
a223 2
      for (lng = -180, k = 0; lng <= 180; lng++, k++) {
         lng1 = (double)lng;
d225 10
a234 19
         dlng = fabs(world[k][wcs->lng] - lng1);
         if (dlng > 180.0) dlng = fabs(dlng - 360.0);
         if (abs(lat) != 90 && dlng > dlngmx) dlngmx = dlng;

         dlat = fabs(world[k][wcs->lat] - lat1);
         if (dlat > dlatmx) dlatmx = dlat;

         if (dlat > tol || (dlng > tol && abs(lat) != 90)) {
            printf("        %3s: lng1 =%20.15f    lat1 =%20.15f\n"
                   "             lng2 =%20.15f    lat2 =%20.15f\n",
               wcs->cel.prj.code, lng1, lat1, world[k][wcs->lng],
               world[k][wcs->lat]);
            printf("             phi1 =%20.15f  theta1 =%20.15f\n"
                   "             phi2 =%20.15f  theta2 =%20.15f\n",
               phi1[k], theta1[k], phi2[k], theta2[k]);
            printf("               x1 =%20.15f      y1 =%20.15f\n"
                   "               x2 =%20.15f      y2 =%20.15f\n",
               img1[k][wcs->lng], img1[k][wcs->lat], img2[k][wcs->lng],
               img2[k][wcs->lat]);
d239 1
a239 2
   printf("     Maximum closure residual: lng%10.3e   lat%10.3e\n",
      dlngmx, dlatmx);
d243 2
@


3.6
log
@WCSLIB 3.6: print the size of various basic data types; "error
status/code/number" is now referred to consistently as the "status return
value"; in error messages, print "ERROR" (in uppercase) - POSIX standard;
removed support for K&R C.
@
text
@d3 2
a4 2
*   WCSLIB 3.6 - an implementation of the FITS WCS convention.
*   Copyright (C) 1995-2004, Mark Calabretta
d6 4
a9 4
*   This program is free software; you can redistribute it and/or modify it
*   under the terms of the GNU General Public License as published by the
*   Free Software Foundation; either version 2 of the License, or (at your
*   option) any later version.
d11 4
a14 4
*   This program is distributed in the hope that it will be useful, but
*   WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
*   General Public License for more details.
d17 2
a18 2
*   with this library; if not, write to the Free Software Foundation, Inc.,
*   675 Mass Ave, Cambridge, MA 02139, USA.
d30 1
a30 1
*   $Id: twcs1.c,v 3.5 2004/06/28 01:07:15 mcalabre Exp mcalabre $
@


3.5
log
@WCSLIB 3.5: print the size of the various structs (transferred from twcsprt,
now defunct).
@
text
@d3 1
a3 1
*   WCSLIB 3.5 - an implementation of the FITS WCS convention.
d30 1
a30 1
*   $Id: twcs1.c,v 3.4 2004/02/11 00:23:05 mcalabre Exp mcalabre $
d33 1
a33 1
*   twcs1 tests wcss2p() and wcsp2s() for closure on the 1 degree celestial
a45 5
#ifndef __STDC__
#ifndef const
#define const
#endif
#endif
d93 2
a94 2
   /* List error messages. */
   printf("\nList of wcs error codes:\n");
d99 12
d113 5
a117 5
   printf("   linprm:%5d /%4d\n", sizeof(struct linprm), LINLEN);
   printf("   celprm:%5d /%4d\n", sizeof(struct celprm), CELLEN);
   printf("   prjprm:%5d /%4d\n", sizeof(struct prjprm), PRJLEN);
   printf("   spcprm:%5d /%4d\n", sizeof(struct spcprm), SPCLEN);
   printf("   wcsprm:%5d /%4d\n", sizeof(struct wcsprm), WCSLEN);
d298 1
a298 1
         printf("   %3s(s2x): lat1 =%20.15f  error %3d\n",
d305 1
a305 1
         printf("   %3s(x2s): lat1 =%20.15f  error%3d\n",
d401 1
a401 1
      printf("wcsset error%3d\n", status);
@


3.4
log
@WCSLIB 3.4
@
text
@d3 1
a3 1
*   WCSLIB 3.4 - an implementation of the FITS WCS convention.
d28 3
a35 1
*   $Id: twcs1.c,v 3.3 2003/10/21 08:10:05 mcalabre Exp mcalabre $
d103 8
@


3.3
log
@WCSLIB 3.3: align the list of error codes; check the error status returned by
wcsset() in parser().
@
text
@d3 2
a4 2
*   WCSLIB 3.3 - an implementation of the FITS WCS convention.
*   Copyright (C) 1995-2003, Mark Calabretta
d33 1
a33 1
*   $Id: twcs1.c,v 3.2 2003/09/09 04:40:16 mcalabre Exp mcalabre $
@


3.2
log
@WCSLIB 3.2: set wcs.flag = -1 to initialize memory management in wcsini();
rationalized function return codes and messages.
@
text
@d3 1
a3 1
*   WCSLIB 3.2 - an implementation of the FITS WCS convention.
d33 1
a33 1
*   $Id: twcs1.c,v 3.1 2003/04/28 04:27:07 mcalabre Exp mcalabre $
d99 1
a99 1
      printf("   %d: %s.\n", j, wcs_errmsg[j]);
d154 1
a154 1
   /* CAR: Cartesian. */
d333 1
a333 1
   int i, j;
d383 3
a385 1
   (void) wcsset(wcs);
@


3.1
log
@WCSLIB 3.1
@
text
@d3 1
a3 1
*   WCSLIB 3.1 - an implementation of the FITS WCS convention.
d33 1
a33 1
*   $Id: twcs1.c,v 3.0 2003/04/01 04:16:39 mcalabre Exp mcalabre $
d97 3
a99 3
   printf("\nList of wcsini error codes:\n");
   for (j = 1; j <= 1 ; j++) {
      printf("   %d: %s.\n", j, wcsini_errmsg[j]);
a101 25
   printf("\nList of wcscpy error codes:\n");
   for (j = 1; j <= 1 ; j++) {
      printf("   %d: %s.\n", j, wcscpy_errmsg[j]);
   }

   printf("\nList of wcsset error codes:\n");
   for (j = 1; j <= 6 ; j++) {
      printf("   %d: %s.\n", j, wcsset_errmsg[j]);
   }

   printf("\nList of wcsp2s error codes:\n");
   for (j = 1; j <= 7 ; j++) {
      printf("   %d: %s.\n", j, wcsp2s_errmsg[j]);
   }

   printf("\nList of wcss2p error codes:\n");
   for (j = 1; j <= 7 ; j++) {
      printf("   %d: %s.\n", j, wcss2p_errmsg[j]);
   }

   printf("\nList of wcsmix error codes:\n");
   for (j = 1; j <= 8 ; j++) {
      printf("   %d: %s.\n", j, wcsmix_errmsg[j]);
   }

d247 1
@


3.0
log
@WCSLIB 3.0
@
text
@d3 1
a3 1
*   WCSLIB 3.0 - an implementation of the FITS WCS convention.
d33 1
a33 1
*   $Id: twcs1.c,v 2.13 2001/11/15 03:28:43 mcalabre Exp $
@


2.14
log
@Updated date in copyright notice.
@
text
@d3 2
a4 2
*   WCSLIB - an implementation of the FITS WCS proposal.
*   Copyright (C) 1995-2002, Mark Calabretta
d22 4
a25 4
*      Postal address: Dr. Mark Calabretta,
*                      Australia Telescope National Facility,
*                      P.O. Box 76,
*                      Epping, NSW, 2121,
d30 2
a31 2
*   twcs1 tests wcsfwd() and wcsrev() for closure on the 1 degree celestial
*   grid for a number of selected projections.
d33 1
a33 1
*   $Id: twcs1.c,v 2.13 2001/11/15 03:28:43 mcalabre Exp mcalabre $
d36 1
a40 2
#include "sph.h"
#include "wcs.h"
d42 2
d50 24
a73 2
void wcsex(double, char[][9], double[], struct celprm *, struct prjprm *,
           struct linprm *);
d75 2
a77 8
char ctype[4][9] = {"FREQ    ", "XLAT-xxx", "TIME    ", "XLON-xxx"};
double crpix[4] =  { 0.0,  0.0,  0.0,  0.0};
double pc[4][4] = {{ 1.1,  0.0,  0.0,  0.0},
                   { 0.0,  1.0,  0.0,  0.1},
                   { 0.0,  0.0,  1.0,  0.0},
                   { 0.0,  0.2,  0.0,  1.0}};
double cdelt[4] =  { 1.0,  1.0,  1.0, -1.0};
double crval[4] =  {408e6, 0.0, -2e3,  0.0};
a82 5
   const double tol = 1.0e-9;
   double latc;
   struct celprm cel0, celc, celp;
   struct prjprm prj;
   struct linprm lin;
d92 3
a94 2
   printf("\nTesting closure of WCSLIB world coordinate transformation routines\n");
   printf("------------------------------------------------------------------\n");
d97 10
d108 3
a110 1
   printf("   %d: %s.\n", 1, wcsset_errmsg[1]);
d112 3
a114 3
   printf("\nList of wcsfwd error codes:\n");
   for (j = 1; j <=4 ; j++) {
      printf("   %d: %s.\n", j, wcsfwd_errmsg[j]);
d117 3
a119 3
   printf("\nList of wcsrev error codes:\n");
   for (j = 1; j <=4 ; j++) {
      printf("   %d: %s.\n", j, wcsrev_errmsg[j]);
d123 1
a123 1
   for (j = 1; j <=5 ; j++) {
d128 23
a150 36
   lin.flag  = 0;
   lin.naxis = 4;
   lin.crpix = crpix;
   lin.pc    = (double*)pc;
   lin.cdelt = cdelt;

   for (j = 0; j < 10; prj.p[j++] = 0.0);
   for (j = 0; j < 10; prj.w[j++] = 0.0);
   prj.r0 = 0.0;

   /* Latitude midway between the standard parallels for the conics. */
   latc = 60.0;

   /* Set reference angles for the celestial grids; polar projections... */
   celp.ref[0] = 150.0;
   celp.ref[1] = -30.0;
   celp.ref[2] = 150.0;
   celp.ref[3] = 999.0;

   /* Force celp to be initialized since we want to use it now. */
   celp.flag = 0;
   (void) celset("ARC", &celp, &prj);

   /* Compute reference angles for the cylindrical and conic projections */
   /* so that they all use the same oblique celestial grid regardless of */
   /* the reference point; conic projections... */
   sphrev (0.0, latc, celp.euler, &celc.ref[0], &celc.ref[1]);
   sphfwd (0.0, 90.0, celp.euler, &celc.ref[2], &celc.ref[3]);

   /* ...cylindrical and conventional projections. */
   sphrev (0.0,  0.0, celp.euler, &cel0.ref[0], &cel0.ref[1]);
   sphfwd (0.0, 90.0, celp.euler, &cel0.ref[2], &cel0.ref[3]);

   /* Note that we have 3 contexts (CELP, CELC, and CEL0).  wcsex() will force
      these to be initialized on every invokation since PCODE will differ each
      time. */
d153 4
a156 3
   strncpy(&ctype[1][5], "ARC", 3);
   strncpy(&ctype[3][5], "ARC", 3);
   wcsex(tol, ctype, crval, &celp, &prj, &lin);
d159 4
a162 3
   strncpy(&ctype[1][5], "ZEA", 3);
   strncpy(&ctype[3][5], "ZEA", 3);
   wcsex(tol, ctype, crval, &celp, &prj, &lin);
d165 6
a170 5
   strncpy(&ctype[1][5], "CYP", 3);
   strncpy(&ctype[3][5], "CYP", 3);
   prj.p[1] = 3.0;
   prj.p[2] = 0.8;
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d173 5
a177 4
   strncpy(&ctype[1][5], "CEA", 3);
   strncpy(&ctype[3][5], "CEA", 3);
   prj.p[1] = 0.75;
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d180 4
a183 3
   strncpy(&ctype[1][5], "CAR", 3);
   strncpy(&ctype[3][5], "CAR", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d186 4
a189 3
   strncpy(&ctype[1][5], "SFL", 3);
   strncpy(&ctype[3][5], "SFL", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d192 4
a195 3
   strncpy(&ctype[1][5], "PAR", 3);
   strncpy(&ctype[3][5], "PAR", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d198 4
a201 3
   strncpy(&ctype[1][5], "MOL", 3);
   strncpy(&ctype[3][5], "MOL", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d204 4
a207 3
   strncpy(&ctype[1][5], "AIT", 3);
   strncpy(&ctype[3][5], "AIT", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d210 6
a215 5
   strncpy(&ctype[1][5], "COE", 3);
   strncpy(&ctype[3][5], "COE", 3);
   prj.p[1] = latc;
   prj.p[2] = 15.0;
   wcsex(tol, ctype, crval, &celc, &prj, &lin);
d218 6
a223 5
   strncpy(&ctype[1][5], "COD", 3);
   strncpy(&ctype[3][5], "COD", 3);
   prj.p[1] = latc;
   prj.p[2] = 15.0;
   wcsex(tol, ctype, crval, &celc, &prj, &lin);
d226 5
a230 4
   strncpy(&ctype[1][5], "BON", 3);
   strncpy(&ctype[3][5], "BON", 3);
   prj.p[1] = 30.0;
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d233 4
a236 3
   strncpy(&ctype[1][5], "PCO", 3);
   strncpy(&ctype[3][5], "PCO", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d239 4
a242 3
   strncpy(&ctype[1][5], "TSC", 3);
   strncpy(&ctype[3][5], "TSC", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d245 4
a248 4
   strcpy(&ctype[0][0], "CUBEFACE");
   strncpy(&ctype[1][5], "QSC", 3);
   strncpy(&ctype[3][5], "QSC", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);
d255 1
a255 11
*   wcsex() tests closure of wcsfwd() and wcsrev().
*
*   Given:
*      tol      double   Reporting tolerance, degrees.
*      ctype   char[][9] Coordinate axis types.
*      crval    double[] Coordinate reference values.
*
*   Given and returned:
*      cel      celprm*  Coordinate transformation parameters.
*      prj      prjprm*  Projection parameters.
*      lin      linprm*  Linear transformation parameters.
d258 10
a267 1
void wcsex(tol, ctype, crval, cel, prj, lin)
a268 6
double tol;
char   ctype[][9];
double crval[];
struct celprm *cel;
struct prjprm *prj;
struct linprm *lin;
d270 7
a276 10
{
   int err, lat, lng;
   double dlat, dlatmx, dlng, dlngmx, lat1, lng1, phi1, phi2, theta1, theta2;
   double img1[4], img2[4], pix[4], world[4];
   struct wcsprm wcs;

   wcs.flag = 0;
   cel->flag = 0;
   prj->flag = 0;
   prj->r0 = 0.0;
d278 7
a284 2
   dlngmx = 0.0;
   dlatmx = 0.0;
d286 3
a288 2
   /* Find the projection code. */
   (void) wcsset(lin->naxis, ctype, &wcs);
a289 1
   printf("\nTesting %s; reporting tolerance %5.1g deg.\n", wcs.pcode, tol);
d291 2
d296 1
a296 1
      for (lng = -180; lng <= 180; lng++) {
d299 17
a315 13
         world[0] = 0.0;
         world[1] = 0.0;
         world[2] = 0.0;
         world[3] = 0.0;
         world[wcs.lng] = lng1;
         world[wcs.lat] = lat1;

         if (err = wcsfwd(ctype, &wcs, world, crval, cel, &phi1, &theta1, prj,
                          img1, lin, pix)) {
            printf("        %3s: lng1 =%20.15f  lat1 =%20.15f  error %3d\n",
               wcs.pcode, lng1, lat1, err);
            continue;
         }
d317 2
a318 6
         if (err = wcsrev(ctype, &wcs, pix, lin, img2, prj, &phi2, &theta2,
                          crval, cel, world)) {
            printf("        %3s: lng1 =%20.15f  lat1 =%20.15f  error%3d\n",
               wcs.pcode, lng1, lat1, err);
            continue;
         }
d320 2
a321 2
         dlng = fabs(world[wcs.lng]-lng1);
         if (dlng > 180.0) dlng = fabs(dlng-360.0);
d323 2
a324 1
         dlat = fabs(world[wcs.lat]-lat1);
d330 2
a331 1
               wcs.pcode, lng1, lat1, world[wcs.lng], world[wcs.lat]);
d334 1
a334 1
               phi1, theta1, phi2, theta2);
d337 2
a338 1
               img1[wcs.lng], img1[wcs.lat], img2[wcs.lng], img2[wcs.lat]);
d345 65
@


2.13
log
@Changed date in copyright notice.
@
text
@d4 1
a4 1
*   Copyright (C) 1995-2001, Mark Calabretta
d33 1
a33 1
*   $Id: twcs1.c,v 2.12 2001/09/05 05:07:17 mcalabre Exp mcalabre $
@


2.12
log
@Reordered projections to match paper.
@
text
@d4 1
a4 1
*   Copyright (C) 1995-2000, Mark Calabretta
d33 1
a33 1
*   $Id: twcs1.c,v 2.11 2000/12/04 08:29:57 mcalabre Exp mcalabre $
d241 1
a241 1
 
d243 1
a243 1
 
d250 1
a250 1
 
d256 1
a256 1
 
d272 1
a272 1
 
d275 1
a275 1
 
d282 1
a282 1
 
d289 1
a289 1
 
d296 1
a296 1
 
d302 1
a302 1
 
d316 1
a316 1
 
@


2.11
log
@Renamed "GLS" -> "SFL"; eliminated GNU compiler warnings.
@
text
@d33 1
a33 1
*   $Id: twcs1.c,v 2.11 2000/12/04 06:51:46 mcalabre Exp mcalabre $
d157 6
d168 18
a185 4
   /* CEA: cylindrical equal area. */
   strncpy(&ctype[1][5], "CEA", 3);
   strncpy(&ctype[3][5], "CEA", 3);
   prj.p[1] = 0.75;
d188 3
a190 3
   /* COD: conic equidistant. */
   strncpy(&ctype[1][5], "COD", 3);
   strncpy(&ctype[3][5], "COD", 3);
d195 3
a197 3
   /* COE: conic equal area. */
   strncpy(&ctype[1][5], "COE", 3);
   strncpy(&ctype[3][5], "COE", 3);
d213 3
a215 8
   /* SFL: Sanson-Flamsteed. */
   strncpy(&ctype[1][5], "SFL", 3);
   strncpy(&ctype[3][5], "SFL", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);

   /* PAR: parabolic. */
   strncpy(&ctype[1][5], "PAR", 3);
   strncpy(&ctype[3][5], "PAR", 3);
a217 10
   /* AIT: Hammer-Aitoff. */
   strncpy(&ctype[1][5], "AIT", 3);
   strncpy(&ctype[3][5], "AIT", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);

   /* MOL: Mollweide's projection. */
   strncpy(&ctype[1][5], "MOL", 3);
   strncpy(&ctype[3][5], "MOL", 3);
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);

d219 1
a221 6
   wcsex(tol, ctype, crval, &cel0, &prj, &lin);

   /* TSC: tangential spherical cube. */
   strcpy(&ctype[0][0], "CUBEFACE");
   strncpy(&ctype[1][5], "TSC", 3);
   strncpy(&ctype[3][5], "TSC", 3);
@


2.10
log
@Updated date in copyright notice.
@
text
@d33 1
a33 1
*   $Id: twcs1.c,v 2.9 2000/01/31 07:02:47 mcalabre Exp mcalabre $
d62 1
a62 1
main()
d193 3
a195 3
   /* GLS: Sanson-Flamsteed (global sinusoid). */
   strncpy(&ctype[1][5], "GLS", 3);
   strncpy(&ctype[3][5], "GLS", 3);
d285 1
a285 1
            printf("        %3s: lng1 =%20.15lf  lat1 =%20.15lf  error %3d\n",
d292 1
a292 1
            printf("        %3s: lng1 =%20.15lf  lat1 =%20.15lf  error%3d\n",
d304 2
a305 2
            printf("        %3s: lng1 =%20.15lf    lat1 =%20.15lf\n"
                   "             lng2 =%20.15lf    lat2 =%20.15lf\n",
d307 2
a308 2
            printf("             phi1 =%20.15lf  theta1 =%20.15lf\n"
                   "             phi2 =%20.15lf  theta2 =%20.15lf\n",
d310 2
a311 2
            printf("               x1 =%20.15lf      y1 =%20.15lf\n"
                   "               x2 =%20.15lf      y2 =%20.15lf\n",
d317 1
a317 1
   printf("     Maximum closure residual: lng%10.3le   lat%10.3le\n",
@


2.9
log
@Fixed comment concerning use of ieee_handler().
@
text
@d4 1
a4 1
*   Copyright (C) 1995-1999, Mark Calabretta
d33 1
a33 1
*   $Id: twcs1.c,v 2.8 1999/12/13 07:37:39 mcalabre Exp mcalabre $
@


2.8
log
@Revised include file handling; added return statement.
@
text
@d33 1
a33 1
*   $Id: twcs1.c,v 2.8 1999/12/13 07:34:12 mcalabre Exp mcalabre $
d77 1
a77 1
/* call ieee_handler ("set", "common", SIGFPE_ABORT); */
@


2.7
log
@Lowered reporting tolerance to 1e-9 (was 1e-10) and report intermediate
values for points outside this tolerance.
@
text
@d33 1
a33 1
*   $Id: twcs1.c,v 2.6 1999/11/19 00:33:22 mcalabre Exp mcalabre $
d36 1
d39 2
a64 1
   char   text[80];
d224 1
a224 1
   exit(0);
@


2.6
log
@"Closure tolerance" becomes "Reporting tolerance".
@
text
@d33 1
a33 1
*   $Id: twcs1.c,v 2.5 1999/06/16 00:13:11 mcalabre Exp mcalabre $
d46 3
a61 1
   void wcsex();
d64 1
a64 1
   const double tol = 1.0e-10;
d251 2
a252 2
   double dlat, dlatmx, dlng, dlngmx, lat1, lng1, phi, theta;
   double img[4], pix[4], world[4];
d281 2
a282 2
         if (err = wcsfwd(ctype, &wcs, world, crval, cel, &phi, &theta, prj,
                          img, lin, pix)) {
d288 2
a289 2
         if (err = wcsrev(ctype, &wcs, pix, lin, img, prj, &phi, &theta, crval,
                          cel, world)) {
d301 10
a310 12
         if (dlat > tol) {
            printf("        %3s: lng1 =%20.15lf  lat1 =%20.15lf\n",
               wcs.pcode, lng1, lat1);
            printf("             lng2 =%20.15lf  lat2 =%20.15lf\n",
               world[wcs.lng], world[wcs.lat]);
         } else if (abs(lat) != 90) {
            if (dlng > tol) {
               printf("        %3s: lng1 =%20.15lf  lat1 =%20.15lf\n",
                  wcs.pcode, lng1, lat1);
               printf("             lng2 =%20.15lf  lat2 =%20.15lf\n",
                  world[wcs.lng], world[wcs.lat]);
            }
@


2.5
log
@Updated date in copyright notice.
@
text
@d33 1
a33 1
*   $Id: twcs1.c,v 2.4 1998/02/25 07:05:50 mcalabre Exp mcalabre $
d228 1
a228 1
*      tol      double   Closure tolerance, degrees.
d264 1
a264 1
   printf("\nTesting %s; closure tolerance %8.1g deg.\n", wcs.pcode, tol);
a316 1

@


2.4
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
*   Copyright (C) 1995-1998, Mark Calabretta
d33 1
a33 1
*   $Id: twcs1.c,v 2.3 1998/01/30 00:16:15 mcalabre Exp mcalabre $
@


2.3
log
@Include <stdlib.h>, and replace return from main with exit.
@
text
@d4 1
a4 1
*   Copyright (C) 1995-1998 Mark Calabretta
d33 1
a33 1
*   $Id: twcs1.c,v 2.2 1996/09/10 06:35:34 mcalabre Exp mcalabre $
@


2.2
log
@Fixed some dodgy pointer references noted by the GNU compiler.
@
text
@d4 1
a4 1
*   Copyright (C) 1995,1996 Mark Calabretta
d33 1
a33 1
*   $Id: twcs1.c,v 2.1 1996/05/07 20:35:19 mcalabre Exp mcalabre $
d36 1
d220 1
a220 1
   return 0;
@


2.1
log
@Initial revision
@
text
@d33 1
a33 1
*   $Id$
d214 1
a214 1
   strcpy(&ctype[0], "CUBEFACE");
d278 1
a278 1
         if (err = wcsfwd(ctype, wcs, world, crval, cel, &phi, &theta, prj,
d285 1
a285 1
         if (err = wcsrev(ctype, wcs, pix, lin, img, prj, &phi, &theta, crval,
@
