fdhwlib  2.0.25
/home/kopmann/git-mirror/fdhwlib/fdhwlib/akshell/shell.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     shell.h  -  description
00003 
00004     begin                : Wed Jan 3 2001
00005     copyright            : (C) 2001 by A Kopmann
00006     email                : kopmann@hpe.fzk.de
00007     status               :
00008     test                 :
00009     history              : Extended command line editing for
00010                            linux added, ak 4.1.01
00011  ***************************************************************************/
00012 
00013 
00014 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
00015 #pragma once
00016 #endif
00017 
00018 #ifndef _INC_SHELL_3924F1340363_INCLUDED
00019 #define _INC_SHELL_3924F1340363_INCLUDED
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif // HAVE_CONFIG_H
00024 
00025 
00026 #include <cstdio>
00027 #include <iostream>
00028 #include <string>  // this NOT the same as string.h !!!
00029 
00030 #include <stdlib.h>
00031 #include <sys/types.h>
00032 
00033 #if defined __GNUC__ && HAVE_READLINE_READLINE_H
00034 #define SHELL_HISTORY  // The GNU C++ Compiler has no command management!
00035 #endif
00036 
00037 #ifdef SHELL_HISTORY
00038 #include <readline/readline.h>
00039 #include <readline/history.h>
00040 
00041 //extern HIST_ENTRY **history_list ();
00042 #endif
00043 
00044 #include "cmds.h"
00045 
00046 #define SHELL_INI "shell.ini"
00047 #define SHELL_COMMENT "%;#"
00048 
00049 
00050 #include <fdhwlib.h>
00051 
00052 
00199 class shell {
00200 public:
00201 
00202   bool run(const char * batch=0);
00203 
00204   //##ModelId=399122090264
00205   bool run(FILE * fin, FILE* fout, const char *batch = 0, char *execLine = 0);
00206 
00207   //##ModelId=399122090251
00208   shell(cmds * *  obj, int n);
00209 
00210   //##ModelId=39912209025C
00211   shell(     );
00212 
00213   char * version();
00214 
00216   char * replaceString(std::string *result, const char *tag, const char *value);
00217 
00219   char * replaceStringByDate(std::string *result, const char *tag = "<date>");
00220 
00223   char * replaceStringByTime(std::string *result, const char *tag = "<time>");
00224 
00226   char * replaceStringByLocation(std::string *result, const char *tag = "<location>");
00227 
00229   char * replaceStringByTelescope(std::string *result, const char *tag = "<tel>");
00230 
00236   char *replaceVariable(char *pTag, const char *tag, int value);
00237 
00238   char *replaceVariable(std::string *pTag, const char *tag, int value);
00239   
00240   char *replaceVariableByEye(char *pTag, const char *tag);
00241   
00242   char *replaceVariableByEye(std::string *pTag, const char *tag);
00243   
00244   char *replaceVariableByTelescope(char *pTag, const char *tag);
00245     
00246   char *replaceVariableByTelescope(std::string *pTag, const char *tag);
00247 
00248     
00250   void convertStringToLower(std::string *result);
00251 
00253   void getBasedir(std::string *basedir, int eyeId=0);
00254 
00256   void setBasedir(char * basedir, int eyeId=0);
00257 
00259   void setTelescope(int id);
00260 
00262   const char * getLocation(int eyeId=0);
00263 
00265   int getLocationId();
00266 
00268   //const char * getBasedir();
00269 
00271   const char * getGpsserver(int id = 0);
00272 
00274   int getGpsserverPort(int id = 0);
00275 
00276 
00279   int debug;
00280 
00281   std::string prompt;
00282 
00283   std::string inifile;
00284 
00285   std::string project;
00286 
00288   int eyeId;
00289 
00290   std::string location[FD_STATIONS];
00291 
00293   int locationId[FD_STATIONS];
00294 
00297   int telescopeId;
00298   
00299   std::string basedir[FD_STATIONS];
00300 
00302   std::string gpsserver[FD_STATIONS];
00303   
00305   int gpsserverPort[FD_STATIONS];
00306   
00308   int iter;
00309 
00310   
00311 
00312   // results ...
00313 
00315   int iRes;
00316 
00318   unsigned long uReg;
00319 
00321   float fRes;
00322 
00324   std::string sRes;
00325 
00327   int iResMatrix[20][24];
00328 
00330   float fResMatrix[20][24];
00331 
00333   std::string sResMatrix[20];
00334 
00336   std::string logfile;
00337     
00339   std::string configdir;
00340 
00342   FILE *flog;
00343 
00345   void writeLogMsg(const char *msg, ...);
00346 
00347 private:
00348 
00349   //##ModelId=399122090248
00350   cmds * *  obj;
00351 
00352   //##ModelId=39912209023D
00353   int n;
00354 
00355 
00356 };
00357 
00358 #endif /* _INC_SHELL_3924F1340363_INCLUDED */
00359