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/photcal/mctable/mctget.gx | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/digiphot/photcal/mctable/mctget.gx')
-rw-r--r-- | noao/digiphot/photcal/mctable/mctget.gx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/noao/digiphot/photcal/mctable/mctget.gx b/noao/digiphot/photcal/mctable/mctget.gx new file mode 100644 index 00000000..f79379c8 --- /dev/null +++ b/noao/digiphot/photcal/mctable/mctget.gx @@ -0,0 +1,46 @@ +include "../lib/mctable.h" + + +$for (csilrdxp) +# MCT_GET - Get a single value from the table (generic). + +PIXEL procedure mct_get$t (table, row, col) + +pointer table # table descriptor +int row # row number +int col # column number + +pointer mct_getrow() +errchk mct_getrow() + +begin + # Check pointer and magic number. + if (table == NULL) + call error (0, "mct_get: Null table pointer") + if (MCT_MAGIC (table) != MAGIC) + call error (0, "mct_get: Bad magic number") + + # Check the table type. + if (MCT_TYPE (table) != TY_PIXEL) + call error (0, "mct_get: Wrong table type") + + # Check the row and column range. + if (row < 1 || row > MCT_NPROWS (table)) + call error (0, "mct_get: Bad row number") + if (row == MCT_NPROWS (table) && (col < 1 || col > MCT_NPCOLS (table))) + call error (0, "mct_get: Bad column number at last row") + if (row != MCT_NPROWS (table) && (col < 1 || col > MCT_MAXCOL (table))) + call error (0, "mct_get: Bad column number") + + # Update the counters. + MCT_NGROWS (table) = row + MCT_NGCOLS (table) = col + + # Return value. + $if (datatype == p) + return (MEMP[mct_getrow (table, row) + col - 1]) + $else + return (Mem$t[mct_getrow (table, row) + col - 1]) + $endif +end +$endfor |