#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <errno.h>
#include <iostream>
#include <sstream>
#include "debug.h"
#include "parser.h"
#include "dods-limits.h"
#include "util.h"
Include dependency graph for parser-util.cc:
Go to the source code of this file.
Functions | |
int | check_byte (const char *val) |
Is the value a valid byte? | |
int | check_float32 (const char *val) |
Is the value a valid float? | |
int | check_float64 (const char *val) |
int | check_int16 (const char *val) |
Is the value a valid integer? | |
int | check_int32 (const char *val) |
int | check_uint16 (const char *val) |
int | check_uint32 (const char *val) |
int | check_url (const char *) |
Is the value a valid URL? | |
bool | is_keyword (string id, const string &keyword) |
void | parse_error (const string &msg, const int line_num, const char *context) |
void | parse_error (const char *msg, const int line_num, const char *context) |
void | parse_error (parser_arg *arg, const char *msg, const int line_num, const char *context) |
void | save_str (string &dst, const char *src, const int) |
void | save_str (char *dst, const char *src, const int line_num) |
Save a string to a temporary variable during the parse. |
int check_byte | ( | const char * | val | ) |
Check to see if val
is a valid byte value. If not, generate an error message using parser_error()
. There are two versions of check_byte()
, one which calls parser_error()
and prints an error message to stderr an one which calls parser_error()
and generates and Error object.
Definition at line 157 of file parser-util.cc.
References DBG, DODS_SCHAR_MIN, DODS_UCHAR_MAX, FALSE, and TRUE.
int check_float32 | ( | const char * | val | ) |
Like check_byte()
but for 64-bit float values.
Definition at line 247 of file parser-util.cc.
References DBG, DODS_FLT_MAX, DODS_FLT_MIN, FALSE, and TRUE.
int check_float64 | ( | const char * | val | ) |
Definition at line 275 of file parser-util.cc.
References DBG, DODS_DBL_MAX, DODS_DBL_MIN, FALSE, and TRUE.
int check_int16 | ( | const char * | val | ) |
Like check_byte()
but for 32-bit integers (check_uint()
is for unsigned integers).
Definition at line 183 of file parser-util.cc.
References DODS_SHRT_MAX, DODS_SHRT_MIN, FALSE, and TRUE.
int check_int32 | ( | const char * | val | ) |
Definition at line 215 of file parser-util.cc.
References DODS_INT_MAX, DODS_INT_MIN, FALSE, and TRUE.
int check_uint16 | ( | const char * | val | ) |
int check_uint32 | ( | const char * | val | ) |
int check_url | ( | const char * | val | ) |
Currently this function always returns true.
Definition at line 332 of file parser-util.cc.
References TRUE.
bool is_keyword | ( | string | id, | |
const string & | keyword | |||
) |
Definition at line 149 of file parser-util.cc.
References DBG, downcase(), and prune_spaces().
Here is the call graph for this function:
void parse_error | ( | const string & | msg, | |
const int | line_num, | |||
const char * | context | |||
) |
Definition at line 128 of file parser-util.cc.
References parse_error().
Here is the call graph for this function:
void parse_error | ( | const char * | msg, | |
const int | line_num, | |||
const char * | context | |||
) |
Definition at line 99 of file parser-util.cc.
References append_long_to_string().
Here is the call graph for this function:
void parse_error | ( | parser_arg * | arg, | |
const char * | msg, | |||
const int | line_num, | |||
const char * | context | |||
) |
void save_str | ( | string & | dst, | |
const char * | src, | |||
const | int | |||
) |
Definition at line 144 of file parser-util.cc.
void save_str | ( | char * | dst, | |
const char * | src, | |||
const int | line_num | |||
) |
Given a string (const char *src
), save it to the temporary variable pointed to by dst
. If the string is longer than ID_MAX
, generate and error indicating that src
was truncated to ID_MAX
characters during the copy operation. There are two versions of this function; one calls the version of parser_error()
which writes to stderr. The version which accepts the parser_arg *arg
argument calls the version of parser_error()
which generates and Error object.
Definition at line 133 of file parser-util.cc.