aboutsummaryrefslogtreecommitdiff
path: root/sys/clio/clgfil.x
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 /sys/clio/clgfil.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/clio/clgfil.x')
-rw-r--r--sys/clio/clgfil.x144
1 files changed, 144 insertions, 0 deletions
diff --git a/sys/clio/clgfil.x b/sys/clio/clgfil.x
new file mode 100644
index 00000000..62d40dd1
--- /dev/null
+++ b/sys/clio/clgfil.x
@@ -0,0 +1,144 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <fset.h>
+
+.help clpopn[isu], clplen, clgfil, clpcls
+.nf ___________________________________________________________________________
+Expand a filename template given as the string value of a CL parameter.
+
+ clpopni - open a sorted input list or open list "STDIN"
+ clpopns - open a sorted list
+ clpopnu - open an unsorted list
+ clpcls - close a list
+ clplen - get number of filenames in list
+ clgfil - get next filename from list
+ clprew - rewind the list
+
+The CLPOPNI procedure creates a dummy list containing the single filename
+"STDIN" if the standard input is redirected.
+.endhelp ______________________________________________________________________
+
+
+# CLPOPNI -- Open an input list (sorted list of input files). If the standard
+# input has been redirected, create a dummy list containing the single file
+# name "STDIN", and do not try to access the template parameter.
+
+int procedure clpopni (param)
+
+char param[ARB] # CL filename template parameter
+int sort
+pointer sp, template, list
+int fntopnb(), fstati()
+
+begin
+ call smark (sp)
+ call salloc (template, SZ_COMMAND, TY_CHAR)
+
+ sort = YES
+
+ if (fstati (STDIN, F_REDIR) == YES)
+ list = fntopnb ("STDIN", sort)
+ else {
+ call clgstr (param, Memc[template], SZ_COMMAND)
+ list = fntopnb (Memc[template], sort)
+ }
+
+ call sfree (sp)
+ return (list)
+end
+
+
+# CLPOPNS -- Open a sorted list (sorted list of files, not associated with any
+# particular byte stream).
+
+int procedure clpopns (param)
+
+char param[ARB] # CL filename template parameter
+int sort
+pointer sp, template, list
+int fntopnb()
+
+begin
+ call smark (sp)
+ call salloc (template, SZ_COMMAND, TY_CHAR)
+
+ sort = YES
+
+ call clgstr (param, Memc[template], SZ_COMMAND)
+ list = fntopnb (Memc[template], sort)
+
+ call sfree (sp)
+ return (list)
+end
+
+
+# CLPOPNU -- Open an unsorted list (unsorted list of files, not associated
+# with any particular stream).
+
+int procedure clpopnu (param)
+
+char param[ARB] # CL filename template parameter
+int sort
+pointer sp, template, list
+int fntopnb()
+
+begin
+ call smark (sp)
+ call salloc (template, SZ_COMMAND, TY_CHAR)
+
+ sort = NO
+
+ call clgstr (param, Memc[template], SZ_COMMAND)
+ list = fntopnb (Memc[template], sort)
+
+ call sfree (sp)
+ return (list)
+end
+
+
+# CLPLEN -- Return the number of file names in the list.
+
+int procedure clplen (list)
+
+pointer list
+int fntlenb()
+
+begin
+ return (fntlenb (list))
+end
+
+
+# CLGFIL -- Return the next filename from the list.
+
+int procedure clgfil (list, fname, maxch)
+
+int list # list descriptor
+char fname[ARB] # output string
+int maxch
+int fntgfnb()
+
+begin
+ return (fntgfnb (list, fname, maxch))
+end
+
+
+# CLPCLS -- Close a filename list and return all storage.
+
+procedure clpcls (list)
+
+int list # list descriptor
+
+begin
+ call fntclsb (list)
+end
+
+
+# GLPREW -- Rewind the filename list.
+
+procedure clprew (list)
+
+int list # list descriptor
+
+begin
+ call fntrewb (list)
+end