// file: param_file_constants.h
//
// this file defines constants for the Param_file class
//

// make sure definitions are only made once
//
#ifndef __ISIP_PARAM_FILE_CONSTANTS
#define __ISIP_PARAM_FILE_CONSTANTS

// isip include files
//
#include <integral_constants.h>

// define the class name
//
#define PARAM_FILE_CLASS_NAME "Param_file"

// string processing related parameters
//
#define PFIL_MAX_STRING_SIZE 1024
#define PFIL_MAX_NUM_PARAMS 512

#define PFIL_MAX_NUM_TOKENS (ISIP_MAX_STRING_LENGTH / 2)

// this is the format string for the scanf
// it reads name = value; into &name,&value
// name can only be a standard scanf string, no white-space
// the %*s in the middle takes care of the = and all the whitespace
// the last read reads every character until it hits a ';'
//
#define PFIL_DEF_PARSE_STATEMENT_FORMAT "%s%*s%[^;]"
// "%[^=]=%[^;]"

// the above two format strings are not used, as they have the
// terminator character hardcoded (the semicolon). As an alternative,
// the format is now specified in three portions, shown below. The
// three constants define the (0) format for the sprintf, (1) what
// goes before the terminator character, and (2) what goes after the
// terminator character. This format string is built in the private
// member function set_parse_string_cc().

#define PFIL_BUILD_PSF_FORMAT_MASK "%s%c%s%c%s%c%s"
#define PFIL_BUILD_PSF_FORMAT_0 "%[^"
#define PFIL_BUILD_PSF_FORMAT_1 "]"


// default behaviour
//
#define PFIL_DEF_TERMINATOR_CHAR ';'
#define PFIL_DEF_ASSIGNMENT_CHAR '='
#define PFIL_DEF_COMMENT_CHAR '#'

#define PFIL_MAX_BUFFER_SIZE 16384  // (16k)

// handles the pre-processing of the buffer
//
// define the states
//
// GPI stands for good previous good previous input
// LWS stands for last character whitespace
//
#define PFIL_STATE_NO_GPI 0 
#define PFIL_STATE_COMMENT_OP_NO_GPI 1
#define PFIL_STATE_LITERAL_OP 2
#define PFIL_STATE_GPI 3
#define PFIL_STATE_QUOTE_OP 4
#define PFIL_STATE_LITERAL_OP_IN_QUOTE 5
#define PFIL_STATE_GPI_LWS 6
#define PFIL_STATE_COMMENT_OP_GPI 7
#define PFIL_STATE_TERMINAL_TRIM_LWS 8

// the other state machine (symbol_pad_cc)
//
#define PFIL_STATE_PAD_NOSPACE 0
#define PFIL_STATE_PAD_SPACE 1

//  characters that have special meaning to the state machine
//
#define PFIL_LITERAL_CHR ISIP_BACKSLASH
#define PFIL_QUOTE_CHR '"'
#define PFIL_NEWLINE_CHR ISIP_NEWLINE
#define PFIL_NULL_CHR ISIP_NULL
#define PFIL_SPACE_CHR ISIP_SPACE
#define PFIL_WHITESPACE_SET " \t"
#define PFIL_BRACE_START "("
#define PFIL_BRACE_CLOSE ")"
#define PFIL_EMPTY " "

// the magic string is what is tested against the first line of the file
// to make sure the file is of the right type
//
#define PFIL_MAGIC_STR "Data collect parameter file\0"

#endif
//
// end of file







