PostgreSQL Source Code  git master
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
 

Functions

int significant_digits (const char *str)
 
int seg_yylex (void)
 
void seg_yyerror (SEG *result, const char *message) pg_attribute_noreturn()
 
void seg_scanner_init (const char *str)
 
void seg_scanner_finish (void)
 
int seg_yyparse (SEG *result)
 

Typedef Documentation

◆ SEG

typedef struct SEG SEG

Function Documentation

◆ seg_scanner_finish()

void seg_scanner_finish ( void  )

Referenced by seg_in().

◆ seg_scanner_init()

void seg_scanner_init ( const char *  str)

Referenced by seg_in().

◆ seg_yyerror()

void seg_yyerror ( SEG result,
const char *  message 
)

Referenced by seg_in().

◆ seg_yylex()

int seg_yylex ( void  )

◆ seg_yyparse()

int seg_yyparse ( SEG result)

Referenced by seg_in().

◆ significant_digits()

int significant_digits ( const char *  str)

Definition at line 1055 of file seg.c.

1056 {
1057  const char *p = s;
1058  int n,
1059  c,
1060  zeroes;
1061 
1062  zeroes = 1;
1063  /* skip leading zeroes and sign */
1064  for (c = *p; (c == '0' || c == '+' || c == '-') && c != 0; c = *(++p));
1065 
1066  /* skip decimal point and following zeroes */
1067  for (c = *p; (c == '0' || c == '.') && c != 0; c = *(++p))
1068  {
1069  if (c != '.')
1070  zeroes++;
1071  }
1072 
1073  /* count significant digits (n) */
1074  for (c = *p, n = 0; c != 0; c = *(++p))
1075  {
1076  if (!((c >= '0' && c <= '9') || (c == '.')))
1077  break;
1078  if (c != '.')
1079  n++;
1080  }
1081 
1082  if (!n)
1083  return zeroes;
1084 
1085  return n;
1086 }
char * c