1  | 
     | 
    /*  | 
    
    
    2  | 
     | 
     * Copyright (C) 2013 Jeff Epler <jepler@unpythonic.net>  | 
    
    
    3  | 
     | 
     *  | 
    
    
    4  | 
     | 
     *  This program is free software; you can redistribute it and/or  | 
    
    
    5  | 
     | 
     *  modify it under the terms of the GNU General Public License  | 
    
    
    6  | 
     | 
     *  as published by the Free Software Foundation; either version 2  | 
    
    
    7  | 
     | 
     *  of the License, or (at your option) any later version.  | 
    
    
    8  | 
     | 
     *  | 
    
    
    9  | 
     | 
     *  This program is distributed in the hope that it will be useful,  | 
    
    
    10  | 
     | 
     *  but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
    
    
    11  | 
     | 
     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  | 
    
    
    12  | 
     | 
     *  GNU General Public License for more details.  | 
    
    
    13  | 
     | 
     *  | 
    
    
    14  | 
     | 
     *  You should have received a copy of the GNU General Public License  | 
    
    
    15  | 
     | 
     *  along with this program; if not, write to the Free Software  | 
    
    
    16  | 
     | 
     *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.  | 
    
    
    17  | 
     | 
     */  | 
    
    
    18  | 
     | 
    #include <stdlib.h>  | 
    
    
    19  | 
     | 
    #include <boost/noncopyable.hpp>  | 
    
    
    20  | 
     | 
     | 
    
    
    21  | 
     | 
    /* Size of certain arrays */  | 
    
    
    22  | 
     | 
    #define ACTIVE_G_CODES 16  | 
    
    
    23  | 
     | 
    #define ACTIVE_M_CODES 10  | 
    
    
    24  | 
     | 
    #define ACTIVE_SETTINGS 3  | 
    
    
    25  | 
     | 
     | 
    
    
    26  | 
    69  | 
    class InterpBase : boost::noncopyable { | 
    
    
    27  | 
     | 
    public:  | 
    
    
    28  | 
     | 
        virtual ~InterpBase();  | 
    
    
    29  | 
     | 
        virtual char *error_text(int errcode, char *buf, size_t buflen) = 0;  | 
    
    
    30  | 
     | 
        virtual char *line_text(char *buf, size_t buflen) = 0;  | 
    
    
    31  | 
     | 
        virtual char *file_name(char *buf, size_t buflen) = 0;  | 
    
    
    32  | 
     | 
        virtual char *stack_name(int index, char *buf, size_t buflen) = 0;  | 
    
    
    33  | 
     | 
        virtual size_t line_length() = 0;  | 
    
    
    34  | 
     | 
        virtual int sequence_number() = 0;  | 
    
    
    35  | 
     | 
        virtual int ini_load(const char *inifile) = 0;  | 
    
    
    36  | 
     | 
        virtual int init() = 0;  | 
    
    
    37  | 
     | 
        virtual int execute() = 0;  | 
    
    
    38  | 
     | 
        virtual int execute(const char *line) = 0;  | 
    
    
    39  | 
     | 
        virtual int execute(const char *line, int line_number) = 0;  | 
    
    
    40  | 
     | 
        virtual int synch() = 0;  | 
    
    
    41  | 
     | 
        virtual int exit() = 0;  | 
    
    
    42  | 
     | 
        virtual int open(const char *filename) = 0;  | 
    
    
    43  | 
     | 
        virtual int read() = 0;  | 
    
    
    44  | 
     | 
        virtual int read(const char *line) = 0;  | 
    
    
    45  | 
     | 
        virtual int close() = 0;  | 
    
    
    46  | 
     | 
        virtual int reset() = 0;  | 
    
    
    47  | 
     | 
        virtual int line() = 0;  | 
    
    
    48  | 
     | 
        virtual int call_level() = 0;  | 
    
    
    49  | 
     | 
        virtual char *command(char *buf, size_t buflen) = 0;  | 
    
    
    50  | 
     | 
        virtual char *file(char *buf, size_t buflen) = 0;  | 
    
    
    51  | 
     | 
        virtual int on_abort(int reason, const char *message) = 0;  | 
    
    
    52  | 
     | 
        virtual void active_g_codes(int active_gcodes[ACTIVE_G_CODES]) = 0;  | 
    
    
    53  | 
     | 
        virtual void active_m_codes(int active_mcodes[ACTIVE_M_CODES]) = 0;  | 
    
    
    54  | 
     | 
        virtual void active_settings(double active_settings[ACTIVE_SETTINGS]) = 0;  | 
    
    
    55  | 
     | 
        virtual void set_loglevel(int level) = 0;  | 
    
    
    56  | 
     | 
    };  | 
    
    
    57  | 
     | 
     | 
    
    
    58  | 
     | 
    InterpBase *interp_from_shlib(const char *shlib);  | 
    
    
    59  | 
     | 
    extern "C" InterpBase *makeInterp();  |