10SN/A/*
2474SN/A * Copyright (C) 1984-2023  Mark Nudelman
30SN/A *
40SN/A * You may distribute under the terms of either the GNU General Public
50SN/A * License or the Less License, as specified in the README file.
60SN/A *
7157SN/A * For more information, see the README file.
80SN/A */
9157SN/A
100SN/A
110SN/A#define END_OPTION_STRING       ('$')
120SN/A
130SN/A/*
140SN/A * Types of options.
150SN/A */
160SN/A#define BOOL            01      /* Boolean option: 0 or 1 */
170SN/A#define TRIPLE          02      /* Triple-valued option: 0, 1 or 2 */
180SN/A#define NUMBER          04      /* Numeric option */
190SN/A#define STRING          010     /* String-valued option */
200SN/A#define NOVAR           020     /* No associated variable */
21157SN/A#define REPAINT         040     /* Repaint screen after toggling option */
22157SN/A#define NO_TOGGLE       0100    /* Option cannot be toggled with "-" cmd */
23157SN/A#define HL_REPAINT      0200    /* Repaint hilites after toggling option */
240SN/A#define NO_QUERY        0400    /* Option cannot be queried with "_" cmd */
250SN/A#define INIT_HANDLER    01000   /* Call option handler function at startup */
260SN/A
270SN/A#define OTYPE           (BOOL|TRIPLE|NUMBER|STRING|NOVAR)
280SN/A
290SN/A#define OLETTER_NONE    '\1'     /* Invalid option letter */
300SN/A
310SN/A/*
320SN/A * Argument to a handling function tells what type of activity:
330SN/A */
340SN/A#define INIT    0       /* Initialization (from command line) */
350SN/A#define QUERY   1       /* Query (from _ or - command) */
360SN/A#define TOGGLE  2       /* Change value (from - command) */
370SN/A
380SN/A/* Flag to toggle_option to specify how to "toggle" */
390SN/A#define OPT_NO_TOGGLE   0
400SN/A#define OPT_TOGGLE      1
410SN/A#define OPT_UNSET       2
420SN/A#define OPT_SET         3
430SN/A#define OPT_NO_PROMPT   0100
440SN/A
450SN/A/* Error code from findopt_name */
460SN/A#define OPT_AMBIG       1
470SN/A
480SN/Astruct optname
490SN/A{
500SN/A        char *oname;            /* Long (GNU-style) option name */
510SN/A        struct optname *onext;  /* List of synonymous option names */
520SN/A};
530SN/A
540SN/A#define OPTNAME_MAX     32      /* Max length of long option name */
550SN/A
560SN/Astruct loption
570SN/A{
580SN/A        char oletter;           /* The controlling letter (a-z) */
590SN/A        struct optname *onames; /* Long (GNU-style) option name */
600SN/A        int otype;              /* Type of the option */
610SN/A        int odefault;           /* Default value */
620SN/A        int *ovar;              /* Pointer to the associated variable */
630SN/A        void (*ofunc)(int, char*); /* Pointer to special handling function */
640SN/A        char *odesc[3];         /* Description of each value */
65474SN/A};
66474SN/A
670SN/A