/*
* Copyright (C) 1996-2000 Michael R. Elkins
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
int mutt_alloc_color (int fg, int bg)
{
COLOR_LIST *p = ColorList;
int i;
#if defined (USE_SLANG_CURSES)
char fgc[SHORT_STRING], bgc[SHORT_STRING];
#endif
/* check to see if this color is already allocated to save space */
while (p)
{
if (p->fg == fg && p->bg == bg)
{
(p->count)++;
return (COLOR_PAIR (p->index));
}
p = p->next;
}
/* check to see if there are colors left */
if (++UserColors > COLOR_PAIRS) return (A_NORMAL);
/* find the smallest available index (object) */
i = 1;
FOREVER
{
p = ColorList;
while (p)
{
if (p->index == i) break;
p = p->next;
}
if (p == NULL) break;
i++;
}
do
{
mutt_extract_token (buf, s, 0);
if (!mutt_strcmp ("*", buf->data))
{
for (tmp = ColorIndexList; tmp; )
{
if (!do_cache)
do_cache = 1;
last = tmp;
tmp = tmp->next;
mutt_free_color_line(&last, parse_uncolor);
}
ColorIndexList = NULL;
}
else
{
for (last = NULL, tmp = ColorIndexList; tmp; last = tmp, tmp = tmp->next)
{
if (!mutt_strcmp (buf->data, tmp->pattern))
{
if (!do_cache)
do_cache = 1;
dprint(1,(debugfile,"Freeing pattern \"%s\" from ColorIndexList\n",
tmp->pattern));
if (last)
last->next = tmp->next;
else
ColorIndexList = tmp->next;
mutt_free_color_line(&tmp, parse_uncolor);
break;
}
}
}
}
while (MoreArgs (s));
if (do_cache && !option (OPTNOCURSES))
{
int i;
set_option (OPTFORCEREDRAWINDEX);
/* force re-caching of index colors */
for (i = 0; Context && i < Context->msgcount; i++)
Context->hdrs[i]->pair = 0;
}
return (0);
}
static int
add_pattern (COLOR_LINE **top, const char *s, int sensitive,
int fg, int bg, int attr, BUFFER *err,
int is_index)
{
/* is_index used to store compiled pattern
* only for `index' color object
* when called from mutt_parse_color() */
COLOR_LINE *tmp = *top;
while (tmp)
{
if (sensitive)
{
if (mutt_strcmp (s, tmp->pattern) == 0)
break;
}
else
{
if (mutt_strcasecmp (s, tmp->pattern) == 0)
break;
}
tmp = tmp->next;
}
*o = MT_COLOR_QUOTED;
}
else if ((*o = mutt_getvaluebyname (buf->data, Fields)) == -1)
{
snprintf (err->data, err->dsize, _("%s: no such object"), buf->data);
return (-1);
}
return 0;
}
typedef int (*parser_callback_t)(BUFFER *, BUFFER *, int *, int *, int *, BUFFER *);
#ifdef HAVE_COLOR
static int
parse_color_pair(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *err)
{
if (! MoreArgs (s))
{
strfcpy (err->data, _("color: too few arguments"), err->dsize);
return (-1);
}
static int
parse_attr_spec(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *err)
{
if(fg) *fg = -1;
if(bg) *bg = -1;
if (! MoreArgs (s))
{
strfcpy (err->data, _("mono: too few arguments"), err->dsize);
return (-1);
}
mutt_extract_token (buf, s, 0);
if (ascii_strcasecmp ("bold", buf->data) == 0)
*attr |= A_BOLD;
else if (ascii_strcasecmp ("underline", buf->data) == 0)
*attr |= A_UNDERLINE;
else if (ascii_strcasecmp ("none", buf->data) == 0)
*attr = A_NORMAL;
else if (ascii_strcasecmp ("reverse", buf->data) == 0)
*attr |= A_REVERSE;
else if (ascii_strcasecmp ("standout", buf->data) == 0)
*attr |= A_STANDOUT;
else if (ascii_strcasecmp ("normal", buf->data) == 0)
*attr = A_NORMAL; /* needs use = instead of |= to clear other bits */
else
{
snprintf (err->data, err->dsize, _("%s: no such attribute"), buf->data);
return (-1);
}
return 0;
}
static int fgbgattr_to_color(int fg, int bg, int attr)
{
#ifdef HAVE_COLOR
if(fg != -1 && bg != -1)
return attr | mutt_alloc_color(fg, bg);
else
#endif
return attr;
}
/* usage: color
Domain Hosting
/* Header describing internals of libintl library.
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ulrich Drepper , 1995.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifndef _GETTEXTP_H
#define _GETTEXTP_H
#include /* Get size_t. */
#ifdef _LIBC
# include "../iconv/gconv_int.h"
#else
# if HAVE_ICONV
# include
# endif
#endif
/* Tell the compiler when a conditional or integer expression is
almost always true or almost always false. */
#ifndef HAVE_BUILTIN_EXPECT
# define __builtin_expect(expr, val) (expr)
#endif
/* This is the representation of the expressions to determine the
plural form. */
struct expression
{
int nargs; /* Number of arguments. */
enum operator
{
/* Without arguments: */
var, /* The variable "n". */
num, /* Decimal number. */
/* Unary operators: */
lnot, /* Logical NOT. */
/* Binary operators: */
mult, /* Multiplication. */
divide, /* Division. */
module, /* Module operation. */
plus, /* Addition. */
minus, /* Subtraction. */
less_than, /* Comparison. */
greater_than, /* Comparison. */
less_or_equal, /* Comparison. */
greater_or_equal, /* Comparison. */
equal, /* Comparision for equality. */
not_equal, /* Comparision for inequality. */
land, /* Logical AND. */
lor, /* Logical OR. */
/* Ternary operators: */
qmop /* Question mark operator. */
} operation;
union
{
unsigned long int num; /* Number value for `num'. */
struct expression *args[3]; /* Up to three arguments. */
} val;
};
/* This is the data structure to pass information to the parser and get
the result in a thread-safe way. */
struct parse_args
{
const char *cp;
struct expression *res;
};
/* The representation of an opened message catalog. */
struct loaded_domain
{
const char *data;
int use_mmap;
size_t mmap_size;
int must_swap;
nls_uint32 nstrings;
struct string_desc *orig_tab;
struct string_desc *trans_tab;
nls_uint32 hash_size;
nls_uint32 *hash_tab;
int codeset_cntr;
#ifdef _LIBC
__gconv_t conv;
#else
# if HAVE_ICONV
iconv_t conv;
# endif
#endif
char **conv_tab;
struct expression *plural;
unsigned long int nplurals;
};
/* We want to allocate a string at the end of the struct. But ISO C
doesn't allow zero sized arrays. */
#ifdef __GNUC__
# define ZERO 0
#else
# define ZERO 1
#endif
/* A set of settings bound to a message domain. Used to store settings
from bindtextdomain() and bind_textdomain_codeset(). */
struct binding
{
struct binding *next;
char *dirname;
int codeset_cntr; /* Incremented each time codeset changes. */
char *codeset;
char domainname[ZERO];
};
/* A counter which is incremented each time some previous translations
become invalid.
This variable is part of the external ABI of the GNU libintl. */
extern int _nl_msg_cat_cntr;
Java Web Hosting
JSP Web Hosting
Tomcat Web Hosting
PHP Web Hosting
MySQL Web Hosting
PostgreSQL Web Hosting
Database Web Hosting
Servlet Web Hosting
J2EE Web Hosting
Frontpage Web Hosting
SSH Web Hosting
CGI Web Hosting