00001 //# CalLibraryTools.h: access to cal library file parser 00002 //# Copyright (C) 2015 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 // 00027 #ifndef CALLIB_CALLIBRARYTOOLS_H 00028 #define CALLIB_CALLIBRARYTOOLS_H 00029 00030 #include <casacore/casa/aips.h> 00031 #include <casacore/casa/BasicSL/String.h> 00032 #include <casacore/casa/Containers/Record.h> 00033 #include <synthesis/CalLibrary/CalLibraryParse.h> 00034 00035 namespace casa { 00036 00037 // <summary> 00038 // Interface to flex/bison scanner/parser for a CalLibrary file. 00039 // The calibration instructions are returned in a Record. 00040 // </summary> 00041 00042 // <use visibility=local> 00043 00044 // <prerequisite> 00045 //# Classes you should understand before using this one. 00046 // <li> CalLibraryGram.l and .y (flex and bison grammar) 00047 // </prerequisite> 00048 00049 // <synopsis> 00050 // Global functions are needed to define the input of the flex scanner 00051 // and to start the bison parser. 00052 // The input is taken from a cal library file or string (basically the 00053 // contents of the file). 00054 // </synopsis> 00055 00056 // The Record for the specified file is filled in by the parser. 00057 Record callibSetParams(const String& calLibrary); 00058 00059 // Declare the bison parser (is implemented by bison command). 00060 Record calLibraryGramParseCommand(CalLibraryParse* parser, const String& calLibrary); 00061 00062 // The yyerror function for the parser. 00063 // It throws an exception with the current token. 00064 void CalLibraryGramerror(const char* s); 00065 00066 // Declare the input routine for flex/bison. 00067 int calLibraryGramInput (char* buf, int max_size); 00068 void clearBuf(char* buf, int size); 00069 00070 // Current line number in file, for parse errors 00071 Int& calLibLineNum(); 00072 00073 // Give the Record 00074 const Record* calLibraryRecord(); 00075 } 00076 00077 #endif