libohana API reference

functions in string.c

 int get_argument (int argc, char **argv, char *arg); 
search argv, argc list (starting at argv[1]) for desired argument. returns entry number if found, 0 otherwise.
 int remove_argument (int Narg, int &argc, char **argv); 
remove the given entry Narg from the argv list, adjusting argc appropriately.
 int stripwhite (char *string); 
strip whitespace (space or tab) from start and end of string.
 int strnumcmp (char *str1, char *str2); 
compare str1 and str2 as strings, or as numbers if both are pure numeric values (base 10 only). returns TRUE / FALSE.
 char *strcreate (char *string); 
 char *strncreate (char *string, int Nbytes); 
 int scan_line (FILE *f, char *line); 
 int dparse (double *value, int Nentry, char *line); 
 int fparse (double *value, int Nentry, char *line); 
 char *_parse_nextword (char *string); 

functions in findexec.c

 char *pathname (char *file); 
 char *filerootname (char *file); 
 char *fileextname (char *file); 
 char *filebasename (char *file); 
 char *findexec (int argc, char **argv); 
 int mkdirhier (char *path); 
 char *getcwd_cfht (char *path, int size); 

functions in glockfile.c

 FILE *fsetlockfile (char *filename, double timeout, int type, int *state); 
 int fclearlockfile (char *filename, FILE *f, int type, int *state); 
 int setlockfile2 (char *filename, double timeout, int type, int *state); 
 int clearlockfile2 (char *filename, double timeout, int type, int *state); 
deprecated functions : are they all removed?
 int setlockfile (char *name, double timeout, int hard); 
 int clearlockfile (char *name, int fd, int hard); 
 int gnfsflush (char *filename); 

functions in Fread.c

 int Fread (char ptr, int size, int nitems, FILE *f, char *type); 
 int Fwrite (char ptr, int size, int nitems, FILE *f, char *type); 
 int ByteSwap (char *ptr, int size, int nitems, char *type); 
 int ConvertStruct (char *buffer, int size, int nitems, char *type); 

functions in LoadPhotcodes.c

 int LoadPhotcodes (char *filename, PhotCodeData *photcodes); 
 int FreePhotcodes (PhotCodeData *photcodes); 
 int GetPhotcodebyName (PhotCodeData *photcodes, char *name); 
 int GetPhotcodeRefs (PhotCodeData *photcodes, char *name, int *code, int *ref); 
 int GetPhotcodeEquiv (PhotCodeData *photcodes, char *name, int *code, int *ref); 
 char *GetPhotnamebyCode (PhotCodeData *photcodes, int code); 

functions in config.c

 char *SelectConfigFile (int *argc, char **argv, char *progname); 
 char *LoadConfigFile (char *filename); 
 char *ScanConfig (char *config, char *field, char *mode, int Nentry, ...); 
 char *expandline (char *line, char *config); 
 char *LoadRawConfigFile (char *filename, int options); 

functions in coordops.c

 int XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords); 
 int RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords); 
 int fXY_to_RD (float *ra, float *dec, float x,  float y,   Coords *coords); 
 int fRD_to_XY (float *x,  float *y,   float ra, float dec, Coords *coords); 
 int GetCoords (Coords *coords, Header *header); 
 int coords_precess (double *ra, double *dec, double in_epoch, double out_epoch); 

functions in phot_catalog.c

 int lock_catalog (Catalog *catalog, int lockmode); 
 int unlock_catalog (Catalog *catalog); 
 int load_catalog (Catalog *catalog, char mode, int VERBOSE); 
 int save_catalog (Catalog *catalog, char VERBOSE); 
 Measure *FixOldMeasure (OldMeasure *in, int Nvalues); 
 Average *FixOldAverage (OldAverage *in, int Nvalues); 
 SecFilt *FixOldSecFilt (OldSecFilt *in, int Nvalues); 

functions in photfits.c

 short int putMi (double value); 
 double getMi (short int value); 
 void returnMcal (Image *image, double *c); 
 void assignMcal (Image *image, double *c, int order); 
 double applyMcal (Image *image, double x, double y); 
 double findscatter (double *X, double *Y, double *M, double *dM, int N, double *c, int order); 

defined macros

the ohana library includes the following macros:
ALLOCATE (void *ptr, type, int Nelement)
REALLOCATE (void *ptr, type, int Nelement)

SIGN(X)  
ROUND(X) 
SQR(X)   
SQ(X)    
MIN(X,Y) 
MAX(X,Y) 
SWAP(X,Y) 

whitespace (char c)

defined constants

TRUE
FALSE

LCK_SOFT - block writing
LCK_XCLD - block reading and writing
LCK_HARD - block reading and writing, persistent

LCK_UNLOCK   - file is unlocked 
LCK_ACCESS   - can't get access to file 
LCK_TIMEOUT  - timeout setting lock 
LCK_HARDLCK  - error setting hard lockfile 
LCK_HUNLOCK  - error clearing hard lockfile 
	    
LCK_EMPTY    - locked file is empty 
LCK_FULL     - locked file is not empty 
LCK_UNKNOWN  - can't stat file to get size