aboutsummaryrefslogtreecommitdiff
path: root/sys/mwcs/mwnewsys.x
blob: e7d1e11705b57d3c51c2e086febd706b078857d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<syserr.h>
include	"mwcs.h"

# MW_NEWSYSTEM -- Add a new world coordinate system with the given name
# and dimensionality to the MWCS.  Make the new system the current system,
# since a number of WCS initialization calls will (should) surely follow.

procedure mw_newsystem (mw, system, ndim)

pointer	mw			#I pointer to MWCS descriptor
char	system[ARB]		#I system name
int	ndim			#I system dimensionality

pointer	wp
int	mw_refstr()
pointer	mw_findsys()
errchk	syserrs, mw_refstr

begin
	# Check that the system does not already exist.
	if (mw_findsys (mw, system) != NULL)
	    call syserrs (SYS_MWWCSREDEF, system)

	# Add the new system.
	if (MI_NWCS(mw) + 1 > MAX_WCS)
	    call syserrs (SYS_MWMAXWCS, system)
	MI_NWCS(mw) = MI_NWCS(mw) + 1
	wp = MI_WCSP(mw,MI_NWCS(mw))

	# Initialize the WCS.
	WCS_NDIM(wp) = ndim

	# Make the new WCS the default WCS.
	MI_WCS(mw) = wp

	# The system name is stored as a global (axis=0) attribute of the WCS.
	call mw_swattrs (mw, 0, "system", system)
	WCS_SYSTEM(wp) = mw_refstr (mw, system)
end