1 2 #ifndef INSTAPPSUP_H 3 4 /* Instrument command line application support functions */ 5 6 /* 7 * Argyll Color Correction System 8 * 9 * Author: Graeme W. Gill 10 * Date: 15/3/2001 11 * 12 * Copyright 2001 - 2013 Graeme W. Gill 13 * All rights reserved. 14 * 15 * This material is licenced under the GNU GENERAL PUBLIC LICENSE Version 2 or later :- 16 * see the License2.txt file for licencing details. 17 * 18 */ 19 20 //#include "insttypes.h" /* libinst Includes this functionality */ 21 //#include "icoms.h" 22 //#include "conv.h" 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* ============================================================================= */ 29 /* a default user interaction callback handler */ 30 31 /* User key types */ 32 #define DUIH_NONE 0x0000 /* No meaning */ 33 #define DUIH_ABORT 0x0100 /* User abort operation */ 34 #define DUIH_TERM 0x0200 /* User terminated operation */ 35 #define DUIH_CMND 0x0400 /* User command */ 36 #define DUIH_TRIG 0x0800 /* User trigger */ 37 38 /* The default uicallback function and context. resets uih too. */ 39 #define DUIH_FUNC_AND_CONTEXT (inst_reset_uih(), inst_get_uicallback()), inst_get_uicontext() 40 41 /* Return the default uicallback function */ 42 inst_code (*inst_get_uicallback())(void *, inst_ui_purp); 43 44 /* Return the default uicallback context */ 45 void *inst_get_uicontext(); 46 47 /* Install the default uicallback function in the given inst */ 48 void inst_set_uicallback(inst *p); 49 50 /* Reset user interaction handling to default (Esc, ^C, q or 'Q' = Abort) */ 51 void inst_reset_uih(); 52 53 /* Set a key range to the given handling type */ 54 /* min & max are between 0 and 255, status is one of */ 55 /* DUIH_OK, DUIH_USER, DUIH_TERM, DUIH_TRIG, DUIH_CMND */ 56 void inst_set_uih(int min, int max, int status); 57 58 /* Get the character that caused the user trigger or abort */ 59 /* + its key type in the upper 8 bits. */ 60 /* Clear it to 0x00 after reading it. */ 61 int inst_get_uih_char(); 62 63 /* ============================================================================= */ 64 65 #ifndef DISPSUP_H 66 /* Opaque type as far as inst.h is concerned. */ 67 typedef struct _disp_win_info disp_win_info; 68 #endif 69 70 /* A default calibration user interaction handler using the console. */ 71 /* This handles both normal and display based calibration interaction */ 72 /* with the instrument, if a disp_setup function and pointer to disp_win_info */ 73 /* is provided. */ 74 inst_code inst_handle_calibrate( 75 inst *p, 76 inst_cal_type calt, /* Calibration type to do */ 77 inst_cal_cond calc, /* Current calibration condition */ 78 inst_code (*disp_setup) (inst *p, inst_cal_cond calc, disp_win_info *dwi), 79 /* Callback for handling a display calibration - May be NULL */ 80 disp_win_info *dwi, /* Information to be able to open a display test patch - May be NULL */ 81 int doimmediately /* If nz, don't wait for user, calibrate immediatley */ 82 ); 83 84 /* ============================================================================= */ 85 86 /* A helper function to display -y flag usage for each instrument type available */ 87 /* Return accumulated capabilities2 of all the instruments. */ 88 /* If docbib is nz, then only display the base calibration display types */ 89 inst2_capability inst_show_disptype_options(FILE *fp, char *oline, icompaths *icmps, int docbib); 90 91 /* A helper function to turn a -y flag into a list index */ 92 /* If docbib is nz, then only allow base calibration display types */ 93 /* Return 0 on error */ 94 int inst_get_disptype_index(inst *it, int c, int docbib); 95 96 #ifdef __cplusplus 97 } 98 #endif 99 100 #define INSTAPPSUP_H 101 #endif /* INSTAPPSUP_H */ 102