/usr/include/ComTerp/comterpserv.h is in ivtools-dev 1.2.11a1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | /*
* Copyright (c) 2000 IET Inc.
* Copyright (c) 1994-1999 Vectaport Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. The copyright holders make
* no representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
* IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* ComTerpServ is a ComTerp with added ability to load its input from a buffer.
*/
#ifndef comterpserv_h
#define comterpserv_h
/*
* Server-oriented interpreter deals with strings
*/
#ifdef HAVE_ACE
#include <ace/config.h>
#endif
#include <ComTerp/comterp.h>
//: extended ComTerp that works with buffered IO.
class ComTerpServ : public ComTerp {
public:
ComTerpServ(int bufsize = 1024/* *1024 */, int fd = -1);
// construct with optional 'bufsize', and on an optional 'fd'.
~ComTerpServ();
void load_string(const char*);
// load string to be interpreted into buffer.
void read_string(const char*);
// load string to be interpreted into buffer, and read postfix
// tokens from it.
postfix_token* gen_code(const char*, int& codelen);
// generate buffer of length 'codelen' of postfix tokens ready
// to be converted into ComValue objects and executed.
virtual int run(boolean one_expr=false, boolean nested=false);
// run this interpreter until quit or exit command.
virtual ComValue run(const char*, boolean nested=false);
// interpret and return value of expression. 'nested' flag used
// to indicated nested call to the run() method, to avoid
// re-initialization.
virtual ComValue run(postfix_token*, int);
// execute a buffer of postfix tokens and return the value.
virtual int runfile(const char*, boolean popen_flag=0);
// run interpreter on commands read from a file.
void add_defaults();
// add a default list of ComFunc objects to this interpreter.
virtual boolean is_serv() { return true; }
// flag to test if ComTerp or ComTerpServ
void delete_later(boolean flag) { _delete_later = flag; }
boolean delete_later() { return _delete_later; }
protected:
static char* s_fgets(char* s, int n, void* serv);
// signature like fgets used to copy input from a buffer.
static int s_feof(void* serv);
// signature like feof used to relay end-of-file.
static int s_ferror(void* serv);
// signature like ferror used to relay error info.
static int s_fputs(const char* s, void* serv);
// signature like fputs used to copy output back to buffer.
static char* fd_fgets(char* s, int n, void* serv);
// signature like fgets used to explicitly read from an filedescriptor.
static int fd_fputs(const char* s, void* serv);
// signature like fputs used to explicitly read from an filedescriptor.
protected:
int _linesize;
char* _instr;
int _inpos;
char* _outstr;
int _outpos;
FILE* _fptr;
int _instat;
int _logger_mode;
int _delete_later;
friend class ComterpHandler;
friend class ComTerpIOHandler;
};
#endif
|