PostgreSQL Source Code git master
Data Structures | Typedefs | Functions
segdata.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct   SEG
 

Typedefs

typedef struct SEG  SEG
 
typedef void *  yyscan_t
 

Functions

int  significant_digits (const char *s)
 
int  seg_yylex (union YYSTYPE *yylval_param, yyscan_t yyscanner)
 
void  seg_yyerror (SEG *result, struct Node *escontext, yyscan_t yyscanner, const char *message)
 
void  seg_scanner_init (const char *str, yyscan_t *yyscannerp)
 
void  seg_scanner_finish (yyscan_t yyscanner)
 
int  seg_yyparse (SEG *result, struct Node *escontext, yyscan_t yyscanner)
 

Typedef Documentation

SEG

typedef struct SEG SEG

yyscan_t

typedef void* yyscan_t

Definition at line 19 of file segdata.h.

Function Documentation

seg_scanner_finish()

void seg_scanner_finish ( yyscan_t  yyscanner )

Definition at line 116 of file segscan.l.

117{
118 yylex_destroy(yyscanner);
119}

Referenced by seg_in().

seg_scanner_init()

void seg_scanner_init ( const char *  str,
yyscan_tyyscannerp 
)

Definition at line 99 of file segscan.l.

100{
101 yyscan_t yyscanner;
102
103 if (yylex_init(yyscannerp) != 0)
104 elog(ERROR, "yylex_init() failed: %m");
105
106 yyscanner = *yyscannerp;
107
108 yy_scan_string(str, yyscanner);
109}
void * yyscan_t
Definition: cubedata.h:65
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:226
const char * str

References elog, ERROR, and str.

Referenced by seg_in().

seg_yyerror()

void seg_yyerror ( SEGresult,
struct Nodeescontext,
yyscan_t  yyscanner,
const char *  message 
)

Definition at line 67 of file segscan.l.

68{
69 struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yytext
70 * macro */
71
72 /* if we already reported an error, don't overwrite it */
73 if (SOFT_ERROR_OCCURRED(escontext))
74 return;
75
76 if (*yytext == YY_END_OF_BUFFER_CHAR)
77 {
78 errsave(escontext,
79 (errcode(ERRCODE_SYNTAX_ERROR),
80 errmsg("bad seg representation"),
81 /* translator: %s is typically "syntax error" */
82 errdetail("%s at end of input", message)));
83 }
84 else
85 {
86 errsave(escontext,
87 (errcode(ERRCODE_SYNTAX_ERROR),
88 errmsg("bad seg representation"),
89 /* translator: first %s is typically "syntax error" */
90 errdetail("%s at or near \"%s\"", message, yytext)));
91 }
92}
int errdetail(const char *fmt,...)
Definition: elog.c:1207
int errcode(int sqlerrcode)
Definition: elog.c:854
int errmsg(const char *fmt,...)
Definition: elog.c:1071
#define errsave(context,...)
Definition: elog.h:262
#define SOFT_ERROR_OCCURRED(escontext)
Definition: miscnodes.h:53

References errcode(), errdetail(), errmsg(), errsave, and SOFT_ERROR_OCCURRED.

Referenced by seg_in().

seg_yylex()

int seg_yylex ( union YYSTYPEyylval_param,
yyscan_t  yyscanner 
)

seg_yyparse()

int seg_yyparse ( SEGresult,
struct Nodeescontext,
yyscan_t  yyscanner 
)

Referenced by seg_in().

significant_digits()

int significant_digits ( const char *  s )

Definition at line 1068 of file seg.c.

1069{
1070 const char *p = s;
1071 int n,
1072 c,
1073 zeroes;
1074
1075 zeroes = 1;
1076 /* skip leading zeroes and sign */
1077 for (c = *p; (c == '0' || c == '+' || c == '-') && c != 0; c = *(++p));
1078
1079 /* skip decimal point and following zeroes */
1080 for (c = *p; (c == '0' || c == '.') && c != 0; c = *(++p))
1081 {
1082 if (c != '.')
1083 zeroes++;
1084 }
1085
1086 /* count significant digits (n) */
1087 for (c = *p, n = 0; c != 0; c = *(++p))
1088 {
1089 if (!((c >= '0' && c <= '9') || (c == '.')))
1090 break;
1091 if (c != '.')
1092 n++;
1093 }
1094
1095 if (!n)
1096 return zeroes;
1097
1098 return n;
1099}
c
char * c
Definition: preproc-cursor.c:31

AltStyle によって変換されたページ (->オリジナル) /