2 * Simulator of microcontrollers (cmd.src/newcmdposixcl.h)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
5 * Copyright (C) 2006, Borut Razem - borut.razem@siol.net
7 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
11 /* This file is part of microcontroller simulator: ucsim.
13 UCSIM is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 UCSIM is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with UCSIM; see the file COPYING. If not, write to the Free
25 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
29 #ifndef CMD_NEWCMDFDCL_HEADER
30 #define CMD_NEWCMDFDCL_HEADER
40 class cl_console: public cl_console_base
43 FILE *in, *out, *rout/*redirected output*/;
46 cl_console(void) { in = out = rout = 0; }
47 cl_console(const char *fin, const char *fout, class cl_app *the_app);
48 cl_console(FILE *fin, FILE *fout, class cl_app *the_app);
49 int cmd_do_print(const char *format, va_list ap);
51 virtual ~cl_console(void);
52 virtual class cl_console *clone_for_exec(char *fin);
54 virtual void redirect(char *fname, char *mode);
55 virtual void un_redirect(void);
56 virtual UCSOCKET_T get_in_fd(void) { return(in ? fileno(in) : -1); }
57 virtual bool is_tty(void) const { return in && isatty(fileno(in)); }
58 virtual bool is_eof(void) const { return in ? feof(in) : true; }
59 virtual bool input_avail(void) { return input_active() ? ::input_avail(fileno(in)) : false; };
60 virtual char *read_line(void);
63 FILE *get_out(void) { return rout ? rout : out; }
67 class cl_listen_console: public cl_console
73 cl_listen_console(int serverport, class cl_app *the_app);
75 virtual void welcome(void) {}
77 virtual UCSOCKET_T get_in_fd(void) { return(sock); }
78 virtual int proc_input(class cl_cmdset *cmdset);
83 class cl_sub_console: public cl_console
86 class cl_console_base *parent;
89 cl_sub_console(class cl_console_base *the_parent,
90 FILE *fin, FILE *fout, class cl_app *the_app);
91 virtual ~cl_sub_console(void);
92 virtual int init(void);
100 class cl_commander: public cl_commander_base
103 fd_set read_set, active_set;
107 cl_commander(class cl_app *the_app, class cl_cmdset *acmdset)
108 : cl_commander_base(the_app, acmdset)
112 virtual int init(void);
113 virtual void set_fd_set(void);
114 virtual int input_avail(void);
115 virtual int wait_input(void);
116 virtual int proc_input(void);
121 /* End of cmd.src/newcmdposixcl.h */