aboutsummaryrefslogtreecommitdiff
path: root/noao/artdata/mkexamples/mkexamples.cl
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/artdata/mkexamples/mkexamples.cl
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/artdata/mkexamples/mkexamples.cl')
-rw-r--r--noao/artdata/mkexamples/mkexamples.cl68
1 files changed, 68 insertions, 0 deletions
diff --git a/noao/artdata/mkexamples/mkexamples.cl b/noao/artdata/mkexamples/mkexamples.cl
new file mode 100644
index 00000000..ed9150e4
--- /dev/null
+++ b/noao/artdata/mkexamples/mkexamples.cl
@@ -0,0 +1,68 @@
+# MKEXAMPLES -- Make ARTDATA examples.
+# The example script files use variable s1 to pass the image name,
+# variable s2 to pass the image header file, variable i to pass an object
+# seed, variable j to pass a noise seed, and variable b1 to pass the comment
+# flag.
+
+procedure mkexamples (name, image)
+
+string name {prompt="Example name"}
+string image {prompt="Image name"}
+
+int oseed=1 {prompt="Object seed"}
+int nseed=1 {prompt="Noise seed"}
+bool comments=no {prompt="Add comments to image?"}
+bool verbose=yes {prompt="Print operation?"}
+bool errors=yes {prompt="Report errors?"}
+bool list=no {prompt="List example script file only?"}
+
+begin
+ string name1, name2, example
+
+
+ # Get and check parameters.
+ if ($nargs < 1 && mode != "h") {
+ name1 = "mkexamples"
+ name2 = ""
+ while (name1 != name2) {
+ example = "mkexamples$" // name1 // ".men"
+ if (!access (example))
+ break
+ type (example)
+ name2 = name1
+ name1 = name
+ }
+ if (name1 == name2)
+ return
+ } else
+ name1 = name
+
+ example = "mkexamples$" // name1 // ".cl"
+ if (!access (example)) {
+ if (errors)
+ error (2, "Unknown example " // name1)
+ return
+ }
+
+ # Make or list the example.
+ if (list)
+ page (example)
+ else {
+ s1 = image
+ s2 = "artdata$stdheader.dat"
+ i = oseed
+ j = nseed
+ b1 = comments
+ if (s1 == "" || name1 == "")
+ return
+ if ((access (s1) || access (s1//"."//envget("imtype")))) {
+ if (errors)
+ error (1, "Image " // s1 // " already exists")
+ return
+ }
+
+ if (verbose)
+ print ("Creating example ", name1, " in image ", s1, " ...")
+ cl (< example)
+ }
+end