mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Add auto-size to screen to \d? commands. Use UNION to show all
\d? results in one query. Add \d? field search feature. Rename MB to MULTIBYTE.
This commit is contained in:
@ -117,14 +117,14 @@ extern "C"
|
||||
#define EOW (BOL+5)
|
||||
#define CODEMAX (BOL+5) /* highest code used */
|
||||
|
||||
#ifdef MB
|
||||
# if MB == MULE_INTERNAL
|
||||
#ifdef MULTIBYTE
|
||||
# if MULTIBYTE == MULE_INTERNAL
|
||||
# define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */
|
||||
# define NNONCHAR (CODEMAX-16777216)
|
||||
# elif MB == EUC_JP || MB == EUC_CN || MB == EUC_KR || MB == EUC_TW
|
||||
# elif MULTIBYTE == EUC_JP || MULTIBYTE == EUC_CN || MULTIBYTE == EUC_KR || MULTIBYTE == EUC_TW
|
||||
# define NONCHAR(c) ((c) > USHRT_MAX)
|
||||
# define NNONCHAR (CODEMAX-USHRT_MAX)
|
||||
# elif MB == UNICODE
|
||||
# elif MULTIBYTE == UNICODE
|
||||
# define NONCHAR(c) ((c) > USHRT_MAX)
|
||||
# define NNONCHAR (CODEMAX-USHRT_MAX)
|
||||
# else /* assume 1 byte code such as ISO8859-1 */
|
||||
@ -200,7 +200,7 @@ int eflags;
|
||||
else
|
||||
{
|
||||
start = string;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
stop = start + pg_wchar_strlen(start);
|
||||
#else
|
||||
stop = start + strlen(start);
|
||||
@ -214,7 +214,7 @@ int eflags;
|
||||
{
|
||||
for (dp = start; dp < stop; dp++)
|
||||
if (*dp == g->must[0] && stop - dp >= g->mlen &&
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
memcmp(dp, g->must, (size_t) (g->mlen * sizeof(pg_wchar))) == 0)
|
||||
#else
|
||||
memcmp(dp, g->must, (size_t) g->mlen) == 0)
|
||||
@ -1165,7 +1165,7 @@ sopno stopst;
|
||||
|
||||
static int pg_isprint(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isprint(c));
|
||||
#else
|
||||
return(isprint(c));
|
||||
|
@ -194,7 +194,7 @@ int cflags;
|
||||
struct parse *p = &pa;
|
||||
int i;
|
||||
size_t len;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar *wcp;
|
||||
#endif
|
||||
|
||||
@ -210,7 +210,7 @@ int cflags;
|
||||
|
||||
if (cflags & REG_PEND)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
wcp = preg->patsave;
|
||||
if (preg->re_endp < wcp)
|
||||
return (REG_INVARG);
|
||||
@ -222,7 +222,7 @@ int cflags;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
wcp = (pg_wchar *)malloc((strlen(pattern)+1) * sizeof(pg_wchar));
|
||||
if (wcp == NULL) {
|
||||
return (REG_ESPACE);
|
||||
@ -253,7 +253,7 @@ int cflags;
|
||||
|
||||
/* set things up */
|
||||
p->g = g;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
p->next = wcp;
|
||||
#else
|
||||
p->next = (pg_wchar *)pattern; /* convenience; we do not modify it */
|
||||
@ -607,7 +607,7 @@ int starordinary; /* is a leading * an ordinary character? */
|
||||
if (c == '\\')
|
||||
{
|
||||
REQUIRE(MORE(), REG_EESCAPE);
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
c = BACKSL | (pg_wchar) GETNEXT();
|
||||
#else
|
||||
c = BACKSL | (unsigned char) GETNEXT();
|
||||
@ -755,13 +755,13 @@ struct parse *p;
|
||||
{
|
||||
cset *cs = allocset(p);
|
||||
int invert = 0;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar sp1[] = {'[', ':', '<', ':', ']', ']'};
|
||||
pg_wchar sp2[] = {'[', ':', '>', ':', ']', ']'};
|
||||
#endif
|
||||
|
||||
/* Dept of Truly Sickening Special-Case Kludges */
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp1, 6) == 0)
|
||||
#else
|
||||
if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0)
|
||||
@ -771,7 +771,7 @@ struct parse *p;
|
||||
NEXTn(6);
|
||||
return;
|
||||
}
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp2, 6) == 0)
|
||||
#else
|
||||
if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0)
|
||||
@ -903,7 +903,7 @@ cset *cs;
|
||||
finish = start;
|
||||
/* xxx what about signed chars here... */
|
||||
REQUIRE(start <= finish, REG_ERANGE);
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (CHlc(start) != CHlc(finish)) {
|
||||
SETERROR(REG_ERANGE);
|
||||
}
|
||||
@ -933,7 +933,7 @@ cset *cs;
|
||||
NEXT();
|
||||
len = p->next - sp;
|
||||
for (cp = cclasses; cp->name != NULL; cp++)
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (pg_char_and_wchar_strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
|
||||
#else
|
||||
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
|
||||
@ -1012,7 +1012,7 @@ int endc; /* name ended by endc,']' */
|
||||
}
|
||||
len = p->next - sp;
|
||||
for (cp = cnames; cp->name != NULL; cp++)
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (pg_char_and_wchar_strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
|
||||
#else
|
||||
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
|
||||
@ -1084,7 +1084,7 @@ int ch;
|
||||
bothcases(p, ch);
|
||||
else
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
EMIT(OCHAR, (pg_wchar) ch);
|
||||
#else
|
||||
EMIT(OCHAR, (unsigned char) ch);
|
||||
@ -1788,7 +1788,7 @@ struct re_guts *g;
|
||||
return;
|
||||
|
||||
/* turn it into a character string */
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
g->must = (pg_wchar *)malloc((size_t) (g->mlen + 1)*sizeof(pg_wchar));
|
||||
#else
|
||||
g->must = malloc((size_t) g->mlen + 1);
|
||||
@ -1854,7 +1854,7 @@ struct re_guts *g;
|
||||
*/
|
||||
static int pg_isdigit(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isdigit(c));
|
||||
#else
|
||||
return(isdigit(c));
|
||||
@ -1863,7 +1863,7 @@ static int pg_isdigit(int c)
|
||||
|
||||
static int pg_isalpha(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isalpha(c));
|
||||
#else
|
||||
return(isalpha(c));
|
||||
@ -1872,7 +1872,7 @@ static int pg_isalpha(int c)
|
||||
|
||||
static int pg_isupper(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isupper(c));
|
||||
#else
|
||||
return(isupper(c));
|
||||
@ -1881,7 +1881,7 @@ static int pg_isupper(int c)
|
||||
|
||||
static int pg_islower(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && islower(c));
|
||||
#else
|
||||
return(islower(c));
|
||||
|
@ -215,7 +215,7 @@ char *localbuf;
|
||||
struct rerr *r;
|
||||
|
||||
for (r = rerrs; r->code != 0; r++)
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (pg_char_and_wchar_strcmp(r->name, preg->re_endp) == 0)
|
||||
#else
|
||||
if (strcmp(r->name, preg->re_endp) == 0)
|
||||
|
@ -164,7 +164,7 @@ int eflags;
|
||||
{
|
||||
struct re_guts *g = preg->re_g;
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar *str;
|
||||
int sts;
|
||||
#endif
|
||||
@ -182,7 +182,7 @@ int eflags;
|
||||
return (REG_BADPAT);
|
||||
eflags = GOODFLAGS(eflags);
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
str = (pg_wchar *)malloc((strlen(string)+1) * sizeof(pg_wchar));
|
||||
if (!str) {
|
||||
return(REG_ESPACE);
|
||||
|
@ -68,7 +68,7 @@ regex_t *preg;
|
||||
return;
|
||||
preg->re_magic = 0; /* mark it invalid */
|
||||
g->magic = 0; /* mark it invalid */
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (preg->patsave != NULL) {
|
||||
free((char *)preg->patsave);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* misc conversion functions between pg_wchar and other encodings.
|
||||
* Tatsuo Ishii
|
||||
* $Id: utils.c,v 1.3 1998/06/16 07:29:29 momjian Exp $
|
||||
* $Id: utils.c,v 1.4 1998/07/18 18:34:08 momjian Exp $
|
||||
*/
|
||||
#include <regex/pg_wchar.h>
|
||||
|
||||
@ -350,19 +350,19 @@ static pg_wchar_tbl pg_wchar_table[] = {
|
||||
/* convert a multi-byte string to a wchar */
|
||||
void pg_mb2wchar(const unsigned char *from, pg_wchar *to)
|
||||
{
|
||||
(*pg_wchar_table[MB].mb2wchar_with_len)(from,to,strlen(from));
|
||||
(*pg_wchar_table[MULTIBYTE].mb2wchar_with_len)(from,to,strlen(from));
|
||||
}
|
||||
|
||||
/* convert a multi-byte string to a wchar with a limited length */
|
||||
void pg_mb2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
|
||||
{
|
||||
(*pg_wchar_table[MB].mb2wchar_with_len)(from,to,len);
|
||||
(*pg_wchar_table[MULTIBYTE].mb2wchar_with_len)(from,to,len);
|
||||
}
|
||||
|
||||
/* returns the byte length of a multi-byte word */
|
||||
int pg_mblen(const unsigned char *mbstr)
|
||||
{
|
||||
return((*pg_wchar_table[MB].mblen)(mbstr));
|
||||
return((*pg_wchar_table[MULTIBYTE].mblen)(mbstr));
|
||||
}
|
||||
|
||||
/* returns the byte length of a multi-byte word for an encoding */
|
||||
|
Reference in New Issue
Block a user