13515Sache/*
23515Sache *  rc.h -- declarations for configuration file processing
33515Sache *
43515Sache *  AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
53515Sache *
63515Sache *  This program is free software; you can redistribute it and/or
73515Sache *  modify it under the terms of the GNU General Public License
83515Sache *  as published by the Free Software Foundation; either version 2
93515Sache *  of the License, or (at your option) any later version.
103515Sache *
113515Sache *  This program is distributed in the hope that it will be useful,
123515Sache *  but WITHOUT ANY WARRANTY; without even the implied warranty of
133515Sache *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
143515Sache *  GNU General Public License for more details.
153515Sache *
163515Sache *  You should have received a copy of the GNU General Public License
173515Sache *  along with this program; if not, write to the Free Software
183515Sache *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
193515Sache */
203515Sache
213515Sache
223515Sache#define DIALOGRC ".dialogrc"
233515Sache#define VAR_LEN 30
243515Sache#define COMMENT_LEN 70
253515Sache
263515Sache/* Types of values */
273515Sache#define VAL_INT  0
283515Sache#define VAL_STR  1
293515Sache#define VAL_BOOL 2
303515Sache#define VAL_ATTR 3
313515Sache
323515Sache/* Type of line in configuration file */
333515Sache#define LINE_BLANK    2
343515Sache#define LINE_COMMENT  1
353515Sache#define LINE_OK       0
363515Sache#define LINE_ERROR   -1
373515Sache
383515Sache/* number of configuration variables */
393515Sache#define VAR_COUNT        (sizeof(vars) / sizeof(vars_st))
403515Sache
413515Sache/* check if character is white space */
423515Sache#define whitespace(c)    (c == ' ' || c == '\t')
433515Sache
443515Sache/* check if character is string quoting characters */
453515Sache#define isquote(c)       (c == '"' || c == '\'')
463515Sache
473515Sache/* get last character of string */
483515Sache#define lastch(str)      str[strlen(str)-1]
493515Sache
503515Sache/*
513515Sache * Configuration variables
523515Sache */
533515Sachetypedef struct {
543515Sache  unsigned char      name[VAR_LEN];  /* name of configuration variable as in DIALOGRC */
553515Sache  void     *var;            /* address of actually variable to change */
563515Sache  int       type;           /* type of value */
573515Sache  unsigned char      comment[COMMENT_LEN];    /* comment to put in "rc" file */
583515Sache} vars_st;
593515Sache
603515Sachevars_st vars[] = {
613515Sache  {  "use_shadow",
623515Sache     &use_shadow,
633515Sache     VAL_BOOL,
643515Sache     "Shadow dialog boxes? This also turns on color."                        },
653515Sache
663515Sache  {  "use_colors",
673515Sache     &use_colors,
683515Sache     VAL_BOOL,
693515Sache     "Turn color support ON or OFF"                                          },
703515Sache
713515Sache  {  "screen_color",
723515Sache     color_table[0],
733515Sache     VAL_ATTR,
743515Sache     "Screen color"                                                          },
753515Sache
763515Sache  {  "shadow_color",
773515Sache     color_table[1],
783515Sache     VAL_ATTR,
793515Sache     "Shadow color"                                                          },
803515Sache
813515Sache  {  "dialog_color",
823515Sache     color_table[2],
833515Sache     VAL_ATTR,
843515Sache     "Dialog box color"                                                      },
853515Sache
863515Sache  {  "title_color",
873515Sache     color_table[3],
883515Sache     VAL_ATTR,
893515Sache     "Dialog box title color"                                                },
903515Sache
913515Sache  {  "border_color",
923515Sache     color_table[4],
933515Sache     VAL_ATTR,
943515Sache     "Dialog box border color"                                               },
953515Sache
963515Sache  {  "button_active_color",
973515Sache     color_table[5],
983515Sache     VAL_ATTR,
993515Sache     "Active button color"                                                   },
1003515Sache
1013515Sache  {  "button_inactive_color",
1023515Sache     color_table[6],
1033515Sache     VAL_ATTR,
1043515Sache     "Inactive button color"                                                 },
1053515Sache
1063515Sache  {  "button_key_active_color",
1073515Sache     color_table[7],
1083515Sache     VAL_ATTR,
1093515Sache     "Active button key color"                                               },
1103515Sache
1113515Sache  {  "button_key_inactive_color",
1123515Sache     color_table[8],
1133515Sache     VAL_ATTR,
1143515Sache     "Inactive button key color"                                             },
1153515Sache
1163515Sache  {  "button_label_active_color",
1173515Sache     color_table[9],
1183515Sache     VAL_ATTR,
1193515Sache     "Active button label color"                                             },
1203515Sache
1213515Sache  {  "button_label_inactive_color",
1223515Sache     color_table[10],
1233515Sache     VAL_ATTR,
1243515Sache     "Inactive button label color"                                           },
1253515Sache
1263515Sache  {  "inputbox_color",
1273515Sache     color_table[11],
1283515Sache     VAL_ATTR,
1293515Sache     "Input box color"                                                       },
1303515Sache
1313515Sache  {  "inputbox_border_color",
1323515Sache     color_table[12],
1333515Sache     VAL_ATTR,
1343515Sache     "Input box border color"                                                },
1353515Sache
1363515Sache  {  "searchbox_color",
1373515Sache     color_table[13],
1383515Sache     VAL_ATTR,
1393515Sache     "Search box color"                                                      },
1403515Sache
1413515Sache  {  "searchbox_title_color",
1423515Sache     color_table[14],
1433515Sache     VAL_ATTR,
1443515Sache     "Search box title color"                                                },
1453515Sache
1463515Sache  {  "searchbox_border_color",
1473515Sache     color_table[15],
1483515Sache     VAL_ATTR,
1493515Sache     "Search box border color"                                               },
1503515Sache
1513515Sache  {  "position_indicator_color",
1523515Sache     color_table[16],
1533515Sache     VAL_ATTR,
1543515Sache     "File position indicator color"                                         },
1553515Sache
1563515Sache  {  "menubox_color",
1573515Sache     color_table[17],
1583515Sache     VAL_ATTR,
1593515Sache     "Menu box color"                                                        },
1603515Sache
1613515Sache  {  "menubox_border_color",
1623515Sache     color_table[18],
1633515Sache     VAL_ATTR,
1643515Sache     "Menu box border color"                                                 },
1653515Sache
1663515Sache  {  "item_color",
1673515Sache     color_table[19],
1683515Sache     VAL_ATTR,
1693515Sache     "Item color"                                                            },
1703515Sache
1713515Sache  {  "item_selected_color",
1723515Sache     color_table[20],
1733515Sache     VAL_ATTR,
1743515Sache     "Selected item color"                                                   },
1753515Sache
1763515Sache  {  "tag_color",
1773515Sache     color_table[21],
1783515Sache     VAL_ATTR,
1793515Sache     "Tag color"                                                             },
1803515Sache
1813515Sache  {  "tag_selected_color",
1823515Sache     color_table[22],
1833515Sache     VAL_ATTR,
1843515Sache     "Selected tag color"                                                    },
1853515Sache
1863515Sache  {  "tag_key_color",
1873515Sache     color_table[23],
1883515Sache     VAL_ATTR,
1893515Sache     "Tag key color"                                                         },
1903515Sache
1913515Sache  {  "tag_key_selected_color",
1923515Sache     color_table[24],
1933515Sache     VAL_ATTR,
1943515Sache     "Selected tag key color"                                                },
1953515Sache
1963515Sache  {  "check_color",
1973515Sache     color_table[25],
1983515Sache     VAL_ATTR,
1993515Sache     "Check box color"                                                       },
2003515Sache
2013515Sache  {  "check_selected_color",
2023515Sache     color_table[26],
2033515Sache     VAL_ATTR,
2043515Sache     "Selected check box color"                                              },
2053515Sache
2063515Sache  {  "uarrow_color",
2073515Sache     color_table[27],
2083515Sache     VAL_ATTR,
2093515Sache     "Up arrow color"                                                        },
2103515Sache
2113515Sache  {  "darrow_color",
2123515Sache     color_table[28],
2133515Sache     VAL_ATTR,
2143515Sache     "Down arrow color"                                                      }
2153515Sache};    /* vars */
2163515Sache
2173515Sache
2183515Sache
2193515Sache/*
2203515Sache * Routines to process configuration file
2213515Sache */
2223515Sacheint parse_rc(void);
223