Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

abkio.cxx File Reference

#include <iostream>
#include <iomanip>
#include <ctype.h>
#include <stdio.h>
#include "abkstring.h"
#include "abkassert.h"
#include "abkio.h"

Include dependency graph for abkio.cxx:

Include dependency graph

Go to the source code of this file.

Defines

#define eh   eathash

Functions

istream & eatblank (istream &i)
istream & skiptoeol (istream &i)
istream & impl_eathash (istream &i, int &lineNo)
istream & impl_needeol (istream &i, int lineNo=-1)
istream & impl_noeol (istream &i, int lineNo=-1)
istream & impl_isnumber (istream &i, int lineNo=-1)
istream & impl_isword (istream &i, int lineNo=-1)
istream & impl_needword (istream &in, const char *word, int lineNo=-1)
istream & impl_needcaseword (istream &in, const char *word, int lineNo=-1)
ManipFuncObj2< const char *,
int > 
needword (const char *word, int lineNo)
ManipFuncObj2< const char *,
int > 
needcaseword (const char *word, int lineNo)
ManipFuncObj1< int & > eathash (int &lineNo)
ManipFuncObj1< int > needeol (int lineNo)
ManipFuncObj1< int > noeol (int lineNo)
ManipFuncObj1< int > my_isnumber (int lineNo)
ManipFuncObj1< int > isword (int lineNo)


Define Documentation

#define eh   eathash
 

Definition at line 63 of file abkio.cxx.


Function Documentation

istream& eatblank istream &  i  ) 
 

Definition at line 65 of file abkio.cxx.

Referenced by impl_eathash(), impl_isnumber(), impl_isword(), impl_needcaseword(), impl_needeol(), impl_needword(), and impl_noeol().

00066 {
00067   while (i.peek()==' ' || i.peek()=='\t') i.get();
00068   return i;
00069 }

ManipFuncObj1<int&> eathash int &  lineNo  ) 
 

Definition at line 202 of file abkio.cxx.

00203 { return ManipFuncObj1<int&>(impl_eathash, lineNo); }

istream& impl_eathash istream &  i,
int &  lineNo
 

Definition at line 81 of file abkio.cxx.

References eatblank().

Referenced by eathash().

00082 {
00083    bool noLineNo=(lineNo==-1);
00084    i >> eatblank;
00085    while (i.peek() == '\n' || i.peek() == '\r')
00086    { 
00087       lineNo++; i.get();
00088       i >> eatblank;
00089    }
00090    // if (i.peek()!='#' && i.peek()!='\n')  {i.putback('\n'); }
00091    while (i.peek()=='#') 
00092    {
00093      while (!i.eof() && i.peek()!='\n' && i.peek()!='\r') i.get();
00094      while (!i.eof() && (i.peek()=='\n' || i.peek()=='\r')) 
00095      { i.get(); i >> eatblank; lineNo++;} 
00096    }
00097    while (i.peek() == '\n' || i.peek() == '\r')
00098    {
00099       lineNo++;
00100       i.get();
00101       i >> eatblank;
00102    }                     
00103 // if (i.peek()!='#' && i.peek()!='\n')  {i.putback('\n'); }
00104 // if (i.peek() == '\n') { i.get(); lineNo++; }
00105    if (noLineNo) lineNo=-1;
00106    return i;
00107 }

Here is the call graph for this function:

istream& impl_isnumber istream &  i,
int  lineNo = -1
 

Definition at line 139 of file abkio.cxx.

References abkfatal2, and eatblank().

Referenced by my_isnumber().

00140 {
00141    i >> eatblank;
00142    char errMess[255];
00143    char c=i.peek();
00144    if (lineNo>0) sprintf(errMess," near line %d, but starts with %c ",lineNo,c);
00145    else          sprintf(errMess,", but starts with %c ",c);
00146    abkfatal2(isdigit(i.peek()) || i.peek()=='-', " Number expected",errMess);
00147    return i;
00148 }

Here is the call graph for this function:

istream& impl_isword istream &  i,
int  lineNo = -1
 

Definition at line 150 of file abkio.cxx.

References abkfatal2, and eatblank().

Referenced by isword().

00151 {
00152    i >> eatblank;
00153    char errMess[255];
00154    char c=i.peek();
00155    if (lineNo>0) sprintf(errMess," near line %d, but starts with %c ",lineNo,c);
00156    else          sprintf(errMess,", but starts with %c ",c);
00157    abkfatal2(isalpha(c), " Word expected",errMess);
00158   return i;
00159 }

Here is the call graph for this function:

istream& impl_needcaseword istream &  in,
const char *  word,
int  lineNo = -1
 

Definition at line 178 of file abkio.cxx.

References abkfatal, abkfatal2, and eatblank().

Referenced by needcaseword().

