Restructure outfuncs and readfuncs to use macros in the same style as

just done for copyfuncs/equalfuncs.  Read functions in particular get
a lot shorter than before, and it's much easier to compare an out function
with the corresponding read function to make sure they agree.
initdb forced due to small changes in nodestring format (regularizing
a few cases that were formerly idiosyncratic).
This commit is contained in:
Tom Lane 2002-11-25 18:12:12 +00:00
parent 0aa5b6866e
commit dbe100c402
5 changed files with 1223 additions and 2855 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.32 2002/06/20 20:29:29 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.33 2002/11/25 18:12:10 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -183,7 +183,7 @@ debackslash(char *token, int length)
#define RIGHT_PAREN (1000000 + 1)
#define LEFT_PAREN (1000000 + 2)
#define PLAN_SYM (1000000 + 3)
#define NODE_SYM (1000000 + 3)
#define AT_SYMBOL (1000000 + 4)
#define ATOM_TOKEN (1000000 + 5)
@ -193,7 +193,7 @@ debackslash(char *token, int length)
* It returns one of the following valid NodeTags:
* T_Integer, T_Float, T_String, T_BitString
* and some of its own:
* RIGHT_PAREN, LEFT_PAREN, PLAN_SYM, AT_SYMBOL, ATOM_TOKEN
* RIGHT_PAREN, LEFT_PAREN, NODE_SYM, AT_SYMBOL, ATOM_TOKEN
*
* Assumption: the ascii representation is legal
*/
@ -244,7 +244,7 @@ nodeTokenType(char *token, int length)
else if (*token == ')')
retval = RIGHT_PAREN;
else if (*token == '{')
retval = PLAN_SYM;
retval = NODE_SYM;
else if (*token == '@' && length == 1)
retval = AT_SYMBOL;
else if (*token == '\"' && length > 1 && token[length - 1] == '\"')
@ -263,7 +263,7 @@ nodeTokenType(char *token, int length)
* This routine applies some semantic knowledge on top of the purely
* lexical tokenizer pg_strtok(). It can read
* * Value token nodes (integers, floats, or strings);
* * Plan nodes (via parsePlanString() from readfuncs.c);
* * General nodes (via parseNodeString() from readfuncs.c);
* * Lists of the above.
*
* We assume pg_strtok is already initialized with a string to read (hence
@ -289,11 +289,11 @@ nodeRead(bool read_car_only)
switch (type)
{
case PLAN_SYM:
this_value = parsePlanString();
case NODE_SYM:
this_value = parseNodeString();
token = pg_strtok(&tok_len);
if (token == NULL || token[0] != '}')
elog(ERROR, "nodeRead: did not find '}' at end of plan node");
elog(ERROR, "nodeRead: did not find '}' at end of node");
if (!read_car_only)
make_dotted_pair_cell = true;
else

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catversion.h,v 1.165 2002/11/23 18:13:22 momjian Exp $
* $Id: catversion.h,v 1.166 2002/11/25 18:12:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200211231
#define CATALOG_VERSION_NO 200211251
#endif

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: readfuncs.h,v 1.15 2002/06/20 20:29:51 momjian Exp $
* $Id: readfuncs.h,v 1.16 2002/11/25 18:12:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -26,6 +26,6 @@ extern void *nodeRead(bool read_car_only);
/*
* prototypes for functions in readfuncs.c
*/
extern Node *parsePlanString(void);
extern Node *parseNodeString(void);
#endif /* READFUNCS_H */