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 *s)
 
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 *  s)

Definition at line 1060 of file seg.c.

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