00179 {
00180    char buffer[1024], errMess[255];  // still no way to avoid buffer overflow !
00181    in >> eatblank;
00182    in >> buffer;
00183    if (lineNo>0)
00184    {
00185       sprintf(errMess," '%s' expected near line %d. Got %s ",word,lineNo, buffer);
00186       abkfatal2(strcasecmp(buffer,word)==0,errMess,lineNo);
00187    }
00188    else
00189    {
00190        sprintf(errMess," '%s' expected. Got %s ",word, buffer);
00191        abkfatal(strcasecmp(buffer,word)==0,errMess);
00192    }                
00193    return in;
00194 }

Here is the call graph for this function:

istream& impl_needeol istream &  i,
int  lineNo = -1
 

Definition at line 109 of file abkio.cxx.

References abkfatal, abkfatal2, and eatblank().

Referenced by needeol().

00110 {
00111    i >> eatblank;
00112    if (lineNo>0)
00113    {
00114     abkfatal2(i.peek()=='\n' || i.peek()=='\r'
00115               , " End of line expected near line ",lineNo);
00116    }
00117    else
00118    {
00119     abkfatal(i.peek()=='\n' || i.peek()=='\r', " End of line expected");
00120    }
00121    return i;
00122 }

Here is the call graph for this function:

istream& impl_needword istream &  in,
const char *  word,
int  lineNo = -1
 

Definition at line 161 of file abkio.cxx.

References abkfatal, and eatblank().

Referenced by needword().

00162 {
00163    char buffer[1024], errMess[255];  // still no way to avoid buffer overflow !
00164    in >> eatblank >> buffer; 
00165    if (lineNo>0)
00166    {
00167       sprintf(errMess," '%s' expected near line %d . Got %s ",word,lineNo,buffer);
00168       abkfatal(strcmp(buffer,word)==0,errMess);
00169    }
00170    else
00171    {
00172        sprintf(errMess," '%s' expected. Got %s ",word, buffer); 
00173        abkfatal(strcmp(buffer,word)==0,errMess);
00174    }
00175    return in;
00176 }

Here is the call graph for this function:

istream& impl_noeol istream &  i,
int  lineNo = -1
 

Definition at line 124 of file abkio.cxx.

References abkfatal, abkfatal2, and eatblank().

Referenced by noeol().

00125 {
00126    i >> eatblank;
00127    if (lineNo>0)    
00128    {
00129      abkfatal2(i.peek()!='\n' && i.peek()!='\r'
00130                , " Unexpected end of line near line ", lineNo); 
00131    }
00132    else
00133    {
00134      abkfatal(i.peek()!='\n' && i.peek()!='\r', " Unexpected end of line");
00135    }
00136   return i;
00137 }

Here is the call graph for this function:

ManipFuncObj1<int> isword int  lineNo  ) 
 

Definition at line 214 of file abkio.cxx.

References impl_isword().

00215 { return ManipFuncObj1<int>(impl_isword, lineNo); }

Here is the call graph for this function:

ManipFuncObj1<int> my_isnumber int  lineNo  ) 
 

Definition at line 211 of file abkio.cxx.

References impl_isnumber().

00212 { return ManipFuncObj1<int>(impl_isnumber,lineNo); }            

Here is the call graph for this function:

ManipFuncObj2<const char *, int> needcaseword const char *  word,
int  lineNo
 

Definition at line 199 of file abkio.cxx.

References impl_needcaseword().

00200 { return ManipFuncObj2<const char *, int>(impl_needcaseword,word,lineNo); }

Here is the call graph for this function:

ManipFuncObj1<int> needeol int  lineNo  ) 
 

Definition at line 205 of file abkio.cxx.

References impl_needeol().

00206 { return ManipFuncObj1<int>(impl_needeol, lineNo); }

Here is the call graph for this function:

ManipFuncObj2<const char *, int> needword const char *  word,
int  lineNo
 

Definition at line 196 of file abkio.cxx.

References impl_needword().

00197 { return ManipFuncObj2<const char *,int>(impl_needword,word, lineNo); }

Here is the call graph for this function:

ManipFuncObj1<int> noeol int  lineNo  ) 
 

Definition at line 208 of file abkio.cxx.

References impl_noeol().

00209 { return ManipFuncObj1<int>(impl_noeol,lineNo); }

Here is the call graph for this function:

istream& skiptoeol istream &  i  ) 
 

Definition at line 71 of file abkio.cxx.

00072 {
00073   while (!i.eof() && i.peek()!='\n' && i.peek()!='\r') i.get();
00074 //if (i.peek() == '\n' || i.peek() == '\r') i.get();
00075   return i;
00076 }


Generated on Mon Apr 25 01:09:46 2005 for Parquete by doxygen 1.3.2