/**********************************************************************
                   Verish.h  -  headers for Verish.cpp
                             version 0.95
                          -------------------
    begin             : circa August 1997
    release date      : 31 January 2013
    copyright         : (C) 1997 - 2012 by Chris Austin
    email             : chris@chrisaustin.info
 **********************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef VERISH_H
#define VERISH_H

#include <iostream>
#include <fstream>
#include <exception>
#include <string>

#define MXSBJ 5     // maximum number of Subjects of a Reason or Definition, not less than 4
#define MXCLS 20    // maximum number of Clauses in a +Tb//.../ Reason
#define WNCLS 10    // number of distinct Clauses at which warnings about required time start
#define CLSSZ 700   // maximum number of integers in a Clause form
#define STSSZ 1000  // size of list of start positions
#define MXFIL 1000  // maximum number of files

// implemented in Verish.cpp

void initstrts(size_t strts[STSSZ]);
int nxtstrt(const size_t strts[STSSZ]);
void buildDev(const char* flnm, std::string& infile);
void prpflsts(std::string& infile, size_t strts[STSSZ], const size_t pos);
void prpNms(const std::string infile, const size_t stpos, std::string& Names);
void sklstTit(const std::string infile, const std::string Tit, size_t& pos);
void chkreas(std::string& infile, const std::string requestTit);
int cntMthnfbAo(const std::string infile, const size_t pos);
void chkPar(const std::string infile, const size_t strts[STSSZ], const std::string Names);
void getSent(std::string& Sent, size_t& getpos, const std::string infile);
void getReason(std::string& Sent, size_t& getpos, const std::string infile);
void nxtPar(const std::string infile, size_t& pos);
bool isObjoc(const std::string Sent, const size_t pos);
bool hasnGovObjoc(const std::string Noun, const std::string Sent);
bool hasObjoc(const std::string Prep, const std::string Sent);
bool hasVrboc(const std::string Wrd, const std::string Sent);
bool hasRelocAb(const std::string infile, const size_t pos, const std::string Sent);
bool isSbj(const std::string Sent1, const std::string Sent2);
int nmSbjPhrs(const std::string Sent);
int nmSbjBrf(const std::string Sent);
int isTb(const std::string Sent);
int isGn(const std::string Sent);
int isSm(const std::string Sent);
int isFc(const std::string Sent);
int isAb(const std::string Sent);
bool isReason(const std::string Sent);
bool isNoun(const std::string buf);
bool isOpnTit(const std::string Sent);
bool isName(const std::string Names, const std::string Noun);
size_t afterScope(const std::string Sent, size_t startpos);
void putWord(const std::string Sent, size_t& pos, std::string& buf);
bool isGovpos(const std::string Sent, const size_t pos);
bool isNounpos(const std::string Sent, size_t pos);
void dispNoNdl(const std::string Sent);
void display(const std::string Sent);
void seekTit(size_t& pos, const std::string infile, const std::string Tit, const size_t fpos);
void seekDef(size_t& pos, const std::string infile, const size_t fpos);
size_t skTitsts(const std::string infile, const std::string Tit, const size_t strts[STSSZ]);
void getSbjs(const std::string Brf, std::string Sbjs[MXSBJ]);
void TittoFact(const std::string infile, std::string Sbjs[MXSBJ], const size_t strts[STSSZ]);
void getDef(const size_t stpos, const std::string infile, std::string& chkSent, 
  std::string Sbjs[MXSBJ]);
std::string buildsubsDefn(std::string Defn, const std::string DefSbjs[MXSBJ], 
  const std::string DfSbjReps[MXSBJ]);
void chkAb(std::string chkSent, std::string Sbjs[MXSBJ], const std::string infile, 
  const size_t stpos);
void reviseNms(const size_t pos, const std::string infile, std::string& Names);
void chkDef(const std::string infile, const size_t stpos, const std::string Abb, 
  const std::string Def);
size_t seekDfNm(const std::string infile, const std::string Nm, const size_t stpos);
void oneSentgetCls(std::string Sent, std::string Cls[MXCLS]);
void getClauses(std::string chkSent, std::string Sbjs[MXSBJ], std::string Cls[MXCLS]);
void makeClsform(std::string srcSent, std::string Cls[MXCLS], int Clsform[CLSSZ]);
void subsTFvals(int Clsform[CLSSZ], int TFvals[MXCLS]);
void initTFvals(std::string Cls[MXCLS], int TFvals[MXCLS]);
int newTFvals(int TFvals[MXCLS]);
int evalClsform(int Clsform[CLSSZ]);
void chkTb(std::string chkSent, std::string Sbjs[MXSBJ]);
void chkGn(const std::string chkSent, const std::string Sbjs[MXSBJ], const std::string Names);
void chkSm(std::string chkSent, std::string Sbjs[MXSBJ]);
bool nGovforNoun(std::string chkSent, std::string Word1, std::string Word2);
bool nGovforPhrs(const std::string chkSent, const std::string Noun1, const std::string Phrase);
void chkEx(std::string chkSent, std::string Sbjs[MXSBJ]);
void chkFc(const std::string chkSent, const std::string Sbjs[MXSBJ]);
bool isInitial(char c);
bool isCapital(char c);
char possreverse(char c);

// implemented in VUtils.cpp

void VUtilsMain(const int argc, const char* argv[]);

#endif
