#include "ddconfig.h"
#include <stdio.h>
+#include <stdarg.h>
#include <sys/types.h>
#if FD_HEADER_OK
# include HEADER_FD
// Flags of consoles
-#define CONS_NONE 0
-#define CONS_DEBUG 0x01 // Print debug messages on this console
-#define CONS_FROZEN 0x02 // Console is frozen (g command issued)
-#define CONS_PROMPT 0x04 // Prompt is out, waiting for input
-#define CONS_INTERACTIVE 0x08 // Interactive console
-#define CONS_NOWELCOME 0x10 // Do not print welcome message
-#define CONS_INACTIVE 0x20 // Do not do any action
-#define CONS_ECHO 0x40 // Echo commands
-
-#define SY_ADDR 'a'
-#define ADDRESS "a"
-#define SY_NUMBER 'n'
-#define NUMBER "n"
-#define SY_DATA 'd'
-#define DATA "d"
-#define SY_STRING 's'
-#define STRING "s"
-#define SY_MEMORY 'm'
-#define MEMORY "m"
-#define SY_HW 'h'
-#define HW "h"
-#define SY_DATALIST 'D'
-#define DATALIST "D"
-#define SY_BIT 'b'
-#define BIT "b"
+#define CONS_NONE 0
+#define CONS_DEBUG 0x01 // Print debug messages on this console
+#define CONS_FROZEN 0x02 // Console is frozen (g command issued)
+#define CONS_PROMPT 0x04 // Prompt is out, waiting for input
+#define CONS_INTERACTIVE 0x08 // Interactive console
+#define CONS_NOWELCOME 0x10 // Do not print welcome message
+#define CONS_INACTIVE 0x20 // Do not do any action
+#define CONS_ECHO 0x40 // Echo commands
+
+#define SY_ADDR 'a'
+#define ADDRESS "a"
+#define SY_NUMBER 'n'
+#define NUMBER "n"
+#define SY_DATA 'd'
+#define DATA "d"
+#define SY_STRING 's'
+#define STRING "s"
+#define SY_MEMORY 'm'
+#define MEMORY "m"
+#define SY_HW 'h'
+#define HW "h"
+#define SY_DATALIST 'D'
+#define DATALIST "D"
+#define SY_BIT 'b'
+#define BIT "b"
class cl_prompt_option: public cl_optref
class cl_prompt_option *prompt_option;
class cl_optref *null_prompt_option;
class cl_debug_option *debug_option;
+ class cl_ustrings *lines_printed;
+ class cl_cmd *last_command;
+ class cl_cmdline *last_cmdline;
public:
class cl_app *app;
- char *last_command;
int flags; // See CONS_XXXX
char *prompt;
-
+
public:
cl_console(void): cl_base() { app= 0; in= out= 0; flags= 0; }
cl_console(char *fin, char *fout, class cl_app *the_app);
cl_console(int portnumber, class cl_app *the_app);
#endif
virtual ~cl_console(void);
- virtual class cl_console *cl_console::clone_for_exec(char *fin);
+ virtual class cl_console *clone_for_exec(char *fin);
virtual int init(void);
+ virtual bool accept_last(void);
+
virtual void welcome(void);
virtual void redirect(char *fname, char *mode);
virtual void un_redirect(void);
- virtual FILE *get_out(void) { return(rout?rout:out); }
+ int cmd_do_print(char *format, va_list ap);
virtual void print_prompt(void);
virtual int dd_printf(char *format, ...);
+ virtual int debug(char *format, ...);
virtual void print_bin(long data, int bits);
virtual void print_char_octal(char c);
virtual int match(int fdnum);
virtual void set_id(int new_id);
virtual int get_id(void) { return(id); }
virtual void set_prompt(char *p);
+private:
+ FILE *get_out(void) { return(rout?rout:out); }
};
#ifdef SOCKET_AVAIL
cl_listen_console(int serverport, class cl_app *the_app);
virtual void welcome(void) {}
- virtual void prompt(void) {}
virtual int match(int fdnum);
virtual int get_in_fd(void);
class cl_console *parent;
public:
cl_sub_console(class cl_console *the_parent,
- FILE *fin, FILE *fout, class cl_app *the_app);
+ FILE *fin, FILE *fout, class cl_app *the_app);
virtual ~cl_sub_console(void);
virtual int init(void);
};
class cl_app *app;
class cl_list *cons;
fd_set read_set, active_set;
- int fd_num;
- //class cl_sim *sim;
+ UCSOCKET_T fd_num;
class cl_console *actual_console, *frozen_console;
class cl_cmdset *cmdset;
public:
cl_commander(class cl_app *the_app,
- class cl_cmdset *acmdset/*, class cl_sim *asim*/);
+ class cl_cmdset *acmdset/*, class cl_sim *asim*/);
virtual ~cl_commander(void);
virtual int init(void);
void set_fd_set(void);
void prompt(void);
- int all_printf(char *format, ...); // print to all consoles
- int all_print(char *string, int length);
- int dd_printf(char *format, ...); // print to actual_console
- int debug(char *format, ...); // print consoles with debug flag set
+ int all_printf(char *format, ...); // print to all consoles
+ int dd_printf(char *format, va_list ap); // print to actual_console
+ int dd_printf(char *format, ...); // print to actual_console
+ int debug(char *format, ...); // print consoles with debug flag set
+ int debug(char *format, va_list ap); // print consoles with debug flag set
int flag_printf(int iflags, char *format, ...);
int input_avail(void);
int input_avail_on_frozen(void);
int wait_input(void);
int proc_input(void);
+ void exec_on(class cl_console *cons, char *file_name);
};