grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

scan.c File Reference
#include <stdio.h>
#include <string.h>
#include <grass/datetime.h>
Include dependency graph for scan.c:

Go to the source code of this file.

Functions

static int scan_absolute (DateTime *, const char *)
 
static int more (const char **)
 
static int minus_sign (const char **)
 
static int is_bc (const char **)
 
static int is_relative (const char *)
 
static int relative_term (const char **, double *, int *, int *, int *)
 
static int scan_tz (const char *, int *)
 
static int get_word (const char **, char *)
 
static char lowercase (char)
 
static int which_month (const char *, int *)
 
static int scan_relative (DateTime *, const char *)
 
static int is_space (char)
 
static int is_digit (char)
 
static void skip_space (const char **)
 
static int get_int (const char **, int *, int *)
 
static int get_double (const char **, double *, int *, int *)
 
int datetime_scan (DateTime *dt, const char *buf)
 Convert the ascii string into a DateTime. This determines the mode/from/to based on the string, inits 'dt' and then sets values in 'dt' based on the [???] Returns 0 if 'string' is legal, -1 if not. More...
 

Variables

static const char * month_names []
 

Function Documentation

◆ datetime_scan()

int datetime_scan ( DateTime dt,
const char *  buf 
)

Convert the ascii string into a DateTime. This determines the mode/from/to based on the string, inits 'dt' and then sets values in 'dt' based on the [???] Returns 0 if 'string' is legal, -1 if not.

Parameters
dt
buf
Returns
int

Definition at line 43 of file scan.c.

References datetime_error(), is_relative(), scan_absolute(), and scan_relative().

Referenced by G_scan_timestamp().

◆ get_double()

static int get_double ( const char **  s,
double *  x,
int *  ndigits,
int *  ndecimal 
)
static

Definition at line 295 of file scan.c.

References b, is_digit(), s, skip_space(), and x.

Referenced by relative_term(), and scan_absolute().

◆ get_int()

static int get_int ( const char **  s,
int *  n,
int *  ndigits 
)
static

Definition at line 278 of file scan.c.

References is_digit(), s, and skip_space().

Referenced by scan_absolute().

◆ get_word()

static int get_word ( const char **  s,
char *  word 
)
static

Definition at line 347 of file scan.c.

References is_space(), lowercase(), s, and skip_space().

Referenced by is_bc(), relative_term(), and scan_absolute().

◆ is_bc()

static int is_bc ( const char **  s)
static

Definition at line 380 of file scan.c.

References get_word(), and s.

Referenced by scan_absolute().

◆ is_digit()

static int is_digit ( char  c)
static

Definition at line 267 of file scan.c.

References c.

Referenced by get_double(), get_int(), and scan_tz().

◆ is_relative()

static int is_relative ( const char *  buf)
static

Definition at line 466 of file scan.c.

References minus_sign(), relative_term(), and x.

Referenced by datetime_scan().

◆ is_space()

static int is_space ( char  c)
static

Definition at line 262 of file scan.c.

References c.

Referenced by get_word(), and skip_space().

◆ lowercase()

static char lowercase ( char  c)
static

Definition at line 361 of file scan.c.

References c.

Referenced by get_word().

◆ minus_sign()

static int minus_sign ( const char **  s)
static

Definition at line 456 of file scan.c.

References s, and skip_space().

Referenced by is_relative(), and scan_relative().

◆ more()

◆ relative_term()

static int relative_term ( const char **  s,
double *  x,
int *  ndigits,
int *  ndecimal,
int *  pos 
)
static

◆ scan_absolute()

◆ scan_relative()

◆ scan_tz()

static int scan_tz ( const char *  word,
int *  tz 
)
static

Definition at line 394 of file scan.c.

References is_digit().

Referenced by scan_absolute().

◆ skip_space()

static void skip_space ( const char **  s)
static

Definition at line 272 of file scan.c.

References is_space(), and s.

Referenced by get_double(), get_int(), get_word(), minus_sign(), and more().

◆ which_month()

static int which_month ( const char *  name,
int *  n 
)
static

Definition at line 368 of file scan.c.

References month_names, and name.

Referenced by scan_absolute().

Variable Documentation

◆ month_names

const char* month_names[]
static
Initial value:
= {
"jan", "feb", "mar", "apr", "may", "jun",
"jul", "aug", "sep", "oct", "nov", "dec"
}

Definition at line 55 of file scan.c.

Referenced by which_month().