aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/photcal/mkconfig.cl
blob: 7f2ad64261d62845b060f2e8e92e36cc5323741a (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# MKCONFIG -- Create / edit a PHOTCAL configuration file.

procedure mkconfig (config, catalog, observations, transform)

file	config       {prompt="The new configuration file"}
file	catalog	     {"STDIN",
	prompt="The source of the catalog format specification"}
file	observations {"STDIN",
	prompt="The source of the observations file format specification"}
file	transform    {"STDIN",
	prompt="The source of the transformation equations"}
file	template     {"", prompt="An existing template configuration file"}
string	catdir	     {")_.catdir",prompt="The standard star catalog directory"}
bool	verify	     {no, prompt="Verify each new entry"}
bool	edit	     {yes,prompt="Edit the new configuration file"}
bool	check	     {yes,prompt="Check the configuration file"}
bool	verbose	     {no, prompt="Verbose output"}


begin
	# Declare local variables

	file	con, temp, tcat, cat, tobs, obs, ttrans, trans
	string	cdir

	string junk

	# Get the output and template files.

	con = config
	if (access (con))
	    error (0, "The configuration file " // con // " already exists")
	temp = template

	# Define the source of the catalog, observation and transformation
	# sections.

	if (access (temp)) {

	    cat = ""
	    obs = ""
	    trans = ""

	} else {

	    cdir = catdir

	    tcat = catalog
	    cat = "f" // tcat // ".dat"
	    if (! access (cat)) {
		cat = cdir // cat
	        if (! access (cat)) {
		    cat = tcat
		    if (! access (cat))
		        error (0,
			    "Cannot find " // tcat //
			    " in current or standards directory")
		}
	    }

	    tobs = observations
	    obs = "f" // tobs // ".dat"
	    if (! access (obs)) {
		obs = tobs
		if (! access (obs))
		    error (0,
		        "Cannot find " // tobs // " in current directory")
	    }

	    ttrans=transform
	    trans = "t" // ttrans // ".dat"
	    if (! access (trans)) {
		trans = cdir // trans
		if (! access (trans)) {
		    trans = ttrans
	            if (! access (trans))
		        error (0,
	       	        "Cannot find " // ttrans //
			" in current or standards directory")
	       }
	    }
	}

	# Make a new configuration file.

	config (con, catalog=cat, observations=obs, transform=trans,
	    template=temp, verify=verify)

	# Edit the catalog with the editor.

	print ("")
	if (edit)
	    edit (con)

	# Check the configuration file for semantic and syntax errors.
	print ("")
	if (check)
	    chkconfig (con, verbose=verbose)
end