Commit 7b2b779a authored by Bruce Momjian's avatar Bruce Momjian

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.
parent 550f2097
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.29 1998/06/16 07:29:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.30 1998/07/18 18:34:01 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <libpq/libpq.h> #include <libpq/libpq.h>
#include <utils/syscache.h> #include <utils/syscache.h>
#ifdef MB #ifdef MULTIBYTE
#include <commands/variable.h> #include <commands/variable.h>
#endif #endif
...@@ -84,7 +84,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo) ...@@ -84,7 +84,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
Datum attr; Datum attr;
bool isnull; bool isnull;
Oid typoutput; Oid typoutput;
#ifdef MB #ifdef MULTIBYTE
unsigned char *p; unsigned char *p;
#endif #endif
...@@ -132,7 +132,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo) ...@@ -132,7 +132,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
outputstr = fmgr(typoutput, attr, outputstr = fmgr(typoutput, attr,
gettypelem(typeinfo->attrs[i]->atttypid), gettypelem(typeinfo->attrs[i]->atttypid),
typeinfo->attrs[i]->atttypmod); typeinfo->attrs[i]->atttypmod);
#ifdef MB #ifdef MULTIBYTE
p = pg_server_to_client(outputstr, strlen(outputstr)); p = pg_server_to_client(outputstr, strlen(outputstr));
pq_putint(strlen(p) + VARHDRSZ, VARHDRSZ); pq_putint(strlen(p) + VARHDRSZ, VARHDRSZ);
pq_putnchar(p, strlen(p)); pq_putnchar(p, strlen(p));
...@@ -281,7 +281,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo) ...@@ -281,7 +281,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
/* variable length, assume a varlena structure */ /* variable length, assume a varlena structure */
len = VARSIZE(attr) - VARHDRSZ; len = VARSIZE(attr) - VARHDRSZ;
#ifdef MB #ifdef MULTIBYTE
pq_putncharlen(VARDATA(attr), len); pq_putncharlen(VARDATA(attr), len);
#else #else
pq_putint(len, VARHDRSZ); pq_putint(len, VARHDRSZ);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* conversion between client encoding and server internal encoding * conversion between client encoding and server internal encoding
* (currently mule internal code (mic) is used) * (currently mule internal code (mic) is used)
* Tatsuo Ishii * Tatsuo Ishii
* $Id: mbutils.c,v 1.1 1998/06/16 07:38:18 momjian Exp $ * $Id: mbutils.c,v 1.2 1998/07/18 18:34:01 momjian Exp $
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "regex/pg_wchar.h" #include "regex/pg_wchar.h"
#include "commands/variable.h" #include "commands/variable.h"
static int client_encoding = MB; /* defalut client encoding is set to static int client_encoding = MULTIBYTE; /* defalut client encoding is set to
same as the server encoding */ same as the server encoding */
/* /*
* convert bogus chars that cannot be represented in the current encoding * convert bogus chars that cannot be represented in the current encoding
...@@ -381,10 +381,10 @@ int pg_set_client_encoding(int encoding) ...@@ -381,10 +381,10 @@ int pg_set_client_encoding(int encoding)
{ {
client_encoding = encoding; client_encoding = encoding;
if (client_encoding == MB) { /* server == client? */ if (client_encoding == MULTIBYTE) { /* server == client? */
client_to_mic = client_from_mic = 0; client_to_mic = client_from_mic = 0;
server_to_mic = server_from_mic = 0; server_to_mic = server_from_mic = 0;
} else if (MB == MULE_INTERNAL) { /* server == MULE_INETRNAL? */ } else if (MULTIBYTE == MULE_INTERNAL) { /* server == MULE_INETRNAL? */
client_to_mic = get_enc_ent(encoding)->to_mic; client_to_mic = get_enc_ent(encoding)->to_mic;
client_from_mic = get_enc_ent(encoding)->from_mic; client_from_mic = get_enc_ent(encoding)->from_mic;
server_to_mic = server_from_mic = 0; server_to_mic = server_from_mic = 0;
...@@ -393,16 +393,16 @@ int pg_set_client_encoding(int encoding) ...@@ -393,16 +393,16 @@ int pg_set_client_encoding(int encoding)
} }
} else if (encoding == MULE_INTERNAL) { /* client == MULE_INETRNAL? */ } else if (encoding == MULE_INTERNAL) { /* client == MULE_INETRNAL? */
client_to_mic = client_from_mic = 0; client_to_mic = client_from_mic = 0;
server_to_mic = get_enc_ent(MB)->to_mic; server_to_mic = get_enc_ent(MULTIBYTE)->to_mic;
server_from_mic = get_enc_ent(MB)->from_mic; server_from_mic = get_enc_ent(MULTIBYTE)->from_mic;
if (server_to_mic == 0 || server_from_mic == 0) { if (server_to_mic == 0 || server_from_mic == 0) {
return(-1); return(-1);
} }
} else { } else {
client_to_mic = get_enc_ent(encoding)->to_mic; client_to_mic = get_enc_ent(encoding)->to_mic;
client_from_mic = get_enc_ent(encoding)->from_mic; client_from_mic = get_enc_ent(encoding)->from_mic;
server_to_mic = get_enc_ent(MB)->to_mic; server_to_mic = get_enc_ent(MULTIBYTE)->to_mic;
server_from_mic = get_enc_ent(MB)->from_mic; server_from_mic = get_enc_ent(MULTIBYTE)->from_mic;
if (client_to_mic == 0 || client_from_mic == 0) { if (client_to_mic == 0 || client_from_mic == 0) {
return(-1); return(-1);
} }
...@@ -504,7 +504,7 @@ const char *pg_encoding_to_char(int encoding) ...@@ -504,7 +504,7 @@ const char *pg_encoding_to_char(int encoding)
return(p->name); return(p->name);
} }
#ifdef MBUTILSDEBUG #ifdef MULTIBYTEUTILSDEBUG
#include <stdio.h> #include <stdio.h>
main() main()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO', * Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements. * 'SHOW var' and 'RESET var' statements.
* *
* $Id: variable.c,v 1.7 1998/06/16 07:29:21 momjian Exp $ * $Id: variable.c,v 1.8 1998/07/18 18:34:01 momjian Exp $
* *
*/ */
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "commands/variable.h" #include "commands/variable.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "optimizer/internal.h" #include "optimizer/internal.h"
#ifdef MB #ifdef MULTIBYTE
#include "regex/pg_wchar.h" #include "regex/pg_wchar.h"
#endif #endif
...@@ -522,7 +522,7 @@ reset_timezone() ...@@ -522,7 +522,7 @@ reset_timezone()
return TRUE; return TRUE;
} /* reset_timezone() */ } /* reset_timezone() */
#ifdef MB #ifdef MULTIBYTE
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
bool bool
parse_client_encoding(const char *value) parse_client_encoding(const char *value)
...@@ -535,7 +535,7 @@ parse_client_encoding(const char *value) ...@@ -535,7 +535,7 @@ parse_client_encoding(const char *value)
} else { } else {
if (pg_set_client_encoding(encoding)) { if (pg_set_client_encoding(encoding)) {
elog(ERROR, "Conversion between %s and %s is not supported", elog(ERROR, "Conversion between %s and %s is not supported",
value, pg_encoding_to_char(MB)); value, pg_encoding_to_char(MULTIBYTE));
} }
} }
return TRUE; return TRUE;
...@@ -558,10 +558,10 @@ reset_client_encoding() ...@@ -558,10 +558,10 @@ reset_client_encoding()
if (env) { if (env) {
encoding = pg_char_to_encoding(env); encoding = pg_char_to_encoding(env);
if (encoding < 0) { if (encoding < 0) {
encoding = MB; encoding = MULTIBYTE;
} }
} else { } else {
encoding = MB; encoding = MULTIBYTE;
} }
pg_set_client_encoding(encoding); pg_set_client_encoding(encoding);
return TRUE; return TRUE;
...@@ -598,7 +598,7 @@ struct VariableParsers ...@@ -598,7 +598,7 @@ struct VariableParsers
{ {
"r_plans", parse_r_plans, show_r_plans, reset_r_plans "r_plans", parse_r_plans, show_r_plans, reset_r_plans
}, },
#ifdef MB #ifdef MULTIBYTE
{ {
"client_encoding", parse_client_encoding, show_client_encoding, reset_client_encoding "client_encoding", parse_client_encoding, show_client_encoding, reset_client_encoding
}, },
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.48 1998/07/09 03:28:46 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.49 1998/07/18 18:34:03 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#include "libpq/auth.h" #include "libpq/auth.h"
#include "libpq/libpq.h" /* where the declarations go */ #include "libpq/libpq.h" /* where the declarations go */
#include "storage/ipc.h" #include "storage/ipc.h"
#ifdef MB #ifdef MULTIBYTE
#include "commands/variable.h" #include "commands/variable.h"
#endif #endif
...@@ -181,7 +181,7 @@ pq_getstr(char *s, int maxlen) ...@@ -181,7 +181,7 @@ pq_getstr(char *s, int maxlen)
{ {
int c = '\0'; int c = '\0';
#ifdef MB #ifdef MULTIBYTE
unsigned char *p, *ps; unsigned char *p, *ps;
int len; int len;
...@@ -199,7 +199,7 @@ pq_getstr(char *s, int maxlen) ...@@ -199,7 +199,7 @@ pq_getstr(char *s, int maxlen)
*s++ = c; *s++ = c;
*s = '\0'; *s = '\0';
#ifdef MB #ifdef MULTIBYTE
p = pg_client_to_server(ps, len); p = pg_client_to_server(ps, len);
if (ps != p) { /* actual conversion has been done? */ if (ps != p) { /* actual conversion has been done? */
strcpy(ps, p); strcpy(ps, p);
...@@ -341,7 +341,7 @@ pq_getint(int b) ...@@ -341,7 +341,7 @@ pq_getint(int b)
void void
pq_putstr(char *s) pq_putstr(char *s)
{ {
#ifdef MB #ifdef MULTIBYTE
unsigned char *p; unsigned char *p;
p = pg_server_to_client(s, strlen(s)); p = pg_server_to_client(s, strlen(s));
...@@ -740,7 +740,7 @@ StreamOpen(char *hostName, short portName, Port *port) ...@@ -740,7 +740,7 @@ StreamOpen(char *hostName, short portName, Port *port)
return (STATUS_OK); return (STATUS_OK);
} }
#ifdef MB #ifdef MULTIBYTE
void void
pq_putncharlen(char *s, int n) pq_putncharlen(char *s, int n)
{ {
......
...@@ -117,14 +117,14 @@ extern "C" ...@@ -117,14 +117,14 @@ extern "C"
#define EOW (BOL+5) #define EOW (BOL+5)
#define CODEMAX (BOL+5) /* highest code used */ #define CODEMAX (BOL+5) /* highest code used */
#ifdef MB #ifdef MULTIBYTE
# if MB == MULE_INTERNAL # if MULTIBYTE == MULE_INTERNAL
# define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */ # define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */
# define NNONCHAR (CODEMAX-16777216) # 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 NONCHAR(c) ((c) > USHRT_MAX)
# define NNONCHAR (CODEMAX-USHRT_MAX) # define NNONCHAR (CODEMAX-USHRT_MAX)
# elif MB == UNICODE # elif MULTIBYTE == UNICODE
# define NONCHAR(c) ((c) > USHRT_MAX) # define NONCHAR(c) ((c) > USHRT_MAX)
# define NNONCHAR (CODEMAX-USHRT_MAX) # define NNONCHAR (CODEMAX-USHRT_MAX)
# else /* assume 1 byte code such as ISO8859-1 */ # else /* assume 1 byte code such as ISO8859-1 */
...@@ -200,7 +200,7 @@ int eflags; ...@@ -200,7 +200,7 @@ int eflags;
else else
{ {
start = string; start = string;
#ifdef MB #ifdef MULTIBYTE
stop = start + pg_wchar_strlen(start); stop = start + pg_wchar_strlen(start);
#else #else
stop = start + strlen(start); stop = start + strlen(start);
...@@ -214,7 +214,7 @@ int eflags; ...@@ -214,7 +214,7 @@ int eflags;
{ {
for (dp = start; dp < stop; dp++) for (dp = start; dp < stop; dp++)
if (*dp == g->must[0] && stop - dp >= g->mlen && 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) memcmp(dp, g->must, (size_t) (g->mlen * sizeof(pg_wchar))) == 0)
#else #else
memcmp(dp, g->must, (size_t) g->mlen) == 0) memcmp(dp, g->must, (size_t) g->mlen) == 0)
...@@ -1165,7 +1165,7 @@ sopno stopst; ...@@ -1165,7 +1165,7 @@ sopno stopst;
static int pg_isprint(int c) static int pg_isprint(int c)
{ {
#ifdef MB #ifdef MULTIBYTE
return(c >= 0 && c <= UCHAR_MAX && isprint(c)); return(c >= 0 && c <= UCHAR_MAX && isprint(c));
#else #else
return(isprint(c)); return(isprint(c));
......
...@@ -194,7 +194,7 @@ int cflags; ...@@ -194,7 +194,7 @@ int cflags;
struct parse *p = &pa; struct parse *p = &pa;
int i; int i;
size_t len; size_t len;
#ifdef MB #ifdef MULTIBYTE
pg_wchar *wcp; pg_wchar *wcp;
#endif #endif
...@@ -210,7 +210,7 @@ int cflags; ...@@ -210,7 +210,7 @@ int cflags;
if (cflags & REG_PEND) if (cflags & REG_PEND)
{ {
#ifdef MB #ifdef MULTIBYTE
wcp = preg->patsave; wcp = preg->patsave;
if (preg->re_endp < wcp) if (preg->re_endp < wcp)
return (REG_INVARG); return (REG_INVARG);
...@@ -222,7 +222,7 @@ int cflags; ...@@ -222,7 +222,7 @@ int cflags;
#endif #endif
} }
else { else {
#ifdef MB #ifdef MULTIBYTE
wcp = (pg_wchar *)malloc((strlen(pattern)+1) * sizeof(pg_wchar)); wcp = (pg_wchar *)malloc((strlen(pattern)+1) * sizeof(pg_wchar));
if (wcp == NULL) { if (wcp == NULL) {
return (REG_ESPACE); return (REG_ESPACE);
...@@ -253,7 +253,7 @@ int cflags; ...@@ -253,7 +253,7 @@ int cflags;
/* set things up */ /* set things up */
p->g = g; p->g = g;
#ifdef MB #ifdef MULTIBYTE
p->next = wcp; p->next = wcp;
#else #else
p->next = (pg_wchar *)pattern; /* convenience; we do not modify it */ p->next = (pg_wchar *)pattern; /* convenience; we do not modify it */
...@@ -607,7 +607,7 @@ int starordinary; /* is a leading * an ordinary character? */ ...@@ -607,7 +607,7 @@ int starordinary; /* is a leading * an ordinary character? */
if (c == '\\') if (c == '\\')
{ {
REQUIRE(MORE(), REG_EESCAPE); REQUIRE(MORE(), REG_EESCAPE);
#ifdef MB #ifdef MULTIBYTE
c = BACKSL | (pg_wchar) GETNEXT(); c = BACKSL | (pg_wchar) GETNEXT();
#else #else
c = BACKSL | (unsigned char) GETNEXT(); c = BACKSL | (unsigned char) GETNEXT();
...@@ -755,13 +755,13 @@ struct parse *p; ...@@ -755,13 +755,13 @@ struct parse *p;
{ {
cset *cs = allocset(p); cset *cs = allocset(p);
int invert = 0; int invert = 0;
#ifdef MB #ifdef MULTIBYTE
pg_wchar sp1[] = {'[', ':', '<', ':', ']', ']'}; pg_wchar sp1[] = {'[', ':', '<', ':', ']', ']'};
pg_wchar sp2[] = {'[', ':', '>', ':', ']', ']'}; pg_wchar sp2[] = {'[', ':', '>', ':', ']', ']'};
#endif #endif
/* Dept of Truly Sickening Special-Case Kludges */ /* 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) if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp1, 6) == 0)
#else #else
if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0)
...@@ -771,7 +771,7 @@ struct parse *p; ...@@ -771,7 +771,7 @@ struct parse *p;
NEXTn(6); NEXTn(6);
return; return;
} }
#ifdef MB #ifdef MULTIBYTE
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp2, 6) == 0) if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp2, 6) == 0)
#else #else
if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0)
...@@ -903,7 +903,7 @@ cset *cs; ...@@ -903,7 +903,7 @@ cset *cs;
finish = start; finish = start;
/* xxx what about signed chars here... */ /* xxx what about signed chars here... */
REQUIRE(start <= finish, REG_ERANGE); REQUIRE(start <= finish, REG_ERANGE);
#ifdef MB #ifdef MULTIBYTE
if (CHlc(start) != CHlc(finish)) { if (CHlc(start) != CHlc(finish)) {
SETERROR(REG_ERANGE); SETERROR(REG_ERANGE);
} }
...@@ -933,7 +933,7 @@ cset *cs; ...@@ -933,7 +933,7 @@ cset *cs;
NEXT(); NEXT();
len = p->next - sp; len = p->next - sp;
for (cp = cclasses; cp->name != NULL; cp++) 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') if (pg_char_and_wchar_strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
#else #else
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
...@@ -1012,7 +1012,7 @@ int endc; /* name ended by endc,']' */ ...@@ -1012,7 +1012,7 @@ int endc; /* name ended by endc,']' */
} }
len = p->next - sp; len = p->next - sp;
for (cp = cnames; cp->name != NULL; cp++) 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') if (pg_char_and_wchar_strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
#else #else
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
...@@ -1084,7 +1084,7 @@ int ch; ...@@ -1084,7 +1084,7 @@ int ch;
bothcases(p, ch); bothcases(p, ch);
else else
{ {
#ifdef MB #ifdef MULTIBYTE
EMIT(OCHAR, (pg_wchar) ch); EMIT(OCHAR, (pg_wchar) ch);
#else #else
EMIT(OCHAR, (unsigned char) ch); EMIT(OCHAR, (unsigned char) ch);
...@@ -1788,7 +1788,7 @@ struct re_guts *g; ...@@ -1788,7 +1788,7 @@ struct re_guts *g;
return; return;
/* turn it into a character string */ /* turn it into a character string */
#ifdef MB #ifdef MULTIBYTE
g->must = (pg_wchar *)malloc((size_t) (g->mlen + 1)*sizeof(pg_wchar)); g->must = (pg_wchar *)malloc((size_t) (g->mlen + 1)*sizeof(pg_wchar));
#else #else
g->must = malloc((size_t) g->mlen + 1); g->must = malloc((size_t) g->mlen + 1);
...@@ -1854,7 +1854,7 @@ struct re_guts *g; ...@@ -1854,7 +1854,7 @@ struct re_guts *g;
*/ */
static int pg_isdigit(int c) static int pg_isdigit(int c)
{ {
#ifdef MB #ifdef MULTIBYTE
return(c >= 0 && c <= UCHAR_MAX && isdigit(c)); return(c >= 0 && c <= UCHAR_MAX && isdigit(c));
#else #else
return(isdigit(c)); return(isdigit(c));
...@@ -1863,7 +1863,7 @@ static int pg_isdigit(int c) ...@@ -1863,7 +1863,7 @@ static int pg_isdigit(int c)
static int pg_isalpha(int c) static int pg_isalpha(int c)
{ {
#ifdef MB #ifdef MULTIBYTE
return(c >= 0 && c <= UCHAR_MAX && isalpha(c)); return(c >= 0 && c <= UCHAR_MAX && isalpha(c));
#else #else
return(isalpha(c)); return(isalpha(c));
...@@ -1872,7 +1872,7 @@ static int pg_isalpha(int c) ...@@ -1872,7 +1872,7 @@ static int pg_isalpha(int c)
static int pg_isupper(int c) static int pg_isupper(int c)
{ {
#ifdef MB #ifdef MULTIBYTE
return(c >= 0 && c <= UCHAR_MAX && isupper(c)); return(c >= 0 && c <= UCHAR_MAX && isupper(c));
#else #else
return(isupper(c)); return(isupper(c));
...@@ -1881,7 +1881,7 @@ static int pg_isupper(int c) ...@@ -1881,7 +1881,7 @@ static int pg_isupper(int c)
static int pg_islower(int c) static int pg_islower(int c)
{ {
#ifdef MB #ifdef MULTIBYTE
return(c >= 0 && c <= UCHAR_MAX && islower(c)); return(c >= 0 && c <= UCHAR_MAX && islower(c));
#else #else
return(islower(c)); return(islower(c));
......
...@@ -215,7 +215,7 @@ char *localbuf; ...@@ -215,7 +215,7 @@ char *localbuf;
struct rerr *r; struct rerr *r;
for (r = rerrs; r->code != 0; r++) for (r = rerrs; r->code != 0; r++)
#ifdef MB #ifdef MULTIBYTE
if (pg_char_and_wchar_strcmp(r->name, preg->re_endp) == 0) if (pg_char_and_wchar_strcmp(r->name, preg->re_endp) == 0)
#else #else
if (strcmp(r->name, preg->re_endp) == 0) if (strcmp(r->name, preg->re_endp) == 0)
......
...@@ -164,7 +164,7 @@ int eflags; ...@@ -164,7 +164,7 @@ int eflags;
{ {
struct re_guts *g = preg->re_g; struct re_guts *g = preg->re_g;
#ifdef MB #ifdef MULTIBYTE
pg_wchar *str; pg_wchar *str;
int sts; int sts;
#endif #endif
...@@ -182,7 +182,7 @@ int eflags; ...@@ -182,7 +182,7 @@ int eflags;
return (REG_BADPAT); return (REG_BADPAT);
eflags = GOODFLAGS(eflags); eflags = GOODFLAGS(eflags);
#ifdef MB #ifdef MULTIBYTE
str = (pg_wchar *)malloc((strlen(string)+1) * sizeof(pg_wchar)); str = (pg_wchar *)malloc((strlen(string)+1) * sizeof(pg_wchar));
if (!str) { if (!str) {
return(REG_ESPACE); return(REG_ESPACE);
......
...@@ -68,7 +68,7 @@ regex_t *preg; ...@@ -68,7 +68,7 @@ regex_t *preg;
return; return;
preg->re_magic = 0; /* mark it invalid */ preg->re_magic = 0; /* mark it invalid */
g->magic = 0; /* mark it invalid */ g->magic = 0; /* mark it invalid */
#ifdef MB #ifdef MULTIBYTE
if (preg->patsave != NULL) { if (preg->patsave != NULL) {
free((char *)preg->patsave); free((char *)preg->patsave);
} }
......
/* /*
* misc conversion functions between pg_wchar and other encodings. * misc conversion functions between pg_wchar and other encodings.
* Tatsuo Ishii * 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> #include <regex/pg_wchar.h>
...@@ -350,19 +350,19 @@ static pg_wchar_tbl pg_wchar_table[] = { ...@@ -350,19 +350,19 @@ static pg_wchar_tbl pg_wchar_table[] = {
/* convert a multi-byte string to a wchar */ /* convert a multi-byte string to a wchar */
void pg_mb2wchar(const unsigned char *from, pg_wchar *to) 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 */ /* 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) 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 */ /* returns the byte length of a multi-byte word */
int pg_mblen(const unsigned char *mbstr) 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 */ /* returns the byte length of a multi-byte word for an encoding */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.79 1998/07/09 03:28:48 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.80 1998/07/18 18:34:09 momjian Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
#include "nodes/memnodes.h" #include "nodes/memnodes.h"
#endif #endif
#ifdef MB #ifdef MULTIBYTE
#include "commands/variable.h" #include "commands/variable.h"
#endif #endif
...@@ -1270,7 +1270,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1270,7 +1270,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
InitPostgres(DBName); InitPostgres(DBName);
#ifdef MB #ifdef MULTIBYTE
/* set default client encoding */ /* set default client encoding */
if (!Quiet) if (!Quiet)
{ {
...@@ -1339,7 +1339,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1339,7 +1339,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface"); puts("\nPOSTGRES backend interactive interface");
puts("$Revision: 1.79 $ $Date: 1998/07/09 03:28:48 $"); puts("$Revision: 1.80 $ $Date: 1998/07/18 18:34:09 $");
} }
/* ---------------- /* ----------------
......
...@@ -49,7 +49,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen) ...@@ -49,7 +49,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen)
return FALSE; return FALSE;
/* be sure sterm is null-terminated */ /* be sure sterm is null-terminated */
#ifdef MB #ifdef MULTIBYTE
sterm = (pg_wchar *) palloc((charlen + 1)*sizeof(pg_wchar)); sterm = (pg_wchar *) palloc((charlen + 1)*sizeof(pg_wchar));
(void)pg_mb2wchar_with_len((unsigned char *)s,sterm,charlen); (void)pg_mb2wchar_with_len((unsigned char *)s,sterm,charlen);
#else #else
...@@ -64,7 +64,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen) ...@@ -64,7 +64,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen)
/* palloc the length of the text + the null character */ /* palloc the length of the text + the null character */
len = VARSIZE(p) - VARHDRSZ; len = VARSIZE(p) - VARHDRSZ;
#ifdef MB #ifdef MULTIBYTE
pterm = (pg_wchar *) palloc((len + 1)*sizeof(pg_wchar)); pterm = (pg_wchar *) palloc((len + 1)*sizeof(pg_wchar));
(void)pg_mb2wchar_with_len((unsigned char *)VARDATA(p),pterm,len); (void)pg_mb2wchar_with_len((unsigned char *)VARDATA(p),pterm,len);
#else #else
...@@ -111,7 +111,7 @@ textnlike(struct varlena * s, struct varlena * p) ...@@ -111,7 +111,7 @@ textnlike(struct varlena * s, struct varlena * p)
} }
/* $Revision: 1.16 $ /* $Revision: 1.17 $
** "like.c" A first attempt at a LIKE operator for Postgres95. ** "like.c" A first attempt at a LIKE operator for Postgres95.
** **
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986. ** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.35 1998/07/12 21:29:23 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.36 1998/07/18 18:34:12 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -398,13 +398,13 @@ bcTruelen(char *arg) ...@@ -398,13 +398,13 @@ bcTruelen(char *arg)
int32 int32
bpcharlen(char *arg) bpcharlen(char *arg)
{ {
#ifdef MB #ifdef MULTIBYTE
unsigned char *s; unsigned char *s;
int len, l, wl; int len, l, wl;
#endif #endif
if (!PointerIsValid(arg)) if (!PointerIsValid(arg))
elog(ERROR, "Bad (null) char() external representation", NULL); elog(ERROR, "Bad (null) char() external representation", NULL);
#ifdef MB #ifdef MULTIBYTE
l = bcTruelen(arg); l = bcTruelen(arg);
len = 0; len = 0;
s = VARDATA(arg); s = VARDATA(arg);
...@@ -563,14 +563,14 @@ bpcharcmp(char *arg1, char *arg2) ...@@ -563,14 +563,14 @@ bpcharcmp(char *arg1, char *arg2)
int32 int32
varcharlen(char *arg) varcharlen(char *arg)
{ {
#ifdef MB #ifdef MULTIBYTE
unsigned char *s; unsigned char *s;
int len, l, wl; int len, l, wl;
#endif #endif
if (!PointerIsValid(arg)) if (!PointerIsValid(arg))
elog(ERROR, "Bad (null) varchar() external representation", NULL); elog(ERROR, "Bad (null) varchar() external representation", NULL);
#ifdef MB #ifdef MULTIBYTE
len = 0; len = 0;
s = VARDATA(arg); s = VARDATA(arg);
l = VARSIZE(arg) - VARHDRSZ; l = VARSIZE(arg) - VARHDRSZ;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.37 1998/06/16 06:41:51 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.38 1998/07/18 18:34:13 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -206,7 +206,7 @@ textout(text *vlena) ...@@ -206,7 +206,7 @@ textout(text *vlena)
int32 int32
textlen(text *t) textlen(text *t)
{ {
#ifdef MB #ifdef MULTIBYTE
unsigned char *s; unsigned char *s;
int len, l, wl; int len, l, wl;
#endif #endif
...@@ -214,7 +214,7 @@ textlen(text *t) ...@@ -214,7 +214,7 @@ textlen(text *t)
if (!PointerIsValid(t)) if (!PointerIsValid(t))
elog(ERROR, "Null input to textlen"); elog(ERROR, "Null input to textlen");
#ifdef MB #ifdef MULTIBYTE
len = 0; len = 0;
s = VARDATA(t); s = VARDATA(t);
l = VARSIZE(t) - VARHDRSZ; l = VARSIZE(t) - VARHDRSZ;
...@@ -322,7 +322,7 @@ text_substr(text *string, int32 m, int32 n) ...@@ -322,7 +322,7 @@ text_substr(text *string, int32 m, int32 n)
{ {
text *ret; text *ret;
int len; int len;
#ifdef MB #ifdef MULTIBYTE
int i; int i;
char *p; char *p;
#endif #endif
...@@ -331,7 +331,7 @@ text_substr(text *string, int32 m, int32 n) ...@@ -331,7 +331,7 @@ text_substr(text *string, int32 m, int32 n)
return string; return string;
len = VARSIZE(string) - VARHDRSZ; len = VARSIZE(string) - VARHDRSZ;
#ifdef MB #ifdef MULTIBYTE
len = pg_mbstrlen_with_len(VARDATA(string),len); len = pg_mbstrlen_with_len(VARDATA(string),len);
#endif #endif
...@@ -348,7 +348,7 @@ text_substr(text *string, int32 m, int32 n) ...@@ -348,7 +348,7 @@ text_substr(text *string, int32 m, int32 n)
n = (len - m); n = (len - m);
} }
#ifdef MB #ifdef MULTIBYTE
p = VARDATA(string); p = VARDATA(string);
for (i=0;i<m;i++) { for (i=0;i<m;i++) {
p += pg_mblen(p); p += pg_mblen(p);
...@@ -387,7 +387,7 @@ textpos(text *t1, text *t2) ...@@ -387,7 +387,7 @@ textpos(text *t1, text *t2)
len2; len2;
pg_wchar *p1, pg_wchar *p1,
*p2; *p2;
#ifdef MB #ifdef MULTIBYTE
pg_wchar *ps1, *ps2; pg_wchar *ps1, *ps2;
#endif #endif
...@@ -399,7 +399,7 @@ textpos(text *t1, text *t2) ...@@ -399,7 +399,7 @@ textpos(text *t1, text *t2)
len1 = (VARSIZE(t1) - VARHDRSZ); len1 = (VARSIZE(t1) - VARHDRSZ);
len2 = (VARSIZE(t2) - VARHDRSZ); len2 = (VARSIZE(t2) - VARHDRSZ);
#ifdef MB #ifdef MULTIBYTE
ps1 = p1 = (pg_wchar *) palloc((len1 + 1)*sizeof(pg_wchar)); ps1 = p1 = (pg_wchar *) palloc((len1 + 1)*sizeof(pg_wchar));
(void)pg_mb2wchar_with_len((unsigned char *)VARDATA(t1),p1,len1); (void)pg_mb2wchar_with_len((unsigned char *)VARDATA(t1),p1,len1);
len1 = pg_wchar_strlen(p1); len1 = pg_wchar_strlen(p1);
...@@ -414,7 +414,7 @@ textpos(text *t1, text *t2) ...@@ -414,7 +414,7 @@ textpos(text *t1, text *t2)
px = (len1 - len2); px = (len1 - len2);
for (p = 0; p <= px; p++) for (p = 0; p <= px; p++)
{ {
#ifdef MB #ifdef MULTIBYTE
if ((*p2 == *p1) && (pg_wchar_strncmp(p1, p2, len2) == 0)) if ((*p2 == *p1) && (pg_wchar_strncmp(p1, p2, len2) == 0))
#else #else
if ((*p2 == *p1) && (strncmp(p1, p2, len2) == 0)) if ((*p2 == *p1) && (strncmp(p1, p2, len2) == 0))
...@@ -425,7 +425,7 @@ textpos(text *t1, text *t2) ...@@ -425,7 +425,7 @@ textpos(text *t1, text *t2)
}; };
p1++; p1++;
}; };
#ifdef MB #ifdef MULTIBYTE
pfree(ps1); pfree(ps1);
pfree(ps2); pfree(ps2);
#endif #endif
......
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: psqlHelp.h,v 1.45 1998/07/12 04:49:47 momjian Exp $ * $Id: psqlHelp.h,v 1.46 1998/07/18 18:34:16 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -263,7 +263,7 @@ static struct _helpStruct QL_HELP[] = { ...@@ -263,7 +263,7 @@ static struct _helpStruct QL_HELP[] = {
"notify <class_name>"}, "notify <class_name>"},
{"reset", {"reset",
"set run-time environment back to default", "set run-time environment back to default",
#ifdef MB #ifdef MULTIBYTE
"reset {DateStyle | GEQO | R_PLANS | CLIENT_ENCODING}"}, "reset {DateStyle | GEQO | R_PLANS | CLIENT_ENCODING}"},
#else #else
"reset {DateStyle | GEQO | R_PLANS}"}, "reset {DateStyle | GEQO | R_PLANS}"},
...@@ -288,7 +288,7 @@ static struct _helpStruct QL_HELP[] = { ...@@ -288,7 +288,7 @@ static struct _helpStruct QL_HELP[] = {
\t[union [all] select ...];"}, \t[union [all] select ...];"},
{"set", {"set",
"set run-time environment", "set run-time environment",
#ifdef MB #ifdef MULTIBYTE
"set DateStyle to {'ISO' | 'SQL' | 'Postgres' | 'European' | 'US' | 'NonEuropean'}\n\ "set DateStyle to {'ISO' | 'SQL' | 'Postgres' | 'European' | 'US' | 'NonEuropean'}\n\
set GEQO to {'ON[=#]' | 'OFF'}\n\ set GEQO to {'ON[=#]' | 'OFF'}\n\
set R_PLANS to {'ON' | 'OFF'}\n\ set R_PLANS to {'ON' | 'OFF'}\n\
...@@ -300,7 +300,7 @@ set R_PLANS to {'ON' | 'OFF'}"}, ...@@ -300,7 +300,7 @@ set R_PLANS to {'ON' | 'OFF'}"},
#endif #endif
{"show", {"show",
"show current run-time environment", "show current run-time environment",
#ifdef MB #ifdef MULTIBYTE
"show {DateStyle | GEQO | R_PLANS | CLIENT_ENCODING}"}, "show {DateStyle | GEQO | R_PLANS | CLIENT_ENCODING}"},
#else #else
"show {DateStyle | GEQO | R_PLANS}"}, "show {DateStyle | GEQO | R_PLANS}"},
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Headers for handling of 'SET var TO', 'SHOW var' and 'RESET var' * Headers for handling of 'SET var TO', 'SHOW var' and 'RESET var'
* statements * statements
* *
* $Id: variable.h,v 1.3 1998/06/16 07:29:40 momjian Exp $ * $Id: variable.h,v 1.4 1998/07/18 18:34:21 momjian Exp $
* *
*/ */
#ifndef VARIABLE_H #ifndef VARIABLE_H
...@@ -54,7 +54,7 @@ extern bool set_geqo(void); ...@@ -54,7 +54,7 @@ extern bool set_geqo(void);
extern bool show_geqo(void); extern bool show_geqo(void);
extern bool reset_geqo(void); extern bool reset_geqo(void);
extern bool parse_geqo(const char *); extern bool parse_geqo(const char *);
#ifdef MB #ifdef MULTIBYTE
extern bool show_client_encoding(void); extern bool show_client_encoding(void);
extern bool reset_client_encoding(void); extern bool reset_client_encoding(void);
extern bool parse_client_encoding(const char *); extern bool parse_client_encoding(const char *);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: libpq.h,v 1.18 1998/07/13 16:34:53 momjian Exp $ * $Id: libpq.h,v 1.19 1998/07/18 18:34:23 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -270,7 +270,7 @@ extern void pq_putint(int i, int b); ...@@ -270,7 +270,7 @@ extern void pq_putint(int i, int b);
extern int pq_getinaddr(struct sockaddr_in * sin, char *host, int port); extern int pq_getinaddr(struct sockaddr_in * sin, char *host, int port);
extern int pq_getinserv(struct sockaddr_in * sin, char *host, char *serv); extern int pq_getinserv(struct sockaddr_in * sin, char *host, char *serv);
#ifdef MB #ifdef MULTIBYTE
extern void pq_putncharlen(char *s, int n); extern void pq_putncharlen(char *s, int n);
#endif #endif
......
/* $Id: pg_wchar.h,v 1.3 1998/06/16 07:29:43 momjian Exp $ */ /* $Id: pg_wchar.h,v 1.4 1998/07/18 18:34:24 momjian Exp $ */
#ifndef PG_WCHAR_H #ifndef PG_WCHAR_H
#define PG_WCHAR_H #define PG_WCHAR_H
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
/* followings are for client encoding only */ /* followings are for client encoding only */
#define SJIS 16 /* Shift JIS */ #define SJIS 16 /* Shift JIS */
#ifdef MB #ifdef MULTIBYTE
# if LATIN1 <= MB && MB <= LATIN5 # if LATIN1 <= MULTIBYTE && MULTIBYTE <= LATIN5
typedef unsigned char pg_wchar; typedef unsigned char pg_wchar;
# else # else
typedef unsigned int pg_wchar; typedef unsigned int pg_wchar;
...@@ -65,7 +65,7 @@ typedef unsigned int pg_wchar; ...@@ -65,7 +65,7 @@ typedef unsigned int pg_wchar;
#define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */ #define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */
#define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */ #define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */
#ifdef MB #ifdef MULTIBYTE
extern void pg_mb2wchar(const unsigned char *, pg_wchar *); extern void pg_mb2wchar(const unsigned char *, pg_wchar *);
extern void pg_mb2wchar_with_len(const unsigned char *, pg_wchar *, int); extern void pg_mb2wchar_with_len(const unsigned char *, pg_wchar *, int);
extern int pg_char_and_wchar_strcmp(const char *, const pg_wchar *); extern int pg_char_and_wchar_strcmp(const char *, const pg_wchar *);
......
...@@ -52,7 +52,7 @@ typedef struct ...@@ -52,7 +52,7 @@ typedef struct
size_t re_nsub; /* number of parenthesized subexpressions */ size_t re_nsub; /* number of parenthesized subexpressions */
const pg_wchar *re_endp; /* end pointer for REG_PEND */ const pg_wchar *re_endp; /* end pointer for REG_PEND */
struct re_guts *re_g; /* none of your business :-) */ struct re_guts *re_g; /* none of your business :-) */
#ifdef MB #ifdef MULTIBYTE
pg_wchar *patsave; /* mee too :-) */ pg_wchar *patsave; /* mee too :-) */
#endif #endif
......
...@@ -127,7 +127,7 @@ typedef struct ...@@ -127,7 +127,7 @@ typedef struct
{ {
uch *ptr; /* -> uch [csetsize] */ uch *ptr; /* -> uch [csetsize] */
uch mask; /* bit within array */ uch mask; /* bit within array */
#ifdef MB #ifdef MULTIBYTE
pg_wchar hash; /* hash code */ pg_wchar hash; /* hash code */
unsigned int lc; /* leading character (character-set) */ unsigned int lc; /* leading character (character-set) */
#else #else
...@@ -138,7 +138,7 @@ typedef struct ...@@ -138,7 +138,7 @@ typedef struct
} cset; } cset;
/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */ /* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
#ifdef MB #ifdef MULTIBYTE
#define CHlc(c) (((unsigned)(c)&0xff0000)>>16) #define CHlc(c) (((unsigned)(c)&0xff0000)>>16)
#define CHadd(cs, c) ((cs)->ptr[(unsigned)(c)&0xffff] |= (cs)->mask, (cs)->hash += (unsigned)(c)&0xffff,\ #define CHadd(cs, c) ((cs)->ptr[(unsigned)(c)&0xffff] |= (cs)->mask, (cs)->hash += (unsigned)(c)&0xffff,\
(cs)->lc = CHlc(c)) (cs)->lc = CHlc(c))
...@@ -196,12 +196,12 @@ struct re_guts ...@@ -196,12 +196,12 @@ struct re_guts
}; };
/* misc utilities */ /* misc utilities */
#ifdef MB #ifdef MULTIBYTE
# if MB == MULE_INTERNAL # if MULTIBYTE == MULE_INTERNAL
# define OUT (16777216+1) /* 16777216 == 2^24 == 3 bytes */ # define OUT (16777216+1) /* 16777216 == 2^24 == 3 bytes */
# 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 OUT (USHRT_MAX+1) /* 2 bytes */ # define OUT (USHRT_MAX+1) /* 2 bytes */
# elif MB == UNICODE # elif MULTIBYTE == UNICODE
# define OUT (USHRT_MAX+1) /* 2 bytes. assuming UCS-2 */ # define OUT (USHRT_MAX+1) /* 2 bytes. assuming UCS-2 */
# else # else
# define OUT (UCHAR_MAX+1) /* other codes. assuming 1 byte */ # define OUT (UCHAR_MAX+1) /* other codes. assuming 1 byte */
...@@ -210,7 +210,7 @@ struct re_guts ...@@ -210,7 +210,7 @@ struct re_guts
# define OUT (CHAR_MAX+1) /* a non-character value */ # define OUT (CHAR_MAX+1) /* a non-character value */
#endif #endif
#ifdef MB #ifdef MULTIBYTE
#define ISWORD(c) ((c >= 0 && c <= UCHAR_MAX) && \ #define ISWORD(c) ((c >= 0 && c <= UCHAR_MAX) && \
(isalnum(c) || (c) == '_')) (isalnum(c) || (c) == '_'))
#else #else
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#define DUPMAX 100000000 /* xxx is this right? */ #define DUPMAX 100000000 /* xxx is this right? */
#define INFINITY (DUPMAX + 1) #define INFINITY (DUPMAX + 1)
#ifdef MB #ifdef MULTIBYTE
#define NC (SHRT_MAX - SHRT_MIN + 1) #define NC (SHRT_MAX - SHRT_MIN + 1)
#else #else
#define NC (CHAR_MAX - CHAR_MIN + 1) #define NC (CHAR_MAX - CHAR_MIN + 1)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.74 1998/07/09 03:32:10 scrappy Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.75 1998/07/18 18:34:30 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -124,7 +124,7 @@ struct EnvironmentOptions ...@@ -124,7 +124,7 @@ struct EnvironmentOptions
{ {
"PGTZ", "timezone" "PGTZ", "timezone"
}, },
#ifdef MB #ifdef MULTIBYTE
{ {
"PGCLIENTENCODING", "client_encoding" "PGCLIENTENCODING", "client_encoding"
}, },
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* didn't really belong there. * didn't really belong there.
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.6 1998/07/03 04:24:15 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.7 1998/07/18 18:34:33 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#endif #endif
#endif /* WIN32 */ #endif /* WIN32 */
#ifdef MB #ifdef MULTIBYTE
#include "regex/pg_wchar.h" #include "regex/pg_wchar.h"
#include "commands/variable.h" #include "commands/variable.h"
#endif #endif
...@@ -494,7 +494,7 @@ PQprintTuples(PGresult *res, ...@@ -494,7 +494,7 @@ PQprintTuples(PGresult *res,
} }
} }
#ifdef MB #ifdef MULTIBYTE
/* /*
* returns the byte length of the word beginning s. * returns the byte length of the word beginning s.
* Client side encoding is determined by the environment variable * Client side encoding is determined by the environment variable
...@@ -512,7 +512,7 @@ int PQmblen(unsigned char *s) ...@@ -512,7 +512,7 @@ int PQmblen(unsigned char *s)
encoding = pg_char_to_encoding(str); encoding = pg_char_to_encoding(str);
} }
if (encoding < 0) { if (encoding < 0) {
encoding = MB; encoding = MULTIBYTE;
} }
return(pg_encoding_mblen(encoding, s)); return(pg_encoding_mblen(encoding, s));
} }
...@@ -551,7 +551,7 @@ do_field(PQprintOpt *po, PGresult *res, ...@@ -551,7 +551,7 @@ do_field(PQprintOpt *po, PGresult *res,
if (!skipit) if (!skipit)
{ {
#ifdef MB #ifdef MULTIBYTE
int len; int len;
for (p = pval, o = buf; *p; for (p = pval, o = buf; *p;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: libpq-fe.h,v 1.35 1998/07/14 02:41:25 momjian Exp $ * $Id: libpq-fe.h,v 1.36 1998/07/18 18:34:34 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -368,7 +368,7 @@ extern "C" ...@@ -368,7 +368,7 @@ extern "C"
* 0, use variable width */ * 0, use variable width */
); );
#ifdef MB #ifdef MULTIBYTE
extern int PQmblen(unsigned char *s); extern int PQmblen(unsigned char *s);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment