1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

pgindent run.

This commit is contained in:
Bruce Momjian
2002-09-04 20:31:48 +00:00
parent c91ceec21d
commit e50f52a074
446 changed files with 14942 additions and 13363 deletions

View File

@ -51,12 +51,12 @@
struct cclass
{
char *name;
char *chars;
char *multis;
char *name;
char *chars;
char *multis;
};
static struct cclass* cclasses = NULL;
static struct cclass* cclass_init(void);
static struct cclass *cclasses = NULL;
static struct cclass *cclass_init(void);
/*
* parse structure, passed up and down to avoid global variables and
@ -179,8 +179,8 @@ pg_regcomp(regex_t *preg, const char *pattern, int cflags)
size_t len;
pg_wchar *wcp;
if ( cclasses == NULL )
cclasses = cclass_init();
if (cclasses == NULL)
cclasses = cclass_init();
#ifdef REDEBUG
#define GOODFLAGS(f) (f)
@ -862,7 +862,7 @@ p_b_cclass(struct parse * p, cset *cs)
struct cclass *cp;
size_t len;
char *u;
unsigned char c;
unsigned char c;
while (MORE() && pg_isalpha(PEEK()))
NEXT();
@ -1684,77 +1684,105 @@ pg_ispunct(int c)
static struct cclass *
cclass_init(void)
{
static struct cclass cclasses_C[] = {
{ "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "" },
{ "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "" },
{ "blank", " \t", "" },
{ "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177", "" },
{ "digit", "0123456789", "" },
{ "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" },
{ "lower", "abcdefghijklmnopqrstuvwxyz", "" },
{ "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", "" },
{ "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" },
{ "space", "\t\n\v\f\r ", "" },
{ "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" },
{ "xdigit", "0123456789ABCDEFabcdef", "" },
{ NULL, NULL, "" }
};
struct cclass *cp = NULL;
struct cclass *classes = NULL;
struct cclass_factory
{
char *name;
int (*func)(int);
char *chars;
} cclass_factories [] =
{
{ "alnum", pg_isalnum, NULL },
{ "alpha", pg_isalpha, NULL },
{ "blank", NULL, " \t" },
{ "cntrl", pg_iscntrl, NULL },
{ "digit", NULL, "0123456789" },
{ "graph", pg_isgraph, NULL },
{ "lower", pg_islower, NULL },
{ "print", pg_isprint, NULL },
{ "punct", pg_ispunct, NULL },
{ "space", NULL, "\t\n\v\f\r " },
{ "upper", pg_isupper, NULL },
{ "xdigit", NULL, "0123456789ABCDEFabcdef" },
{ NULL, NULL, NULL }
};
struct cclass_factory *cf = NULL;
static struct cclass cclasses_C[] = {
{"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ""},
{"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", ""},
{"blank", " \t", ""},
{"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177", ""},
{"digit", "0123456789", ""},
{"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", ""},
{"lower", "abcdefghijklmnopqrstuvwxyz", ""},
{"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", ""},
{"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", ""},
{"space", "\t\n\v\f\r ", ""},
{"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ""},
{"xdigit", "0123456789ABCDEFabcdef", ""},
{NULL, NULL, ""}
};
struct cclass *cp = NULL;
struct cclass *classes = NULL;
struct cclass_factory
{
char *name;
int (*func) (int);
char *chars;
} cclass_factories[] =
{
{
"alnum", pg_isalnum, NULL
},
{
"alpha", pg_isalpha, NULL
},
{
"blank", NULL, " \t"
},
{
"cntrl", pg_iscntrl, NULL
},
{
"digit", NULL, "0123456789"
},
{
"graph", pg_isgraph, NULL
},
{
"lower", pg_islower, NULL
},
{
"print", pg_isprint, NULL
},
{
"punct", pg_ispunct, NULL
},
{
"space", NULL, "\t\n\v\f\r "
},
{
"upper", pg_isupper, NULL
},
{
"xdigit", NULL, "0123456789ABCDEFabcdef"
},
{
NULL, NULL, NULL
}
};
struct cclass_factory *cf = NULL;
if ( strcmp( setlocale( LC_CTYPE, NULL ), "C" ) == 0 )
return cclasses_C;
if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
return cclasses_C;
classes = malloc(sizeof(struct cclass) * (sizeof(cclass_factories) / sizeof(struct cclass_factory)));
if (classes == NULL)
elog(ERROR,"cclass_init: out of memory");
cp = classes;
for(cf = cclass_factories; cf->name != NULL; cf++)
{
cp->name = strdup(cf->name);
if ( cf->chars )
cp->chars = strdup(cf->chars);
else
{
int x = 0, y = 0;
cp->chars = malloc(sizeof(char) * 256);
if (cp->chars == NULL)
elog(ERROR,"cclass_init: out of memory");
for (x = 0; x < 256; x++)
{
if((cf->func)(x))
*(cp->chars + y++) = x;
}
*(cp->chars + y) = '\0';
}
cp->multis = "";
cp++;
}
cp->name = cp->chars = NULL;
cp->multis = "";
return classes;
classes = malloc(sizeof(struct cclass) * (sizeof(cclass_factories) / sizeof(struct cclass_factory)));
if (classes == NULL)
elog(ERROR, "cclass_init: out of memory");
cp = classes;
for (cf = cclass_factories; cf->name != NULL; cf++)
{
cp->name = strdup(cf->name);
if (cf->chars)
cp->chars = strdup(cf->chars);
else
{
int x = 0,
y = 0;
cp->chars = malloc(sizeof(char) * 256);
if (cp->chars == NULL)
elog(ERROR, "cclass_init: out of memory");
for (x = 0; x < 256; x++)
{
if ((cf->func) (x))
*(cp->chars + y++) = x;
}
*(cp->chars + y) = '\0';
}
cp->multis = "";
cp++;
}
cp->name = cp->chars = NULL;
cp->multis = "";
return classes;
}