PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 (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

typedef struct SEG SEG

Function Documentation

void seg_scanner_finish ( void  )

Referenced by seg_in().

void seg_scanner_init ( const char *  str)

Referenced by seg_in().

void seg_yyerror ( SEG result,
const char *  message 
)

Referenced by seg_in().

int seg_yylex ( void  )
int seg_yyparse ( SEG result)

Referenced by seg_in().

int significant_digits ( char *  str)

Definition at line 1010 of file seg.c.

1011 {
1012  char *p = s;
1013  int n,
1014  c,
1015  zeroes;
1016 
1017  zeroes = 1;
1018  /* skip leading zeroes and sign */
1019  for (c = *p; (c == '0' || c == '+' || c == '-') && c != 0; c = *(++p));
1020 
1021  /* skip decimal point and following zeroes */
1022  for (c = *p; (c == '0' || c == '.') && c != 0; c = *(++p))
1023  {
1024  if (c != '.')
1025  zeroes++;
1026  }
1027 
1028  /* count significant digits (n) */
1029  for (c = *p, n = 0; c != 0; c = *(++p))
1030  {
1031  if (!((c >= '0' && c <= '9') || (c == '.')))
1032  break;
1033  if (c != '.')
1034  n++;
1035  }
1036 
1037  if (!n)
1038  return (zeroes);
1039 
1040  return (n);
1041 }
char * c