diff options
Diffstat (limited to 'src/include/parser')
-rw-r--r-- | src/include/parser/catalog_utils.h | 71 | ||||
-rw-r--r-- | src/include/parser/dbcommands.h | 21 | ||||
-rw-r--r-- | src/include/parser/gramparse.h | 14 | ||||
-rw-r--r-- | src/include/parser/keywords.h | 23 | ||||
-rw-r--r-- | src/include/parser/parse_query.h | 81 | ||||
-rw-r--r-- | src/include/parser/parse_state.h | 31 | ||||
-rw-r--r-- | src/include/parser/parsetree.h | 73 | ||||
-rw-r--r-- | src/include/parser/scansup.h | 9 | ||||
-rw-r--r-- | src/include/parser/sysfunc.h | 9 |
9 files changed, 168 insertions, 164 deletions
diff --git a/src/include/parser/catalog_utils.h b/src/include/parser/catalog_utils.h index dc4a7f90fa5..dd2241e19e0 100644 --- a/src/include/parser/catalog_utils.h +++ b/src/include/parser/catalog_utils.h @@ -1,53 +1,54 @@ /*------------------------------------------------------------------------- * * catalog_utils.h-- - * + * * * * Copyright (c) 1994, Regents of the University of California * - * $Id: catalog_utils.h,v 1.10 1997/08/19 21:39:33 momjian Exp $ + * $Id: catalog_utils.h,v 1.11 1997/09/07 04:59:27 momjian Exp $ * *------------------------------------------------------------------------- */ -#ifndef CATALOG_UTILS_H -#define CATALOG_UTILS_H +#ifndef CATALOG_UTILS_H +#define CATALOG_UTILS_H #include <catalog/pg_type.h> #include <access/htup.h> - -typedef HeapTuple Type; -typedef HeapTuple Operator; -extern Type get_id_type(Oid id); -extern char *get_id_typname(Oid id); -extern Type type(char *); -extern Oid att_typeid(Relation rd, int attid); -extern int att_attnelems(Relation rd, int attid); -extern Oid typeid(Type tp); -extern int16 tlen(Type t); -extern bool tbyval(Type t); -extern char *tname(Type t); -extern int tbyvalue(Type t); -extern Oid oprid(Operator op); +typedef HeapTuple Type; +typedef HeapTuple Operator; + +extern Type get_id_type(Oid id); +extern char *get_id_typname(Oid id); +extern Type type(char *); +extern Oid att_typeid(Relation rd, int attid); +extern int att_attnelems(Relation rd, int attid); +extern Oid typeid(Type tp); +extern int16 tlen(Type t); +extern bool tbyval(Type t); +extern char *tname(Type t); +extern int tbyvalue(Type t); +extern Oid oprid(Operator op); extern Operator oper(char *op, Oid arg1, Oid arg2, bool noWarnings); extern Operator right_oper(char *op, Oid arg); extern Operator left_oper(char *op, Oid arg); -extern int varattno(Relation rd, char *a); -extern bool varisset(Relation rd, char *name); -extern int nf_varattno(Relation rd, char *a); -extern char *getAttrName(Relation rd, int attrno); -extern char *instr2(Type tp, char *string, int typlen); -extern Oid GetArrayElementType(Oid typearray); -extern Oid funcid_get_rettype(Oid funcid); -extern bool func_get_detail(char *funcname, int nargs, Oid *oid_array, - Oid *funcid, Oid *rettype, bool *retset, Oid **true_typeids); -extern Oid typeid_get_retinfunc(Oid type_id); -extern Oid typeid_get_retoutfunc(Oid type_id); -extern Oid typeid_get_relid(Oid type_id); -extern Oid get_typrelid(Type typ); -extern Oid get_typelem(Oid type_id); -extern void func_error(char *caller, char *funcname, int nargs, Oid *argtypes); -extern void agg_error(char *caller, char *aggname, Oid basetypeID); +extern int varattno(Relation rd, char *a); +extern bool varisset(Relation rd, char *name); +extern int nf_varattno(Relation rd, char *a); +extern char *getAttrName(Relation rd, int attrno); +extern char *instr2(Type tp, char *string, int typlen); +extern Oid GetArrayElementType(Oid typearray); +extern Oid funcid_get_rettype(Oid funcid); +extern bool +func_get_detail(char *funcname, int nargs, Oid * oid_array, + Oid * funcid, Oid * rettype, bool * retset, Oid ** true_typeids); +extern Oid typeid_get_retinfunc(Oid type_id); +extern Oid typeid_get_retoutfunc(Oid type_id); +extern Oid typeid_get_relid(Oid type_id); +extern Oid get_typrelid(Type typ); +extern Oid get_typelem(Oid type_id); +extern void func_error(char *caller, char *funcname, int nargs, Oid * argtypes); +extern void agg_error(char *caller, char *aggname, Oid basetypeID); -#endif /* CATALOG_UTILS_H */ +#endif /* CATALOG_UTILS_H */ diff --git a/src/include/parser/dbcommands.h b/src/include/parser/dbcommands.h index 86a0b47fd6b..4a7f32225ca 100644 --- a/src/include/parser/dbcommands.h +++ b/src/include/parser/dbcommands.h @@ -1,27 +1,26 @@ /*------------------------------------------------------------------------- * * dbcommands.h-- - * + * * * * Copyright (c) 1994, Regents of the University of California * - * $Id: dbcommands.h,v 1.2 1997/08/19 21:39:35 momjian Exp $ + * $Id: dbcommands.h,v 1.3 1997/09/07 04:59:29 momjian Exp $ * *------------------------------------------------------------------------- */ -#ifndef DBCOMMANDS_H -#define DBCOMMANDS_H +#ifndef DBCOMMANDS_H +#define DBCOMMANDS_H /* * Originally from tmp/daemon.h. The functions declared in daemon.h does not - * exist; hence removed. -- AY 7/29/94 + * exist; hence removed. -- AY 7/29/94 */ -#define SIGKILLDAEMON1 SIGINT -#define SIGKILLDAEMON2 SIGTERM - -extern void createdb(char *dbname); -extern void destroydb(char *dbname); +#define SIGKILLDAEMON1 SIGINT +#define SIGKILLDAEMON2 SIGTERM -#endif /* DBCOMMANDS_H */ +extern void createdb(char *dbname); +extern void destroydb(char *dbname); +#endif /* DBCOMMANDS_H */ diff --git a/src/include/parser/gramparse.h b/src/include/parser/gramparse.h index 11cfa97019d..67ed5940f27 100644 --- a/src/include/parser/gramparse.h +++ b/src/include/parser/gramparse.h @@ -1,24 +1,24 @@ /*------------------------------------------------------------------------- * * gramparse.h-- - * scanner support routines. used by both the bootstrap lexer + * scanner support routines. used by both the bootstrap lexer * as well as the normal lexer * * Copyright (c) 1994, Regents of the University of California * - * $Id: gramparse.h,v 1.2 1996/11/10 03:05:41 momjian Exp $ + * $Id: gramparse.h,v 1.3 1997/09/07 04:59:31 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef GRAMPARSE_H -#define GRAMPARSE_H /* include once only */ +#define GRAMPARSE_H /* include once only */ /* from scan.l */ -extern void init_io(void); +extern void init_io(void); /* from gram.y */ -extern void parser_init(Oid *typev, int nargs); -extern int yyparse(void); +extern void parser_init(Oid * typev, int nargs); +extern int yyparse(void); -#endif /* GRAMPARSE_H */ +#endif /* GRAMPARSE_H */ diff --git a/src/include/parser/keywords.h b/src/include/parser/keywords.h index 66e113496a2..1453d60e1a4 100644 --- a/src/include/parser/keywords.h +++ b/src/include/parser/keywords.h @@ -1,25 +1,26 @@ /*------------------------------------------------------------------------- * * keywords.h-- - * string,atom lookup thingy, reduces strcmp traffic greatly - * in the bowels of the system. Look for actual defs in lib/C/atoms.c + * string,atom lookup thingy, reduces strcmp traffic greatly + * in the bowels of the system. Look for actual defs in lib/C/atoms.c * * * Copyright (c) 1994, Regents of the University of California * - * $Id: keywords.h,v 1.1 1996/08/28 07:23:55 scrappy Exp $ + * $Id: keywords.h,v 1.2 1997/09/07 04:59:34 momjian Exp $ * *------------------------------------------------------------------------- */ -#ifndef KEYWORDS_H -#define KEYWORDS_H +#ifndef KEYWORDS_H +#define KEYWORDS_H -typedef struct ScanKeyword { - char *name; - int value; -} ScanKeyword; +typedef struct ScanKeyword +{ + char *name; + int value; +} ScanKeyword; extern ScanKeyword *ScanKeywordLookup(char *text); -extern char* AtomValueGetString(int atomval); +extern char *AtomValueGetString(int atomval); -#endif /* KEYWORDS_H */ +#endif /* KEYWORDS_H */ diff --git a/src/include/parser/parse_query.h b/src/include/parser/parse_query.h index dc6f16dbc47..decf425ca92 100644 --- a/src/include/parser/parse_query.h +++ b/src/include/parser/parse_query.h @@ -1,12 +1,12 @@ /*------------------------------------------------------------------------- * * parse_query.h-- - * prototypes for parse_query.c. + * prototypes for parse_query.c. * * * Copyright (c) 1994, Regents of the University of California * - * $Id: parse_query.h,v 1.9 1997/08/20 14:54:26 momjian Exp $ + * $Id: parse_query.h,v 1.10 1997/09/07 04:59:36 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,55 +17,62 @@ #include <parser/parse_state.h> #include <nodes/parsenodes.h> -typedef struct QueryTreeList { - int len; /* number of queries */ - Query** qtrees; -} QueryTreeList; +typedef struct QueryTreeList +{ + int len; /* number of queries */ + Query **qtrees; +} QueryTreeList; -extern RangeTblEntry *refnameRangeTableEntry(List *rtable, char *refname); -extern RangeTblEntry *colnameRangeTableEntry(ParseState *pstate, char *colname); -extern int refnameRangeTablePosn(List *rtable, char *refname); -extern RangeTblEntry *addRangeTableEntry(ParseState *pstate, - char *relname, char *refname, - bool inh, bool inFromCl, - TimeRange *timeRange); -extern List *expandAll(ParseState *pstate, char *relname, char *refname, - int *this_resno); -extern TimeQual makeTimeRange(char *datestring1, char *datestring2, - int timecode); -extern Expr *make_op(char *opname, Node *ltree, Node *rtree); +extern RangeTblEntry *refnameRangeTableEntry(List * rtable, char *refname); +extern RangeTblEntry *colnameRangeTableEntry(ParseState * pstate, char *colname); +extern int refnameRangeTablePosn(List * rtable, char *refname); +extern RangeTblEntry * +addRangeTableEntry(ParseState * pstate, + char *relname, char *refname, + bool inh, bool inFromCl, + TimeRange * timeRange); +extern List * +expandAll(ParseState * pstate, char *relname, char *refname, + int *this_resno); +extern TimeQual +makeTimeRange(char *datestring1, char *datestring2, + int timecode); +extern Expr *make_op(char *opname, Node * ltree, Node * rtree); -extern Oid find_atttype(Oid relid, char *attrname); -extern Var *make_var(ParseState *pstate, - char *relname, char *attrname, Oid *type_id); -extern ArrayRef *make_array_ref(Node *array, List *indirection); -extern ArrayRef *make_array_set(Expr *target_expr, List *upperIndexpr, - List *lowerIndexpr, Expr *expr); -extern Const *make_const(Value *value); +extern Oid find_atttype(Oid relid, char *attrname); +extern Var * +make_var(ParseState * pstate, + char *relname, char *attrname, Oid * type_id); +extern ArrayRef *make_array_ref(Node * array, List * indirection); +extern ArrayRef * +make_array_set(Expr * target_expr, List * upperIndexpr, + List * lowerIndexpr, Expr * expr); +extern Const *make_const(Value * value); -extern void param_type_init(Oid* typev, int nargs); -extern Oid param_type(int t); +extern void param_type_init(Oid * typev, int nargs); +extern Oid param_type(int t); /* parser.c (was ylib.c) */ -extern QueryTreeList *parser(char *str, Oid *typev, int nargs); -extern Node *parser_typecast(Value *expr, TypeName *typename, int typlen); -extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen); -extern Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target); -extern void handleTargetColname(ParseState *pstate, char **resname, +extern QueryTreeList *parser(char *str, Oid * typev, int nargs); +extern Node *parser_typecast(Value * expr, TypeName * typename, int typlen); +extern Node *parser_typecast2(Node * expr, Oid exprType, Type tp, int typlen); +extern Aggreg *ParseAgg(char *aggname, Oid basetype, Node * target); +extern void +handleTargetColname(ParseState * pstate, char **resname, char *refname, char *colname); /* * analyze.c */ -Oid exprType(Node *expr); -QueryTreeList *parse_analyze(List *querytree_list); +Oid exprType(Node * expr); +QueryTreeList *parse_analyze(List * querytree_list); /* define in parse_query.c, used in gram.y */ -extern Oid *param_type_info; -extern int pfunc_num_args; +extern Oid *param_type_info; +extern int pfunc_num_args; /* useful macros */ #define ISCOMPLEX(type) (typeid_get_relid(type) ? true : false) -#endif /* PARSE_QUERY_H */ +#endif /* PARSE_QUERY_H */ diff --git a/src/include/parser/parse_state.h b/src/include/parser/parse_state.h index c2f900e81f3..05f860290fb 100644 --- a/src/include/parser/parse_state.h +++ b/src/include/parser/parse_state.h @@ -4,7 +4,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: parse_state.h,v 1.5 1996/11/04 12:12:52 scrappy Exp $ + * $Id: parse_state.h,v 1.6 1997/09/07 04:59:37 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -12,22 +12,23 @@ #ifndef PARSE_STATE_H #define PARSE_STATE_H -#include <nodes/parsenodes.h> +#include <nodes/parsenodes.h> #include <utils/rel.h> /* state information used during parse analysis */ -typedef struct ParseState { - int p_last_resno; - List *p_rtable; - int p_numAgg; - List *p_aggs; - bool p_is_insert; - List *p_insert_columns; - bool p_is_update; - bool p_is_rule; - Relation p_target_relation; - RangeTblEntry *p_target_rangetblentry; -} ParseState; +typedef struct ParseState +{ + int p_last_resno; + List *p_rtable; + int p_numAgg; + List *p_aggs; + bool p_is_insert; + List *p_insert_columns; + bool p_is_update; + bool p_is_rule; + Relation p_target_relation; + RangeTblEntry *p_target_rangetblentry; +} ParseState; -#endif /*PARSE_QUERY_H*/ +#endif /* PARSE_QUERY_H */ diff --git a/src/include/parser/parsetree.h b/src/include/parser/parsetree.h index b51cc0f3057..a5662cd9d79 100644 --- a/src/include/parser/parsetree.h +++ b/src/include/parser/parsetree.h @@ -1,78 +1,77 @@ /*------------------------------------------------------------------------- * * parsetree.h-- - * Routines to access various components and subcomponents of - * parse trees. + * Routines to access various components and subcomponents of + * parse trees. * * * Copyright (c) 1994, Regents of the University of California * - * $Id: parsetree.h,v 1.2 1996/11/06 10:30:39 scrappy Exp $ + * $Id: parsetree.h,v 1.3 1997/09/07 04:59:38 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef PARSETREE_H -#define PARSETREE_H /* include once only */ +#define PARSETREE_H /* include once only */ /* ---------------- - * need pg_list.h for definitions of CAR(), etc. macros + * need pg_list.h for definitions of CAR(), etc. macros * ---------------- */ /* ---------------- - * range table macros + * range table macros * - * parse tree: - * (root targetlist qual) - * ^^^^ - * parse root: - * (numlevels cmdtype resrel rangetable priority ruleinfo nestdotinfo) - * ^^^^^^^^^^ - * range table: - * (rtentry ...) + * parse tree: + * (root targetlist qual) + * ^^^^ + * parse root: + * (numlevels cmdtype resrel rangetable priority ruleinfo nestdotinfo) + * ^^^^^^^^^^ + * range table: + * (rtentry ...) * - * rtentry: - * note: this might be wrong, I don't understand how - * rt_time / rt_archive_time work together. anyways it - * looks something like: + * rtentry: + * note: this might be wrong, I don't understand how + * rt_time / rt_archive_time work together. anyways it + * looks something like: * - * (relname ? relid timestuff flags rulelocks) - * or (new/cur relname relid timestuff flags rulelocks) + * (relname ? relid timestuff flags rulelocks) + * or (new/cur relname relid timestuff flags rulelocks) * - * someone who knows more should correct this -cim 6/9/91 + * someone who knows more should correct this -cim 6/9/91 * ---------------- */ #define rt_relname(rt_entry) \ - ((!strcmp(((rt_entry)->refname),"*CURRENT*") ||\ - !strcmp(((rt_entry)->refname),"*NEW*")) ? ((rt_entry)->refname) : \ - ((char *)(rt_entry)->relname)) + ((!strcmp(((rt_entry)->refname),"*CURRENT*") ||\ + !strcmp(((rt_entry)->refname),"*NEW*")) ? ((rt_entry)->refname) : \ + ((char *)(rt_entry)->relname)) /* - * rt_fetch - * rt_store + * rt_fetch + * rt_store * - * Access and (destructively) replace rangetable entries. + * Access and (destructively) replace rangetable entries. * */ #define rt_fetch(rangetable_index, rangetable) \ - ((RangeTblEntry*)nth((rangetable_index)-1, rangetable)) + ((RangeTblEntry*)nth((rangetable_index)-1, rangetable)) #define rt_store(rangetable_index, rangetable, rt) \ - set_nth(rangetable, (rangetable_index)-1, rt) + set_nth(rangetable, (rangetable_index)-1, rt) /* - * getrelid - * getrelname + * getrelid + * getrelname * - * Given the range index of a relation, return the corresponding - * relation id or relation name. + * Given the range index of a relation, return the corresponding + * relation id or relation name. */ #define getrelid(rangeindex,rangetable) \ - ((RangeTblEntry*)nth((rangeindex)-1, rangetable))->relid + ((RangeTblEntry*)nth((rangeindex)-1, rangetable))->relid #define getrelname(rangeindex, rangetable) \ - rt_relname((RangeTblEntry*)nth((rangeindex)-1, rangetable)) + rt_relname((RangeTblEntry*)nth((rangeindex)-1, rangetable)) -#endif /* PARSETREE_H */ - +#endif /* PARSETREE_H */ diff --git a/src/include/parser/scansup.h b/src/include/parser/scansup.h index 4c955bc43e1..e3dd13a6064 100644 --- a/src/include/parser/scansup.h +++ b/src/include/parser/scansup.h @@ -1,17 +1,14 @@ /*------------------------------------------------------------------------- * * scansup.h-- - * scanner support routines. used by both the bootstrap lexer + * scanner support routines. used by both the bootstrap lexer * as well as the normal lexer * * Copyright (c) 1994, Regents of the University of California * - * $Id: scansup.h,v 1.1 1996/08/28 07:23:58 scrappy Exp $ + * $Id: scansup.h,v 1.2 1997/09/07 04:59:39 momjian Exp $ * *------------------------------------------------------------------------- */ -extern char* scanstr(char *s); - - - +extern char *scanstr(char *s); diff --git a/src/include/parser/sysfunc.h b/src/include/parser/sysfunc.h index b0761d4c351..2a1f87d8590 100644 --- a/src/include/parser/sysfunc.h +++ b/src/include/parser/sysfunc.h @@ -1,10 +1,9 @@ /*------------------------------------------------------------------------- - * + * * sysfunc.h-- - * support for system functions - * + * support for system functions + * * ------------------------------------------------------------------------- */ -extern char *SystemFunctionHandler(char *funct); - +extern char *SystemFunctionHandler(char *funct); |