diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/digiphot/ptools/txtools/t_txdump.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/digiphot/ptools/txtools/t_txdump.x')
-rw-r--r-- | noao/digiphot/ptools/txtools/t_txdump.x | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/noao/digiphot/ptools/txtools/t_txdump.x b/noao/digiphot/ptools/txtools/t_txdump.x new file mode 100644 index 00000000..8d2b332e --- /dev/null +++ b/noao/digiphot/ptools/txtools/t_txdump.x @@ -0,0 +1,45 @@ +# T_TXDUMP -- Procedure to perform a relational select operation upon a set of +# records within a text file. Our function is to select all records from the +# input file matching some criterion, printing the listed fields on the +# standard output. Dumping the keywords and reheadersting is optional. + +procedure t_txdump () + +pointer textfile # list of input text files +pointer fields # list of fields to be dumped +pointer expr # boolean expression to be evaluated +int headers # format the output +int parameters # print the headers + +int list, fd +pointer sp +bool clgetb() +int clpopnu(), clgfil(), open(), btoi() + +begin + # Allocate working space. + call smark (sp) + call salloc (textfile, SZ_FNAME, TY_CHAR) + call salloc (fields, SZ_LINE, TY_CHAR) + call salloc (expr, SZ_LINE, TY_CHAR) + + # Get the parameters. + list = clpopnu ("textfiles") + call clgstr ("fields", Memc[fields], SZ_LINE) + call strupr (Memc[fields]) + call clgstr ("expr", Memc[expr], SZ_LINE) + headers = btoi (clgetb ("headers")) + parameters = btoi (clgetb ("parameters")) + + # Select records. + while (clgfil (list, Memc[textfile], SZ_FNAME) != EOF) { + fd = open (Memc[textfile], READ_ONLY, TEXT_FILE) + if (Memc[fields] != EOS) + call pt_xdump (fd, Memc[fields], Memc[expr], headers, + parameters) + call close (fd) + } + + call clpcls (list) + call sfree (sp) +end |