diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/clio/clgfil.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/clio/clgfil.x')
-rw-r--r-- | sys/clio/clgfil.x | 144 |
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 |