funcolumnlookup(3)

πŸ’« funcolumnlookup(3) β€” the SAORD Documentation glow-up πŸ’«

okay bestie, sit down, hydrate, because we're talking about FunColumnLookup from the funtools fam β€” it's the little function that spills the tea on any column you point at. like, name, type, mode, offset, size… the whole ✨dossier✨. no cap.


🌸 NAME 🌸

FunColumnLookup β€” lookup a Funtools column πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <funtools.h>

int FunColumnLookup(Fun fun, char *s, int which,
                    char **name, int *type, int *mode,
                    int *offset, int *n, int *width)

✨ DESCRIPTION ✨

so the FunColumnLookup() routine is literally the group chat gossip of column info β€” you hand it a column (by name or by index) and it hands you back everything: the name, the type, the mode, the offset, how many elements, how wide. obsessed. 🫢

first arg is the Fun handle for this whole set of columns. second arg is the name of the column you're looking up. and here's the plot twist: if the name argument is NULL, then the argument right after it is the zero-based index into the column array of the column you want info about. so it's giving "either/or" energy, iykyk.

next up is a pointer to a char *, which is where the name of the column gets dropped. and then the args after that are all addresses of int values, and here's what lands in each one:

  • type β€” the data type of the column, and the menu is:
    • A: ASCII characters
    • B: unsigned 8-bit char
    • I: signed 16-bit int
    • U: unsigned 16-bit int (not standard FITS, bestie, just so you know)
    • J: signed 32-bit int
    • V: unsigned 32-bit int (not standard FITS either, don't come for me)
    • E: 32-bit float
    • D: 64-bit float
  • mode β€” the bit flag status of the column, and the flags are:
    • COL_ACTIVE β€” 1 β€” is the column activated?
    • COL_IBUF β€” 2 β€” is the column in the raw input data?
    • COL_PTR β€” 4 β€” is the column a pointer to an array?
    • COL_READ β€” 010 β€” is read mode selected?
    • COL_WRITE β€” 020 β€” is write mode selected?
    • COL_REPLACEME β€” 040 β€” is this column being replaced by user data?
  • offset β€” the byte offset in the struct πŸ“
  • n β€” the number of elements (i.e. the size of the vector) in this column
  • width β€” the size in bytes of this column πŸ“

so if the named column actually exists, the routine returns a positive integer and we're thriving. otherwise it returns zero. (and that positive integer? it's the index+1 into the column array of where this column was located. cute, right?)

now β€” if you pass NULL as the return address for one (or more) of these values, then no data comes back for that thing. you just skip it, no drama. for example:

if( !FunColumnLookup(fun, "phas", 0, NULL NULL, NULL, NULL, &npha, NULL) )
  gerror(stderr, "can't find phas column\n");

this one only brings back info about the size of the phas vector. minimalist queen. πŸ‘‘


🌈 SEE ALSO 🌈

peep funtools(7) for the full list of Funtools help pages β€” it's the master doc, fr fr.


and that's the whole vibe πŸ’– this was version 1.4.5, dated April 14, 2011, brought to you by the SAORD Documentation girlies. stay hydrated, stay curious, and go look up some columns, bestie πŸŽ€πŸ¦‹βœ¨